Interface ConnectorPersistRemote

  • All Superinterfaces:
    PluginControl
    All Known Subinterfaces:
    ConnectorPersistLocal
    All Known Implementing Classes:
    AbstractConnector

    public interface ConnectorPersistRemote
    extends PluginControl
    Interface for connectors that support to modify data in the content system..

    Since:
    4.0.3, 4.0.5 JAXB serialization annotations for EntityDataRecord and EntityDataRecord4Update, 4.1.6 New methods to support insert, update, delete by EntityItem instances. Deprecated old methods using EntityDataRecord or EntityDataRecord4Update and other stuff related to PublishingHubDBConnector.
    • Method Detail

      • persist

        EntityItem persist​(EntityItem entityItem)
                    throws ConnectorException
        Performs an insert of a new record. If Bucket is to be inserted, and object holds the structure, the whole structure will be inserted including: subBuckets, KeyValues, Texts, Prices, MediaAssets, MediaObjects, Context
        Record which is to be inserted must not exists in database, the only one exception is Context. If existing context will be passed as a part of the structure, the existing one will be used.

        Checking the existence of Context

        1. When identifier of Context is passed id will be used for checking
        2. When no identifier is provided it will be created based on language and country, and then used for existence checking

        Parameters:
        entityItem - The structure containing the entity data item in "value" field.
        Returns:
        inserted object or null, if fails.
        Throws:
        ConnectorException
        Since:
        4.1.6
      • persistItems

        java.util.List<EntityItem> persistItems​(java.util.List<EntityItem> entityItems)
                                         throws ConnectorException
        Performs persist(EntityItem) on each item of the given list of records.
        Listed records must not exists in database.

        The operation may or may not be transactional safe depending on the connector implementation. Please see the connector documentation.

        Parameters:
        entityItems - list of EntityItem. Each item will contain the actual entity data in its "value" field.
        Returns:
        list of inserted objects or empty list, if it fails.
        Throws:
        ConnectorException
        Since:
        4.1.6
      • persistListFromSerializedFiles

        @Deprecated
        java.util.List<EntityItem> persistListFromSerializedFiles​(java.util.List<java.lang.String> serFiles)
                                                           throws ConnectorException
        Deprecated.
        since 4.1.6 please use EntityDataService to import files (as XML or JSON).
        Parameters:
        serFiles -
        Returns:
        entityItems
        Throws:
        ConnectorException
        Since:
        4.0.4
      • merge

        boolean merge​(EntityItem entityItem)
               throws ConnectorException
        Method performs an update of given record.
        Record which is to be updated must exist in database.
        Parameters:
        entityItem - structure of information about record to be modified
        Returns:
        true if update succeed
        Throws:
        ConnectorException
        Since:
        4.1.6
      • mergeItems

        boolean mergeItems​(java.util.List<EntityItem> entityItems)
                    throws ConnectorException
        Method performs merge(EntityItem) on the given list of records.
        Listed records must exists in database
        Parameters:
        entityItems - list of items containing either a value or a push map to update fields of the underlying item.
        Returns:
        true if update succeed
        Throws:
        ConnectorException
        Since:
        4.1.6
      • remove

        boolean remove​(EntityItem entityItem)
                throws ConnectorException
        Performs record deletion from data source.

        It is up to the connector how this deletion is implemented. E.g. how related objects are also removed. The only requirements are: (1) A persist of the same item after a remove should be successful (other things being equal). (2) A getByIdentifier after a remove should return an empty list.

        Depending on the connector implementation different handling of exceptional state may occur. E.g. you may get ConnectorException encapsulating an INDEX VIOLATION.

        Parameters:
        entityItem - information about entity to be processed
        Returns:
        true, if remove succeed.
        Throws:
        ConnectorException
        Since:
        4.1.6
      • commitItems

        java.util.List<EntityItem> commitItems​(java.util.List<EntityItem> entityItems)
                                        throws ConnectorException
        Performs the command defined for each EntityItem in List on the EntityItem.

        The details of this operation may differ between connectors.
        (1) the operation as a whole may or may not be transactional safe.
        (2) the single operations may be chunked (by action type or number of items) and executed in "batch" mode.

        Parameters:
        entityItems - List of EntityItem with command to be performed.
        Returns:
        List of items EntityItem with status and message as created by insert, update or delete operation.
        Throws:
        ConnectorException
      • bulkInsert

        java.util.List<EntityItem> bulkInsert​(java.util.List<EntityItem> entityItems)
                                       throws ConnectorException
        Performs the insert command for each EntityItem in List on the EntityItem.

        The details of this operation may differ between connectors.
        (1) the operation as a whole may be transactional safe.

        Parameters:
        entityItems - List of EntityItem with command to be performed.
        Returns:
        List of items EntityItem with status and message as created by insert
        Throws:
        ConnectorException
      • bulkUpsert

        java.util.List<EntityItem> bulkUpsert​(java.util.List<EntityItem> entityItems)
                                       throws ConnectorException
        Performs the upsert command for each EntityItem in List on the EntityItem.

        The details of this operation may differ between connectors.
        (1) the operation as a whole may be transactional safe.

        Parameters:
        entityItems - List of EntityItem with command to be performed.
        Returns:
        List of items EntityItem with status and message as created by insert
        Throws:
        ConnectorException
      • getNextIdentifier

        @Deprecated
        java.lang.String getNextIdentifier​(java.lang.Class<?> clazz)
                                    throws ConnectorException
        Deprecated.
        since 4.1.6 please use method specific to the connector implementation
        Parameters:
        clazz -
        Returns:
        identifier
        Throws:
        ConnectorException
      • executeNativeCall

        @Deprecated
        int executeNativeCall​(java.lang.String call)
                       throws ConnectorException
        Deprecated.
        since 4.1.6 Please avoid this method for security reasons.
        FOR INTERNAL USE ONLY.
        Execute a native sql call like
        "update con_bucket set identifier = 'Y' where identifier = 'X';"
        Parameters:
        call - the native sql-command to run
        Returns:
        the number of affected entities
        Throws:
        ConnectorException
        Since:
        4.0.3, 4.1 added explicit exception handling
      • executeNativeQuery

        @Deprecated
        <T,​J> java.util.List<T> executeNativeQuery​(java.lang.String call,
                                                         java.lang.Class<J> clazz)
                                                  throws ConnectorException
        Deprecated.
        since 4.1.6 Please avoid this method for security reasons.
        FOR INTERNAL USE ONLY.
        Execute a native sql query like
        "select * from con_bucket;"
        Parameters:
        call - the native sql-query to run
        clazz - the corresponding entity class of the returned data
        Returns:
        a List of the found entity data
        Throws:
        ConnectorException
        Since:
        4.0.0, 4.1 added explicit exception handling
      • getObjectList

        @Deprecated
        java.util.List<EntityData> getObjectList​(java.util.Map<java.lang.String,​java.lang.Object> Params,
                                                 java.lang.String NQN,
                                                 java.lang.Class<EntityData> clazz)
                                          throws ConnectorException
        Deprecated.
        since 4.1.6 please use method specific to the connector implementation
        Temporary method to created complicated statements. It will be used only in Import Methods!
        Parameters:
        Params -
        NQN -
        clazz -
        Returns:
        Throws:
        ConnectorException
      • callMethodByName

        @Deprecated
        java.util.List<java.lang.Object> callMethodByName​(java.lang.String methodName,
                                                          java.lang.Class<?>[] argTypes,
                                                          java.lang.Object[] argValues)
                                                   throws ConnectorException
        Deprecated.
        since 4.1.6 please use method specific to the connector implementation
        This method provides a reflection call to methods of JPAUtils. All static methods of JPAUtils can be called using a reflection call approach please note that due to some casting and compilation issue, argTypes[0] will always be PublishingHubDBConnector.class and argValues[0]= this Other argType and argValue can be passed based on the method programmer wants to call from JPAUtils.java
        Parameters:
        methodName - - method name to call using reflection
        argTypes - - argTypes of called method parameters
        argValues - - argValues of called methods
        Returns:
        if called method returns anything then the same will be added to List and that return object can be found by accessing return list.
        Throws:
        ConnectorException
        • getOrigins

          java.util.List<java.lang.String> getOrigins()
                                               throws ConnectorException
          Get a list of origins existing in the data.

          An origin is typically something like a importId.

          Implementation is connector specific. Most connectors will not support this and just return null or empty list.

          Returns:
          list of origins (or null or empty list)
          Throws:
          ConnectorException