com.ibm.commerce.context.content.locking

Class ChangeControlBusinessObjectMediatorImpl

  • All Implemented Interfaces:
    BusinessObjectMediator, ChangeControlBusinessObjectMediator


    public class ChangeControlBusinessObjectMediatorImpl
    extends AbstractBusinessObjectMediatorImpl
    implements ChangeControlBusinessObjectMediator

    This change control mediator uses the CMMETADATA table to store change control information pertaining to business objects. It also uses the Locking Policy configuration to maintain and check whether business objects are locked or not.

    The purpose of the change control mediator is to capture and maintain change control information for a noun and identified changeable parts of the noun. However, the support for change control in the NVP programming model with EJBs captures this information at a database layer. By configuring the resource container and manager ids, it is possible for this change control mediator to respect the previous locking information while creating the new change control information at the appropriate business object level.

    This change mediator has a dependency on the ChangeControlBusinessObjectPartMediatorImpl class for handling individual noun parts that can have change control applied. Although this implementation manages the change control information for the container business object, it will use this part implementation to help create the metadata used to represent the individual change control for the noun part.

    • Constructor Summary

      Constructors 
      Constructor and Description
      ChangeControlBusinessObjectMediatorImpl()
      Creates an instance of a change control mediator that uses CMMETADATA to store the change control information.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean canModify(java.lang.Object noun, java.lang.Object nounPart)
      This method return whether the part of the business object specified can be modified or not.
      java.util.List getChangeControlNounParts()
      This method will return a list of XPath expressions, of type java.lang.String, that represents the breakdown of defined change control parts of the noun.
      java.lang.String[] getLockMetadata(java.lang.Object noun, java.lang.Object nounPart)
      This method returns a String[] holding the workspace, task group, task and user responsible for the locking if this part of the business object cannot be modified, or null otherwise.
      java.util.Map getMetadata(java.lang.Object noun, java.lang.Object nounPart)
      This method will return the change control metadata that is associated with the business objects specified.
      void initialize(java.util.List aListNoun)
      Initialize the change mediator with the nouns submitted for the change request
      void initializeConfig(BusinessObjectMediatorConfig aConfig, java.util.Map properties)
      This method initializes the change control mediator by extract the configuration properties that controls how the mediator will behave.
      void lock(java.lang.Object noun, java.lang.Object nounPart, short action)
      This method will obtain a lock for the given part of the business object.
      void unlock(java.lang.Object noun, java.lang.Object nounPart)
      This method will release the lock for the given part of the business object.
      • Methods inherited from class java.lang.Object

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

      • MEDIATOR_CONFIG_PARAMETER_RESOURCECONTAINERID

        public static final java.lang.String MEDIATOR_CONFIG_PARAMETER_RESOURCECONTAINERID
        The change control mediator property that specifies the container ID used when querying CMMETADATA table.
        See Also:
        Constant Field Values
      • MEDIATOR_CONFIG_PARAMETER_LOCKDISABLED

        public static final java.lang.String MEDIATOR_CONFIG_PARAMETER_LOCKDISABLED
        The change control part mediator property value that indicates the mediator should not lock any records in CMMETADATA table
        See Also:
        Constant Field Values
      • MEDIATOR_CONFIG_PARAMETER_RESOURCEMANAGERIDS

        public static final java.lang.String MEDIATOR_CONFIG_PARAMETER_RESOURCEMANAGERIDS
        The change control mediator property that specifies the resource manager IDs used when querying the CMMETADATA table. This includes all the possible resource managers used to store change control information in the CMMETADATA table. The first resource manager ID in this comma separated list is the resource manager ID used to store the change control information.
        See Also:
        Constant Field Values
      • MEDIATOR_CONFIG_PARAMETER_RESOURCEMANAGERID

        public static final java.lang.String MEDIATOR_CONFIG_PARAMETER_RESOURCEMANAGERID
        The change control mediator property that specifies the resource manager ID used when querying CMMETADATA table.
        See Also:
        Constant Field Values
      • MEDIATOR_CONFIG_PARAMETER_UNIQUEIDPROPERTY

        public static final java.lang.String MEDIATOR_CONFIG_PARAMETER_UNIQUEIDPROPERTY
        The change control mediator property that specifies the element of the business object that is used to resolve the CMMETADATA for the business object. This value is stored in the appropriate BOKEY column depending on whether the object is the noun or individually controlled part.
        See Also:
        Constant Field Values
      • MEDIATOR_CONFIG_PARAMETER_CHANGE_CONTROL_PART

        public static final java.lang.String MEDIATOR_CONFIG_PARAMETER_CHANGE_CONTROL_PART
        The change control part mediator property that specifies the element of the isolated noun part that can be locked.
        See Also:
        Constant Field Values
      • MEDIATOR_CONFIG_PARAMETER_BOKEY1_UNIQUEIDPROPERTY

        public static final java.lang.String MEDIATOR_CONFIG_PARAMETER_BOKEY1_UNIQUEIDPROPERTY
        The change control mediator property that specifies the element of the object that represents the long value that is stored in the BOKEY1 column the the CMMETADATA table.
        See Also:
        Constant Field Values
      • MEDIATOR_CONFIG_PARAMETER_BOKEY2_UNIQUEIDPROPERTY

        public static final java.lang.String MEDIATOR_CONFIG_PARAMETER_BOKEY2_UNIQUEIDPROPERTY
        The change control mediator property that specifies the element of the object that represents the long value that is stored in the BOKEY2 column the the CMMETADATA table.
        See Also:
        Constant Field Values
      • MEDIATOR_CONFIG_PARAMETER_BOKEY3_UNIQUEIDPROPERTY

        public static final java.lang.String MEDIATOR_CONFIG_PARAMETER_BOKEY3_UNIQUEIDPROPERTY
        The change control mediator property that specifies the element of the object that represents the long value that is stored in the BOKEY3 column the the CMMETADATA table.
        See Also:
        Constant Field Values
      • MEDIATOR_CONFIG_PARAMETER_BOKEY4_UNIQUEIDPROPERTY

        public static final java.lang.String MEDIATOR_CONFIG_PARAMETER_BOKEY4_UNIQUEIDPROPERTY
        The change control mediator property that specifies the element of the object that represents the long value that is stored in the BOKEY4 column the the CMMETADATA table.
        See Also:
        Constant Field Values
      • CHANGE_CONTROL_METADATA_PROPERTY_NAME_PERSON_LOGONID

        public static final java.lang.String CHANGE_CONTROL_METADATA_PROPERTY_NAME_PERSON_LOGONID
        The change control metadata property of the logon ID of the user who is associated with the change control information. This property name is logonID.
        See Also:
        Constant Field Values
      • CHANGE_CONTROL_METADATA_PROPERTY_NAME_PERSON_UNIQUEID

        public static final java.lang.String CHANGE_CONTROL_METADATA_PROPERTY_NAME_PERSON_UNIQUEID
        The change control metadata property of the person UniqueID of the user who is associated with the change control information. This property name is personUniqueID.
        See Also:
        Constant Field Values
      • CHANGE_CONTROL_METADATA_PROPERTY_NAME_WORKSPACE_IDENTIIFER

        public static final java.lang.String CHANGE_CONTROL_METADATA_PROPERTY_NAME_WORKSPACE_IDENTIIFER
        The change control metadata property of the workspace identifier of the workspace associated with the change control information. This property name is the context parameter ContentContext.ACTIVITY_DATA_PARAM_WORKSPACENAME.
        See Also:
        Constant Field Values
      • CHANGE_CONTROL_METADATA_PROPERTY_NAME_WORKSPACE_NAME

        public static final java.lang.String CHANGE_CONTROL_METADATA_PROPERTY_NAME_WORKSPACE_NAME
        The change control metadata property of the workspace localized name of the workspace associated with the change control information. This property name is workspaceName.
        See Also:
        Constant Field Values
      • CHANGE_CONTROL_METADATA_PROPERTY_NAME_TASKGROUP_IDENTIIFER

        public static final java.lang.String CHANGE_CONTROL_METADATA_PROPERTY_NAME_TASKGROUP_IDENTIIFER
        The change control metadata property of the task group identifier of the task associated with the change control information. This property name is the context parameter TaskContext.ACTIVITY_DATA_PARAM_TASKGROUP.
        See Also:
        Constant Field Values
      • CHANGE_CONTROL_METADATA_PROPERTY_NAME_TASKGROUP_NAME

        public static final java.lang.String CHANGE_CONTROL_METADATA_PROPERTY_NAME_TASKGROUP_NAME
        The change control metadata property of the task group localized name of the task associated with the change control information. This property name is taskGroupName.
        See Also:
        Constant Field Values
      • CHANGE_CONTROL_METADATA_PROPERTY_NAME_TASK_IDENTIFIER

        public static final java.lang.String CHANGE_CONTROL_METADATA_PROPERTY_NAME_TASK_IDENTIFIER
        The change control metadata property of the task identifier of the task associated with the change control information. This property name is the context parameter TaskContext.ACTIVITY_DATA_PARAM_TASK.
        See Also:
        Constant Field Values
      • CHANGE_CONTROL_METADATA_PROPERTY_NAME_TASK_NAME

        public static final java.lang.String CHANGE_CONTROL_METADATA_PROPERTY_NAME_TASK_NAME
        The change control metadata property of the task localized name of the task associated with the change control information. This property name is taskName.
        See Also:
        Constant Field Values
      • CHANGE_CONTROL_METADATA_PROPERTY_NAME_ACTION

        public static final java.lang.String CHANGE_CONTROL_METADATA_PROPERTY_NAME_ACTION
        The change control metadata property of the action associated with the change control information. This property name is action.
        See Also:
        Constant Field Values
      • CHANGE_CONTROL_METADATA_PROPERTY_NAME_TIMESTAMP

        public static final java.lang.String CHANGE_CONTROL_METADATA_PROPERTY_NAME_TIMESTAMP
        The change control metadata property of the timestamp associated with the change control information. This property name is lastModified.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ChangeControlBusinessObjectMediatorImpl

        public ChangeControlBusinessObjectMediatorImpl()
        Creates an instance of a change control mediator that uses CMMETADATA to store the change control information.
    • Method Detail

      • initialize

        public void initialize(java.util.List aListNoun)
                        throws java.lang.Exception
        Initialize the change mediator with the nouns submitted for the change request
        Specified by:
        initialize in interface ChangeControlBusinessObjectMediator
        Parameters:
        aListNoun - The list of nouns containing the noun parts that have changes.
        Throws:
        java.lang.Exception - Error while initializing
      • canModify

        public boolean canModify(java.lang.Object noun,
                                 java.lang.Object nounPart)
        This method return whether the part of the business object specified can be modified or not. If part of the business object is locked, then the logic should prevent modificatons to the business object.
        Specified by:
        canModify in interface ChangeControlBusinessObjectMediator
        Parameters:
        noun - The business object.
        nounPart - The part of the business object to determine its lock status.
        Returns:
        Whether the part of the business object is locked or not.
      • getLockMetadata

        public java.lang.String[] getLockMetadata(java.lang.Object noun,
                                                  java.lang.Object nounPart)
        This method returns a String[] holding the workspace, task group, task and user responsible for the locking if this part of the business object cannot be modified, or null otherwise. If part of the business object is locked, then the logic should prevent modifications to the business object.
        Parameters:
        noun - The business object.
        nounPart - The part of the business object to determine its lock status.
        Returns:
        String[] holding workspace, task group, task and user if business object cannot be modified. Null otherwise.
      • lock

        public void lock(java.lang.Object noun,
                         java.lang.Object nounPart,
                         short action)
                  throws AbstractApplicationException
        This method will obtain a lock for the given part of the business object.
        Specified by:
        lock in interface ChangeControlBusinessObjectMediator
        Parameters:
        noun - The business object.
        nounPart - The part of the business object to obtain a lock for.
        action - The action that cause the lock to occur.
        Throws:
        AbstractApplicationException - There was a problem obtaining the lock. Typically this would happen because the lock already exists for the business object.
      • unlock

        public void unlock(java.lang.Object noun,
                           java.lang.Object nounPart)
                    throws AbstractApplicationException
        This method will release the lock for the given part of the business object.
        Specified by:
        unlock in interface ChangeControlBusinessObjectMediator
        Parameters:
        noun - The business object.
        nounPart - The part of the business object to unlock.
        Throws:
        AbstractApplicationException - There was a problem when attempting to unlock the business object. This may be because the current the request does not currently have the lock so it is not allowed to unlock it.
      • getChangeControlNounParts

        public java.util.List getChangeControlNounParts()
        This method will return a list of XPath expressions, of type java.lang.String, that represents the breakdown of defined change control parts of the noun. At a minimum, the noun itself will always have change control applied to it. However there are cases where the business object can be broken down into further noun parts, and this method will return this additional breakdown of the business object.
        Specified by:
        getChangeControlNounParts in interface ChangeControlBusinessObjectMediator
        Returns:
        A list of XPath expressions that represent the individual parts of the noun to which change control can be applied.