Class ModuleDB

  • All Implemented Interfaces:
    java.io.Serializable

    public class ModuleDB
    extends java.lang.Object
    implements java.io.Serializable
    Module definition
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ModuleDB​(java.lang.String id, java.lang.String name, java.lang.String version)
      Constructor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void buildSQL​(Grant g)
      Generates SQL scripts (for all DB vendors) for specified module
      java.util.List<java.lang.String> getChildModules()
      Get module's children modules dependencies
      static java.util.List<java.lang.String> getChildModules​(java.lang.String name)
      Get specified module's children modules dependencies
      static org.json.JSONObject getConfiguration​(java.lang.String config)
      Get module configuration as JSON object
      java.lang.String getId()
      Get ID
      static org.json.JSONObject getMavenConfiguration​(java.lang.String config)
      Get module Maven configuration as JSON object
      static java.lang.String getModuleId​(java.lang.String name)
      Returns module ID for specified name
      static java.lang.String getModuleId​(java.lang.String name, boolean create)
      Returns module ID for specified name
      static java.lang.String getModuleName​(java.lang.String id)
      Returns module name for specified ID
      static java.lang.String getModuleVersionFromId​(java.lang.String id)
      Get module version from row ID
      static java.lang.String getModuleVersionFromName​(java.lang.String name)
      Get module version from name
      java.lang.String getName()
      Get name
      java.util.List<java.lang.String> getParentModules()
      Get module's parent modules dependencies
      static java.util.List<java.lang.String> getParentModules​(java.lang.String name)
      Get specified module's parent modules dependencies
      static org.json.JSONObject getRemotesConfiguration​(java.lang.String config)
      Get module remotes configuration as JSON object
      java.lang.String getVersion()
      Get version
      boolean hasJavaCode()
      Check whether current module has Java code
      static boolean hasJavaCode​(java.lang.String name)
      Check whether the specified module has Java code
      static boolean isSystemModule​(java.lang.String module)
      Check if a module belongs to the core system
      static boolean isSystemTable​(java.lang.String table)
      Check if a table belongs to the core repository
      static java.util.List<java.lang.String> notSystemModuleObjectList​(Grant g)
      Get all non system objects which have a link to module
      java.lang.String openAPI​(int spec)
      Generate OpenAPI/Swagger schema
      static java.util.List<java.lang.String[]> selectAllModuleObjectList​(Grant g)
      Get all objects which have a link to module
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ModuleDB

        public ModuleDB​(java.lang.String id,
                        java.lang.String name,
                        java.lang.String version)
        Constructor
        Parameters:
        id - ID
        name - Name
        version - Version
    • Method Detail

      • getId

        public java.lang.String getId()
        Get ID
        Returns:
        ID
      • getName

        public java.lang.String getName()
        Get name
        Returns:
        Name
      • getVersion

        public java.lang.String getVersion()
        Get version
        Returns:
        Version
      • getModuleName

        public static java.lang.String getModuleName​(java.lang.String id)
        Returns module name for specified ID
        Parameters:
        id - Module row ID
        Returns:
        Module name if exists or null
      • getModuleId

        public static java.lang.String getModuleId​(java.lang.String name)
        Returns module ID for specified name
        Parameters:
        name - Module name
        Returns:
        Module ID or null s
      • getModuleId

        public static java.lang.String getModuleId​(java.lang.String name,
                                                   boolean create)
        Returns module ID for specified name
        Parameters:
        name - Module name
        create - Create module if not exists?
        Returns:
        Module ID
      • getModuleVersionFromId

        public static java.lang.String getModuleVersionFromId​(java.lang.String id)
        Get module version from row ID
        Parameters:
        id - Module ID
        Returns:
        Module version
      • getModuleVersionFromName

        public static java.lang.String getModuleVersionFromName​(java.lang.String name)
        Get module version from name
        Parameters:
        name - Module name
        Returns:
        Module version
      • getChildModules

        public static java.util.List<java.lang.String> getChildModules​(java.lang.String name)
        Get specified module's children modules dependencies
        Parameters:
        name - Parent module name
        Returns:
        List of children modules
      • getChildModules

        public java.util.List<java.lang.String> getChildModules()
        Get module's children modules dependencies
        Returns:
        List of children modules
      • getParentModules

        public static java.util.List<java.lang.String> getParentModules​(java.lang.String name)
        Get specified module's parent modules dependencies
        Parameters:
        name - Child module name
        Returns:
        List of parent modules
      • getParentModules

        public java.util.List<java.lang.String> getParentModules()
        Get module's parent modules dependencies
        Returns:
        List of children modules
      • openAPI

        public java.lang.String openAPI​(int spec)
        Generate OpenAPI/Swagger schema
        Parameters:
        spec - OpenAPI specification (one of JSONTool.OPENAPI_OAS*)
      • hasJavaCode

        public static boolean hasJavaCode​(java.lang.String name)
        Check whether the specified module has Java code
        Parameters:
        name - Module name
        Returns:
        True if module has Java code
      • hasJavaCode

        public boolean hasJavaCode()
        Check whether current module has Java code
        Returns:
        True if module has Java code
      • getConfiguration

        public static org.json.JSONObject getConfiguration​(java.lang.String config)
        Get module configuration as JSON object
        Parameters:
        config - Module configuration string
        Returns:
        JSON object (empty if configuration is empty or not parsable)
      • getRemotesConfiguration

        public static org.json.JSONObject getRemotesConfiguration​(java.lang.String config)
        Get module remotes configuration as JSON object
        Parameters:
        config - Module configuration string
        Returns:
        JSON object
      • getMavenConfiguration

        public static org.json.JSONObject getMavenConfiguration​(java.lang.String config)
        Get module Maven configuration as JSON object
        Parameters:
        config - Module configuration string
        Returns:
        JSON object
      • selectAllModuleObjectList

        public static java.util.List<java.lang.String[]> selectAllModuleObjectList​(Grant g)
        Get all objects which have a link to module
        Parameters:
        g - Grant
        Returns:
        List of objects with link to module
      • notSystemModuleObjectList

        public static java.util.List<java.lang.String> notSystemModuleObjectList​(Grant g)
        Get all non system objects which have a link to module
        Parameters:
        g - Grant
        Returns:
        List of non system module's objects
      • isSystemModule

        public static boolean isSystemModule​(java.lang.String module)
        Check if a module belongs to the core system
        Parameters:
        module - Module name
        Returns:
        True if module is a core system module
      • isSystemTable

        public static boolean isSystemTable​(java.lang.String table)
        Check if a table belongs to the core repository
        Parameters:
        table - Table name
        Returns:
        True if contains a row module ID column
      • buildSQL

        public void buildSQL​(Grant g)
        Generates SQL scripts (for all DB vendors) for specified module
        Parameters:
        g - Grant