Interface DDLService


  • public interface DDLService
    Interface that defines the DDL aspects of the database. Any information about the tables, indexes etc. in the database, and operations that change this (e.g. create new table) are performed through this interface.
    Author:
    Martin Adamek
    • Field Detail

      • XATTR_SCHEMA_LOGGING

        static final java.lang.String XATTR_SCHEMA_LOGGING
        An IJC schema extra attribute name that controls logging into IJC_INVOCATION_LOG table.
        Since:
        6.3
        See Also:
        Constant Field Values
    • Method Detail

      • getModel

        @Transactional
        ModelInfo getModel​(com.im.ijcs.api.util.DFUser user,
                           boolean userCanEditModel,
                           com.im.commons.progress.DFFeedback feedback)
        Get the DIF model for the specified username. The ModelInfo is a Serializable representation of the DIF schema (e.g. a set of DTOs) that can be used to assemble the DIF model on the client tier.
        Parameters:
        user - The user.
        Returns:
        The ModelInfo
      • getViewsForUser

        @Transactional
        java.util.List<ViewInfo> getViewsForUser​(java.lang.String dataTreeID,
                                                 com.im.ijcs.api.util.DFUser user,
                                                 com.im.commons.sharing.SharingPrivilege sharedFor)
        Get all the views for this user. Either his own or shared to him for a specific action.
        Parameters:
        dataTreeID - get only views within this datatree
        user - The user
        sharedFor - the intended action
        Returns:
        A List of view DTOs.
      • getViewsForUser

        @Transactional
        java.util.Map<? extends java.lang.String,​java.util.List<? extends ViewInfo>> getViewsForUser​(com.im.ijcs.api.util.DFUser user,
                                                                                                           com.im.commons.sharing.SharingPrivilege sharedFor)
        Gets all the views for this user from all datatrees. Either his own or shared to him for a specific action.
        Parameters:
        user - The user
        sharedFor - the intended action
        Returns:
        Immutable map where key is datatree id and value List of view DTOs for the datatree.
        Since:
        14.8.25
      • getAllViewsToManageThem

        @Transactional
        java.util.Map<? extends java.lang.String,​java.util.List<? extends ViewInfo>> getAllViewsToManageThem​(com.im.ijcs.api.util.DFUser user,
                                                                                                                   com.im.commons.sharing.SharingPrivilege sharedFor)
        Gets all the views for all users from all datatrees.
        Parameters:
        user - The user
        sharedFor - the intended action
        Returns:
        Immutable map where key is datatree id and value List of view DTOs for the datatree.
      • getFullViewsForUser

        @Transactional
        @Deprecated
        java.util.List<ViewConfigInfo> getFullViewsForUser​(java.lang.String dataTreeID,
                                                           com.im.ijcs.api.util.DFUser user,
                                                           com.im.commons.sharing.SharingPrivilege sharedFor)
        Deprecated.
        In most cases, there is no need to load multiple full views at once. This method blocks until all full items are loaded and it needs to allocate memory for all of them.
        Get all the views for this user, including view config. Either his own or shared to him for a specific action.
        Parameters:
        dataTreeID - get only views within this datatree
        user - The user
        sharedFor - the intended action
        Returns:
        A List of view DTOs.
      • getFullView

        @Transactional
        ViewConfigInfo getFullView​(ViewInfo vi)
        Get full information about the view. This method does not do any other security/sharing validation. It assumes the owner of ViewInfo has rights to ViewConfigInfo.
        Parameters:
        vi - ViewInfo
        Returns:
        A List of view DTOs.
      • getFullList

        @Transactional
        ListInfo getFullList​(ListInfo li)
        Get full information about the list. This method does not do any other security/sharing validation. It assumes the owner of ListInfo has rights to ListInfo.
        Parameters:
        li - ListInfo
        Returns:
        A ListInfo.
        Since:
        14.8.4
      • getQueriesForUser

        @Transactional
        java.util.List<QueryInfo> getQueriesForUser​(java.lang.String dataTreeID,
                                                    com.im.ijcs.api.util.DFUser user,
                                                    com.im.commons.sharing.SharingPrivilege sharedFor)
        Get all the queries for this user. Either his own or shared to him for a specific action.
        Parameters:
        dataTreeID - The data tree whose queries you want
        user - The user
        sharedFor - the intended action
        Returns:
        A List of Query DTOs.
      • getScriptsForUser

        @Transactional
        java.util.List<ScriptInfo> getScriptsForUser​(java.lang.String scriptParentID,
                                                     com.im.ijcs.api.util.DFUser user,
                                                     com.im.commons.sharing.SharingPrivilege sharedFor)
      • getListsForUser

        @Transactional
        java.util.List<ListInfo> getListsForUser​(java.lang.String entityID,
                                                 java.lang.String entityIDField,
                                                 java.util.List<java.lang.String> allFieldIDs,
                                                 com.im.ijcs.api.util.DFUser user,
                                                 com.im.commons.sharing.SharingPrivilege sharedFor)
        Get all the lists for this user. Either his own or shared to him for a specific action. The entity and field details need to be passed in as old lists were assigned to the entity, but new ones are assigned to the field and we need to retrieve both types. All lists returned will have the correct FIELD ID, even if they are stored using the entity ID.
        Parameters:
        entityID - The entity whose lists you want
        entityIDField - The ID of the ID field
        allFieldIDs - The IDs of all the fields in this entity
        user - The user
        sharedFor - the intended action
        Returns:
        A List of List DTOs.
      • getCustomItemSharing

        @Transactional
        com.im.commons.sharing.DFSharing getCustomItemSharing​(java.lang.String itemId)
        Parameters:
        itemId - item's UUID
        Returns:
        state of sharing of custom item
      • getAllTableNames

        @Transactional(readOnly=true)
        java.lang.String[] getAllTableNames​(java.lang.String schema)
        Get the names of the tables that are accessible from this schema.
        Returns:
        An array of table names
      • getAllViewNames

        @Transactional(readOnly=true)
        java.lang.String[] getAllViewNames​(java.lang.String schema)
        Get the names of the views that are accessible from this schema.
        Returns:
        An array of view names
      • getTableInfo

        @Transactional(readOnly=true)
        com.im.commons.db.ddl.DBTableInfo getTableInfo​(java.lang.String schema,
                                                       java.lang.String name)
        Get the table info for the specified table or view
        Parameters:
        name -
        Returns:
        The table info
      • getTableInfoFull

        @Transactional(readOnly=true)
        com.im.commons.db.ddl.DBTableInfo getTableInfoFull​(java.lang.String schema,
                                                           java.lang.String name)
      • getTableInfoIgnoreCache

        @Transactional(readOnly=true)
        com.im.commons.db.ddl.DBTableInfo getTableInfoIgnoreCache​(java.lang.String schema,
                                                                  java.lang.String name,
                                                                  com.im.commons.progress.DFFeedback feedback)
      • getIndexInfo

        @Transactional(readOnly=true)
        com.im.commons.db.ddl.DBIndexInfo getIndexInfo​(java.lang.String schema,
                                                       java.lang.String indexName)
        Get the description for this index
      • getIndexInfos

        @Transactional(readOnly=true)
        java.util.List<com.im.commons.db.ddl.DBIndexInfo> getIndexInfos​(java.lang.String schema,
                                                                        java.lang.String tableName)
        See index descriptions for this table
      • performOperation

        @Transactional(isolation=READ_COMMITTED)
        InvocationDescription performOperation​(OperationDefinition op,
                                               com.im.commons.progress.DFFeedback feedback)

        Perform this single operation.

        WARNING: this method may potentially invoke a remote method call.

        Example: DDLService ddl = ...; DFEnvironmentRW env = ...; OperationDefinition op = new OperationDefinition("drop-column-operation"); op.addPropertyValue("tableSetInfo", desc); op.addPropertyValue("tableIndex", index); op.addPropertyValue("columns", cols); ddl.performOperation(op, env);
        Parameters:
        op - The operation
        feedback - The feedback for reporting operation progress, etc.
        Returns:
        A description of the changes that have been applied to the model
      • performOperations

        @Transactional(isolation=READ_COMMITTED)
        InvocationDescription performOperations​(java.util.List<OperationDefinition> ops,
                                                com.im.commons.progress.DFFeedback feedback)

        Allows multiple operations to be performed in one remote call.

        WARNING: this method may potentially invoke a remote method call.

        This method (like most in this interface) is transactional, but be aware that when DDL operations are performed the current transaction will usually be immediately committed, and DDL operations will NOT be rolled back if the transaction is later rolled back. Generally speaking it is best to perform any DDL operations (e.g. create table) before doing DML operations (e.g. update the IJC_* metadata tables).

        The method is transactional to ensure that the connection is "clean" on completion of the method call, even if errors have occurred. This avoids the connection being put back into the pool in a state that is not committed or rolled back (this can cause errors later on, particularly on Oracle).

        Parameters:
        ops - The list of operations. Will be performed in the specified order.
        feedback - The feedback for reporting operation progress, etc.
        Returns:
        A description of the changes that have been applied to the model
      • getSchemaInfo

        SchemaInfo getSchemaInfo()
        Returns:
        Returns the current SchemaInfo
      • getUserName

        java.lang.String getUserName()
        Returns:
        current username
      • isLoggingEnabled

        boolean isLoggingEnabled()
        Determines if the database operations logging is enabled.
        Returns:
        true if the logging is enabled, false otherwise.
        Since:
        6.3
      • getMatchingStructures

        @Transactional
        java.util.List<StructureIdMappingInfo> getMatchingStructures​(java.lang.String structureHash)
        Gets structure id mappings by calculated structure hash
        Parameters:
        structureHash - hast t occompare with
        Returns:
        if there is no unlucky hash colission, it returns just one matching item or zero
      • addStructure

        @Transactional
        void addStructure​(StructureIdMappingInfo structure)
        Inserts new structure id mapping
        Parameters:
        structure - item to be stored
      • getStructureById

        @Transactional
        StructureIdMappingInfo getStructureById​(java.lang.String id)
        Gets one structure mapping by specific id
        Parameters:
        id - id of structure
        Returns:
        mapping registered by that id
      • addConnectCustomItem

        @Transactional
        void addConnectCustomItem​(ConnectCustomItemInfo dto)
        Adds new connect custom item
        Parameters:
        dto - item to be stored
      • getConnectCustomItem

        @Transactional
        ConnectCustomItemInfo getConnectCustomItem​(java.lang.String ownerName,
                                                   java.lang.String type)
        Gets exactly one connect custom item or zero
        Parameters:
        ownerName - owner of the item
        type - type of the item
        Returns:
        item matching the owner + type
      • updateConnectCustomItem

        @Transactional
        void updateConnectCustomItem​(ConnectCustomItemInfo connectCustomItemInfo)
        Updates the connect custom id, effectively updates the data of item with specified id inside
        Parameters:
        connectCustomItemInfo - item to be updated
      • getExportTemplatesForUser

        @Transactional
        java.util.List<ExportTemplateInfo> getExportTemplatesForUser​(java.lang.String dataTreeId,
                                                                     com.im.ijcs.api.util.DFUser user,
                                                                     com.im.commons.sharing.SharingPrivilege privilege)
        Gets export templates for datatree and user.
        Parameters:
        dataTreeId - id of the datatree
        user - owner of the item
        privilege - the intended action
        Returns:
        export templates
        Since:
        21.5.0
      • getApiKeys

        @Transactional
        java.util.List<ApiKeyInfo> getApiKeys()
        Gets all api keys
        Returns:
        api keys
        Since:
        21.15.0
      • createApiKey

        @Transactional
        void createApiKey​(ApiKeyInfo info)
        Creates new api key
        Parameters:
        info - api key data
        Since:
        21.15.0
      • updateApiKey

        @Transactional
        void updateApiKey​(ApiKeyInfo info)
        Updates existing api key - specifically just "expiresOn", "lastUsedOn" and "comment" fields
        Parameters:
        info - api key data
        Since:
        21.15.0
      • deleteApiKey

        @Transactional
        void deleteApiKey​(java.lang.String id)
        Deletes existing api key by id if it exists
        Parameters:
        id - id of api key to be deleted
        Since:
        21.15.0