com.ibm.commerce.context.content.resources

Class AbstractResourceManagerImpl

  • java.lang.Object
    • com.ibm.commerce.context.content.resources.AbstractResourceManagerImpl
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.Character CONTENT_CANCEL
      This is a constant that represents that the resource has been cancelled.
      static java.lang.Character CONTENT_DELETE
      This is a constant that represents that the resource has been deleted.
      static java.lang.Character CONTENT_NEW
      This is a constant that represents that the resource is new.
      static java.lang.Character CONTENT_PROMOTE
      This is a constant that represents that the resource has been promoted.
      static java.lang.Character CONTENT_UPDATE
      This is a constant that represents that the resource has been updated.
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
      static char RESOURCE_COMMIT
      This is a constant that represents that the resource has been promoted.
      static char RESOURCE_DELETE
      This is a constant that represents that the resource has been deleted.
      static char RESOURCE_NEW
      This is a constant that represents that the resource is new.
      static char RESOURCE_ROLLBACK
      This is a constant that represents that the resource has been canceled.
      static char RESOURCE_UPDATE
      This is a constant that represents that the resource has been updated.
      static java.lang.String STRING_CONTENT_DELETE
      This is a String version of the corresponding constant.
      static java.lang.String STRING_CONTENT_NEW
      This is a String version of the corresponding constant.
      static java.lang.String STRING_CONTENT_UPDATE
      This is a String version of the corresponding constant.
    • Constructor Summary

      Constructors 
      Constructor and Description
      AbstractResourceManagerImpl()
      This is the default constructor for this class.
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • RESOURCE_NEW

        public static final char RESOURCE_NEW
        This is a constant that represents that the resource is new.
        See Also:
        Constant Field Values
      • RESOURCE_UPDATE

        public static final char RESOURCE_UPDATE
        This is a constant that represents that the resource has been updated.
        See Also:
        Constant Field Values
      • RESOURCE_DELETE

        public static final char RESOURCE_DELETE
        This is a constant that represents that the resource has been deleted.
        See Also:
        Constant Field Values
      • RESOURCE_COMMIT

        public static final char RESOURCE_COMMIT
        This is a constant that represents that the resource has been promoted.
        See Also:
        Constant Field Values
      • RESOURCE_ROLLBACK

        public static final char RESOURCE_ROLLBACK
        This is a constant that represents that the resource has been canceled.
        See Also:
        Constant Field Values
      • CONTENT_NEW

        public static final java.lang.Character CONTENT_NEW
        This is a constant that represents that the resource is new.
      • CONTENT_UPDATE

        public static final java.lang.Character CONTENT_UPDATE
        This is a constant that represents that the resource has been updated.
      • CONTENT_DELETE

        public static final java.lang.Character CONTENT_DELETE
        This is a constant that represents that the resource has been deleted.
      • CONTENT_PROMOTE

        public static final java.lang.Character CONTENT_PROMOTE
        This is a constant that represents that the resource has been promoted.
      • CONTENT_CANCEL

        public static final java.lang.Character CONTENT_CANCEL
        This is a constant that represents that the resource has been cancelled.
      • STRING_CONTENT_NEW

        public static final java.lang.String STRING_CONTENT_NEW
        This is a String version of the corresponding constant.
      • STRING_CONTENT_UPDATE

        public static final java.lang.String STRING_CONTENT_UPDATE
        This is a String version of the corresponding constant.
      • STRING_CONTENT_DELETE

        public static final java.lang.String STRING_CONTENT_DELETE
        This is a String version of the corresponding constant.
    • Constructor Detail

      • AbstractResourceManagerImpl

        public AbstractResourceManagerImpl()
        This is the default constructor for this class. It calls the constructor from the superclass.
    • Method Detail

      • setMetaData

        public void setMetaData(ManagedResourceMetaData managedResourceMetaData)
        This method sets the resource manager metadata that contains the configuration information for the resource manager.
        Specified by:
        setMetaData in interface ResourceManager
        Parameters:
        managedResourceMetaData - The resource manager metadata.
      • getResourceContainer

        public ResourceContainer getResourceContainer()
        This method returns the resource container associated to the resource manager.
        Specified by:
        getResourceContainer in interface ResourceManager
        Returns:
        The associated resource container.
      • deleteRelatedManagedResources

        public void deleteRelatedManagedResources(ActivityToken activityToken,
                                                  java.lang.Object relatedResource)
                                           throws ResourceException
        This method deletes all the resources that has a relation to the resource for the given content context.
        Parameters:
        activityToken - The current activity.
        relatedResource - The related resource.
        Throws:
        ResourceException - This is thrown if a problem occurs when deleting the child resources.
      • lockManagedResource

        public void lockManagedResource(ActivityToken activityToken,
                                        ManagedResourceKey managedResourceKey)
                                 throws ResourceException
        This method locks the specified business object based on the current activity information.
        Specified by:
        lockManagedResource in interface ResourceManager
        Parameters:
        activityToken - The current activity.
        managedResourceKey - The business object to lock.
        Throws:
        ResourceException - This is thrown if the resource is already locked by another activity.
      • isLocked

        public boolean isLocked(ActivityToken activityToken,
                                ManagedResourceKey managedResourceKey)
                         throws ResourceException
        This method returns whether the specified business object is locked and cannot be modified by the current activity.
        Specified by:
        isLocked in interface ResourceManager
        Parameters:
        activityToken - The current activity.
        managedResourceKey - The business object.
        Returns:
        Whether the business object is locked.
        Throws:
        ResourceException - This is thrown if there is a problem performing the is lock query.
      • getLockData

        public LockData getLockData(ManagedResourceKey managedResourceKey)
                             throws ResourceException
        This method returns the lock information for the specified business object. If the business object is not locked, then null will be returned.
        Specified by:
        getLockData in interface ResourceManager
        Parameters:
        managedResourceKey - The business object.
        Returns:
        The lock data for the business object.
        Throws:
        ResourceException - This is thrown if there is a problem retrieving the lock data.
      • isLocked

        public boolean[] isLocked(ActivityToken activityToken,
                                  ManagedResourceKey[] managedResourceKey)
                           throws ResourceException
        This method returns whether the specified business objects are locked and cannot be modified by the current activity.
        Specified by:
        isLocked in interface ResourceManager
        Parameters:
        activityToken - The current activity.
        managedResourceKey - The business objects to check.
        Returns:
        An array that represents whether the corresponding business object index is locked or not.
        Throws:
        ResourceException - This is thrown if there is a problem performing the lock check for all managed resources.
      • getLockData

        public LockData[] getLockData(ManagedResourceKey[] managedResourceKey)
                               throws ResourceException
        This method returns the lock information for the specified business objects. If the business objects are not locked, then null will be returned.
        Specified by:
        getLockData in interface ResourceManager
        Parameters:
        managedResourceKey - The business objects.
        Returns:
        An array representing the corresponding business object lock information.
        Throws:
        ResourceException - This is thrown if there is a problem getting the lock data for the managed resources.
      • createManagedResource

        public java.lang.Object createManagedResource(ActivityToken activityToken,
                                                      java.lang.Object creationData)
                                               throws ResourceException
        This method creates a new instance of the resource. It uses the context information of the activity token to ensure the resource is created based on the current context values.
        Specified by:
        createManagedResource in interface ResourceManager
        Parameters:
        activityToken - The current activity.
        creationData - The data needed to create the object.
        Returns:
        The created object.
        Throws:
        ResourceException - This is thrown when a problem occurs creating the resource.
      • updateManagedResource

        public void updateManagedResource(ActivityToken activityToken,
                                          java.lang.Object resource)
                                   throws ResourceException
        This method updates the current instance of the resource with the current changes. These updates can be sensitive to the context information associated with the current activity.
        Specified by:
        updateManagedResource in interface ResourceManager
        Parameters:
        activityToken - The current activity.
        resource - The resource to update.
        Throws:
        ResourceException - This is thrown when a problem occurs updating the resource.
      • deleteManagedResource

        public void deleteManagedResource(ActivityToken activityToken,
                                          java.lang.Object resource)
                                   throws ResourceException
        This method deletes the current instance of the resource with the new current changes. These updates can be sensitive to the context information associated with the current activity.
        Specified by:
        deleteManagedResource in interface ResourceManager
        Parameters:
        activityToken - The current activity.
        resource - The resource to delete.
        Throws:
        ResourceException - This is thrown when a problem occurs deleting the resource.
      • synchronize

        public void synchronize(ContentData contentData)
                         throws ResourceException
        This method synchronizes the specified workspace. The workspace may either need to be synchronized based on some changes caused by the base or by some operation performed by the workspace. This will be called when it is known that changes have been made which may have caused the workspace to be out of synchronization.
        Specified by:
        synchronize in interface ResourceManager
        Parameters:
        contentData - The content data to synchronize. This data will not include the task and task group because the entire workspace needs to be synchronized.
        Throws:
        ResourceException - This is thrown when there is a problem performing the commit operation. This usually occurs when the commit causes data integrity problems.
      • postPublish

        public java.lang.String postPublish(ContentData contentData)
                                     throws ResourceException
        This method processes a post-publish event.
        Specified by:
        postPublish in interface ResourceManager
        Parameters:
        contentData - The content data.
        Returns:
        The post-publish data to be propagated to production server.
        Throws:
        ResourceException - This is thrown when a problem occurs in the post-publish event processing.
      • processPostPublishData

        public void processPostPublishData(java.lang.String postPublishData)
                                    throws ECException
        This method processes post-publish data on production server.
        Specified by:
        processPostPublishData in interface PostPublishDataProcessor
        Parameters:
        postPublishData - The post-publish data to be processed.
        Throws:
        ECException - This is thrown when a problem occurs when processing the data.
      • getManagedResourceData

        public java.util.List<LockData> getManagedResourceData(java.lang.String taskGroupId,
                                                               char filter)
                                                        throws ResourceException
        This method returns the list of all locks for objects of this resource manager associated to the provided workspace task group id.
        Specified by:
        getManagedResourceData in interface ResourceManager
        Parameters:
        taskGroupId - the task group identifier to retrieve the list of locks for.
        filter - the filter on data to retrieve.
        Returns:
        The list of lock data records for the business object.
        Throws:
        ResourceException - This is thrown if a problem occurs when retrieving the lock data.
      • getManagedResourceDataCount

        public int getManagedResourceDataCount(java.lang.String taskGroupId)
                                        throws ResourceException
        This method returns the count of all objects currently modified in the specified context of the taskgroup.
        Specified by:
        getManagedResourceDataCount in interface ResourceManager
        Parameters:
        taskGroupId - the task group identifier to retrieve the list of locks for.
        Returns:
        The count of resources in the workspace.
        Throws:
        ResourceException - This is thrown if a problem occurs when retrieving the lock data.
      • handleUniqueIndexViolations

        public java.util.Map handleUniqueIndexViolations(ContentData contentData)
                                                  throws ResourceException
        This method when enabled for a resource manager will compare UI conflicts for resources in the workspace and will modify them based on action from configuration.
        Parameters:
        contentData - The content data of workspace/task group/task to check for UI violations.
        Returns:
        map containing key / value pairs indicating the unique index violations for specified table in the workspace/task group. The 'key' is the base table primary key and the value is the corresponding 'workspace' primary key for a conflicting UI.
        Throws:
        ResourceException - This is thrown when there is a problem performing the commit operation.
        See Also:
        com.ibm.commerce.context.content.resources.ResourceManager#
      • handleUniqueIndexViolations

        public java.util.Map handleUniqueIndexViolations(ContentData contentData,
                                                         int action)
                                                  throws ResourceException
        This method when enabled for a resource manager will compare UI conflicts for resources in the workspace and will modify them based on action provided as parameter.
        Parameters:
        contentData - The content data of workspace/task group/task to check for UI violations.
        action - Parameter to specify the action to be performed when a unique index violation is detected on an asset.
        Returns:
        map containing key / value pairs indicating the unique index violations for specified table in the workspace/task group. The 'key' is the base table primary key and the value is the corresponding 'workspace' primary key for a conflicting UI.
        Throws:
        ResourceException - This is thrown when there is a problem performing the commit operation.
        See Also:
        com.ibm.commerce.context.content.resources.ResourceManager#
      • fetchUniqueIndexViolations

        public java.util.Map fetchUniqueIndexViolations(ContentData contentData,
                                                        int action)
                                                 throws ResourceException
        This method when enabled for a resource manager will compare UI conflicts for resources in the workspace and return in a map.
        Parameters:
        contentData - The content data of workspace/task group/task to check for UI violations.
        action - Parameter to specify the action to be performed when a unique index violation is detected on an asset.
        Returns:
        map containing key / value pairs indicating the unique index violations for specified table in the workspace/task group. The 'key' is the base table primary key and the value is the corresponding 'workspace' primary key for a conflicting UI.
        Throws:
        ResourceException - This is thrown when there is a problem performing the commit operation.
        See Also:
        com.ibm.commerce.context.content.resources.ResourceManager#
      • handleForeignKeyViolations

        public java.util.List handleForeignKeyViolations(ContentData contentData,
                                                         int action)
                                                  throws ResourceException
        This method when enabled for a resource manager will compare UI conflicts for resources in the workspace and will modify them based on action provided as parameter.
        Parameters:
        contentData - The content data of workspace/task group/task to check for UI violations.
        action - Parameter to specify the action to be performed when a unique index violation is detected on an asset.
        Returns:
        map containing key / value pairs indicating the unique index violations for specified table in the workspace/task group. The 'key' is the base table primary key and the value is the corresponding 'workspace' primary key for a conflicting UI.
        Throws:
        ResourceException - This is thrown when there is a problem performing the commit operation.
        See Also:
        com.ibm.commerce.context.content.resources.ResourceManager#