com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator

Interface ChangeControlBusinessObjectMediator

  • All Superinterfaces:
    BusinessObjectMediator
    All Known Implementing Classes:
    ChangeControlBusinessObjectMediatorImpl


    public interface ChangeControlBusinessObjectMediator
    extends BusinessObjectMediator

    The Change Control Business Object Mediator is responsible for resolving the current state of business objects and whether they can be modified or not. The change control mediator returns change metadata associated with a specified business object as well as providing the ability to lock and unlock business objects. The purpose of the change control mediator is to consult the control system to validate whether the change on the business object should be permitted.

    The client of the change control mediator is the logic that is modifying the business objects. The clients should validate whether the object can be modified as well as obtain the lock when modifying the objects.

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static short ACTION_CREATE
      The constant that represents the create action when locking a business object.
      static short ACTION_DELETE
      The constant that represents the delete action when locking a business object.
      static short ACTION_UPDATE
      The constant that represents the update action when locking a business object.
      static java.lang.String COPYRIGHT
      IBM Copyright notice field.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      boolean canModify(java.lang.Object noun, java.lang.Object nounPart)
      This method returns whether the part of the business object specified can be modified or not.
      java.util.List getChangeControlNounParts()
      This method returns a list of XPath expressions relative to the noun that represents the breakdown of individual changeable parts of the noun.
      java.util.Map getMetadata(java.lang.Object noun, java.lang.Object nounPart)
      This method returns the change control metadata that is associated with the business objects specified.
      void initialize(java.util.List aListNoun)
      Initializes the change control mediator to load any up front information pertaining to the objects used in the current request.
      void lock(java.lang.Object noun, java.lang.Object nounPart, short action)
      This method obtains a lock for the given part of the business object.
      void unlock(java.lang.Object noun, java.lang.Object nounPart)
      This method releases the lock for the given part of the business object.
    • Field Detail

      • COPYRIGHT

        static final java.lang.String COPYRIGHT
        IBM Copyright notice field.
        See Also:
        Constant Field Values
      • ACTION_CREATE

        static final short ACTION_CREATE
        The constant that represents the create action when locking a business object.
        See Also:
        Constant Field Values
      • ACTION_UPDATE

        static final short ACTION_UPDATE
        The constant that represents the update action when locking a business object.
        See Also:
        Constant Field Values
      • ACTION_DELETE

        static final short ACTION_DELETE
        The constant that represents the delete action when locking a business object.
        See Also:
        Constant Field Values
    • Method Detail

      • initialize

        void initialize(java.util.List aListNoun)
                 throws java.lang.Exception
        Initializes the change control mediator to load any up front information pertaining to the objects used in the current request. This method is passed a list of nouns that can be used to determine more information about current request. The change control mediator could do nothing in this case or try to resolve some of the information about the given nouns knowing that it can be used later on.
        Parameters:
        aListNoun - The list of nouns that is involved with the current request. The objects in the list is the actual noun objects used in the current request. There are cases where the list is empty or the nouns passed specified are going to be created as a result of the operation. There may not be existing change control information about the object. Initialization should not assume certain values of the business object are populated or information about the object already exists.
        Throws:
        java.lang.Exception - Error while initializing which causes the request to stop executing. This exception will typically pertain to the configuration and resolving the up front change control information of the given nouns.
      • getMetadata

        java.util.Map getMetadata(java.lang.Object noun,
                                  java.lang.Object nounPart)

        This method returns the change control metadata that is associated with the business objects specified. If the specified noun part is classified as an individual changable, then the metadata is pertaining to that changable part. Otherwise the change control metadata associated with the noun should be returned.

        If no metadata exists for the changeable part or the business object, then null or an empty map can be returned.
        Parameters:
        noun - The containing business object.
        nounPart - The part of the business object to retrieve the change control metadata for.
        Returns:
        The change control metadata if it exists.
      • canModify

        boolean canModify(java.lang.Object noun,
                          java.lang.Object nounPart)
        This method returns whether the part of the business object specified can be modified or not. If the part of the business object cannot be modified, then the logic should prevent from allow modificatons to the business object.
        Parameters:
        noun - The containing business object.
        nounPart - The part of the business object to determine its modification status.
        Returns:
        Whether the part of the business object can be modified or not.
      • lock

        void lock(java.lang.Object noun,
                  java.lang.Object nounPart,
                  short action)
           throws AbstractApplicationException
        This method obtains a lock for the given part of the business object.
        Parameters:
        noun - The containing business object.
        nounPart - The part of the business object to obtain a lock for.
        action - The action that caused the lock to occur. The value for the action should either one of the ACTION constants defined in this interface. The value should be either ACTION_CREATE, ACTION_UPDATE or ACTION_DELETE.
        Throws:
        AbstractApplicationException - There was a problem obtaining the lock. Typically this would because the lock already exists for the business object.
      • unlock

        void unlock(java.lang.Object noun,
                    java.lang.Object nounPart)
             throws AbstractApplicationException
        This method releases the lock for the given part of the business object.
        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

        java.util.List getChangeControlNounParts()
        This method returns a list of XPath expressions relative to the noun that represents the breakdown of individual changeable parts of the noun. At a minimum ,the noun itself always has change control applied to it. However there are cases where the business object can be broken down into further changeable parts, and this method returns this additional breakdown of the business object.
        Returns:
        A list of XPath expressions that represent the individual changeable parts of the noun in which change control can be applied. This list should not include the noun because that is implied. If the noun is not broken down into changeable parts, then either null or an empty list can be returned.