com.ibm.commerce.order.utils

Class OrderLockingHelper

  • java.lang.Object
    • com.ibm.commerce.order.utils.OrderLockingHelper


  • public class OrderLockingHelper
    extends java.lang.Object
    A helper class which implements a few methods to do the order resource locking and unlocking.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void checkAndCSRLock(java.lang.Long orderId)
      Check and lock the resource.
      void checkAndCSRLock(java.lang.Long[] orderIds)
      Check and lock the resource.
      void checkAndUnlock(java.lang.Long orderId)
      Check and unlock the resource.
      void checkAndUnlock(java.lang.Long[] orderIds)
      Check and unlock the resource.
      void checkAndUnlock(java.lang.Long[] orderIds, boolean donotCheckCSR)
      Check and unlock the resource.
      void checkAndUnlock(java.lang.Long orderId, boolean donotCheckCSR)
      Check and unlock the resource.
      void checkLock(java.lang.Long orderId)
      Check if the order is locked by the current CSR.
      void checkLock(java.lang.Long[] orderIds)
      Check if the order is locked by the current CSR.
      java.lang.String getLockedByLogonId(java.lang.Long orderId)
      Get the CSR logon id who locks the order.
      int getLockingSystem()
      Get the locking System
      boolean isLocked(java.lang.Long orderId)
      Check to see if the order is locked by the other user.
      boolean isLocked(java.lang.Long orderId, boolean checkOtherUser)
      Check to see if the order is locked.
      void lock(java.lang.Long orderId)
      Lock the order resource.
      void lock(java.lang.Long[] orderIds)
      Lock the order resource.
      boolean lock(java.lang.Long[] orderIds, boolean takeOverLock)
      Lock the resource if it is not locked.
      boolean lock(java.lang.Long orderId, boolean takeOverLock)
      Lock the resource if it is not locked.
      void setLockingSystem(int lockingSystem)
      Set the locking system
      void unlock(java.lang.Long orderId)
      Unlock the order resource.
      void unlock(java.lang.Long[] orderIds)
      Unlock the order resource.
      • Methods inherited from class java.lang.Object

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

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        Copyright statement.
        See Also:
        Constant Field Values
      • LOCKING_DISABLED

        public static final int LOCKING_DISABLED
        Locking is disabled
        See Also:
        Constant Field Values
      • LOCKING_EDITOR_ID

        public static final int LOCKING_EDITOR_ID
        Use the editor_id as the lock
        See Also:
        Constant Field Values
    • Constructor Detail

      • OrderLockingHelper

        public OrderLockingHelper()
        Default constructor
      • OrderLockingHelper

        public OrderLockingHelper(ActivityToken token)
        Constructor with ActivityToken
        Parameters:
        token - activity token
    • Method Detail

      • getLockingSystem

        public int getLockingSystem()
        Get the locking System
        Returns:
        the locking system
      • setLockingSystem

        public void setLockingSystem(int lockingSystem)
        Set the locking system
        Parameters:
        lockingSystem -
      • checkAndCSRLock

        public void checkAndCSRLock(java.lang.Long orderId)
                             throws ECException
        Check and lock the resource. If it is not locked and it is run by a CSR, it will lock the resource. If it is not locked and it is run by a shopper, it does nothing. If it is locked by the same CSR, it does nothing. If it is locked by other people, an ECException with MesssageKey _ERR_ORDER_IS_LOCKED will be thrown.
        Parameters:
        orderId - order id
        Throws:
        ECException
      • checkAndUnlock

        public void checkAndUnlock(java.lang.Long orderId)
                            throws ECException
        Check and unlock the resource. If it is not locked and called by a CSR, an ECException with MesssageKey _ERR_ORDER_IS_NOT_LOCKED will be thrown. If is locked by the same CSR, it unlocks the resource. If it is locked by other people, an ECException with MesssageKey _ERR_ORDER_IS_LOCKED will be thrown.
        Parameters:
        orderId - order id
        Throws:
        ECException
      • checkAndUnlock

        public void checkAndUnlock(java.lang.Long orderId,
                                   boolean donotCheckCSR)
                            throws ECException
        Check and unlock the resource. If it is not locked, if donotCheckCSR is true or is CSR, an ECException with MesssageKey _ERR_ORDER_IS_NOT_LOCKED will be thrown. If is locked by the same CSR, it unlocks the resource. If it is locked by other people, an ECException with MesssageKey _ERR_ORDER_IS_LOCKED will be thrown.
        Parameters:
        orderId - order id
        donotCheckCSR - a boolean value
        Throws:
        ECException
      • checkLock

        public void checkLock(java.lang.Long orderId)
                       throws ECException
        Check if the order is locked by the current CSR. If it is not locked and called by a CSR, an ECException with MesssageKey _ERR_ORDER_IS_NOT_LOCKED will be thrown. If it is locked by the other CSR, an ECException with MesssageKey _ERR_ORDER_IS_LOCKED will be thrown.
        Parameters:
        orderId - order id
        Throws:
        ECException
      • checkAndCSRLock

        public void checkAndCSRLock(java.lang.Long[] orderIds)
                             throws ECException
        Check and lock the resource. If it is not locked and it is run by a CSR, it will lock the resource. If it is not locked and it is run by a shopper, it does nothing. If it is locked by the same CSR, it does nothing. If it is locked by other people, an ECException with MesssageKey _ERR_ORDER_IS_LOCKED will be thrown.
        Parameters:
        orderIds - an array of order ids
        Throws:
        ECException
      • checkAndUnlock

        public void checkAndUnlock(java.lang.Long[] orderIds)
                            throws ECException
        Check and unlock the resource. If it is not locked and called by a CSR, an ECException with MesssageKey _ERR_ORDER_IS_NOT_LOCKED will be thrown. If is locked by the same CSR, it unlocks the resource. If it is locked by other people, an ECException with MesssageKey _ERR_ORDER_IS_LOCKED will be thrown.
        Parameters:
        orderIds - an array of order ids
        Throws:
        ECException
      • checkAndUnlock

        public void checkAndUnlock(java.lang.Long[] orderIds,
                                   boolean donotCheckCSR)
                            throws ECException
        Check and unlock the resource. If it is not locked, if donotCheckCSR is true or is CSR, an ECException with MesssageKey _ERR_ORDER_IS_NOT_LOCKED will be thrown. If is locked by the same CSR, it unlocks the resource. If it is locked by other people, an ECException with MesssageKey _ERR_ORDER_IS_LOCKED will be thrown.
        Parameters:
        orderIds - an array of order ids
        donotCheckCSR - a boolean value
        Throws:
        ECException
      • checkLock

        public void checkLock(java.lang.Long[] orderIds)
                       throws ECException
        Check if the order is locked by the current CSR. If it is not locked and called by a CSR, an ECException with MesssageKey _ERR_ORDER_IS_NOT_LOCKED will be thrown. If it is locked by the other CSR, an ECException with MesssageKey _ERR_ORDER_IS_LOCKED will be thrown.
        Parameters:
        orderIds - an array of order ids
        Throws:
        ECException
      • lock

        public boolean lock(java.lang.Long orderId,
                            boolean takeOverLock)
                     throws ECException
        Lock the resource if it is not locked. If it is locked by other people, if the parameter takeOverLock is true, it will unlock and relock the resource, otherwise, an ECException with MesssageKey _ERR_ORDER_IS_LOCKED will be thrown.
        Parameters:
        orderId - order id
        takeOverLock - a boolean value
        Returns:
        true if the locked is taken over, false otherwise
        Throws:
        ECException
      • lock

        public boolean lock(java.lang.Long[] orderIds,
                            boolean takeOverLock)
                     throws ECException
        Lock the resource if it is not locked. If it is locked by other people, if the parameter takeOverLock is true, it will unlock and relock the resource, otherwise, an ECException with MesssageKey _ERR_ORDER_IS_LOCKED will be thrown.
        Parameters:
        orderIds - an array of order ids
        takeOverLock - a boolean value
        Returns:
        true if the locked is taken over, false otherwise
        Throws:
        ECException
      • getLockedByLogonId

        public java.lang.String getLockedByLogonId(java.lang.Long orderId)
                                            throws ECException
        Get the CSR logon id who locks the order. It will return null if the order is locked by a guest user or the order is not locked.
        Parameters:
        orderId - order id
        Returns:
        the logon id
        Throws:
        ECException
      • isLocked

        public boolean isLocked(java.lang.Long orderId)
                         throws ECException
        Check to see if the order is locked by the other user.
        Parameters:
        orderId - order id
        Returns:
        true if the order is locked by the other user, false otherwise.
        Throws:
        ECException
      • isLocked

        public boolean isLocked(java.lang.Long orderId,
                                boolean checkOtherUser)
                         throws ECException
        Check to see if the order is locked. If the checkOtherUser is true, it will check if the order is locked by the other user. If the checkOtherUser is false, it will check if the order is locked by me.
        Parameters:
        orderId - order id
        checkOtherUser - a boolean value
        Returns:
        true if the order is locked, return false otherwise
        Throws:
        ECException
      • lock

        public void lock(java.lang.Long orderId)
                  throws ECException
        Lock the order resource. If it is locked by other people, an ECException with MesssageKey _ERR_ORDER_IS_LOCKED will be thrown.
        Parameters:
        orderId - order id
        Throws:
        ECException
      • lock

        public void lock(java.lang.Long[] orderIds)
                  throws ECException
        Lock the order resource. If it is locked by other people, an ECException with MesssageKey _ERR_ORDER_IS_LOCKED will be thrown.
        Parameters:
        orderIds - an array of order ids
        Throws:
        ECException
      • unlock

        public void unlock(java.lang.Long orderId)
                    throws ECException
        Unlock the order resource. If the order is not locked, it does nothing.
        Parameters:
        orderId - an array of order ids
        Throws:
        ECException
      • unlock

        public void unlock(java.lang.Long[] orderIds)
                    throws ECException
        Unlock the order resource. If the order is not locked, it does nothing.
        Parameters:
        orderIds - an array of order ids
        Throws:
        ECException