com.ibm.commerce.contract.util

Class ContractTCLockHelper

  • java.lang.Object
    • com.ibm.commerce.contract.util.ContractTCLockHelper


  • public class ContractTCLockHelper
    extends java.lang.Object
    This is a contract-oriented helper class for managing terms and conditions locking.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String CLASSNAME
      The full name of this command.
      static java.lang.String COPYRIGHT
      The IBM copyright notice field.
      static int RC_ACQUIRE_NEWLOCK
      Return code: acquire a new lock successful.
      static int RC_ALLOWED_TO_UNLOCK
      Return code: The current logon user is allowed to unlock the resource.
      static int RC_DIFF_LOCK_OWNER
      Return code: The lock's owner is different from the current logon user.
      static int RC_EXECUTION_EXCEPTION
      Return code: System exception is thrown during execution.
      static int RC_FAIL_TO_LOCK
      Return code: Failed to lock the resource.
      static int RC_FAIL_TO_UNLOCK
      Return code: Failed to unlock the resource.
      static int RC_INVALID_LOCK
      Return code: The lock on the resource has been altered, it no longer belongs to the current logon user.
      static int RC_INVALID_LOCKINFO
      Return code: The current lock information is invalid.
      static int RC_LOCK_IS_FOUND
      Return code: The lock for the resource is found.
      static int RC_LOL_GREATER_TCL
      Return code: The lock is created before the lock's owner last logon time.
      static int RC_LOL_LESS_TCL
      Return code: The lock is created after the lock's owner last logon time.
      static int RC_NOLOCK_BUT_FAIL_TO_LOCK
      Return code: Cannot find the lock for the resource but failed to create a new lock for it.
      static int RC_NOT_ALLOWED_TO_UNLOCK
      Return code: The current logon user is not allowed to unlock the resource.
      static int RC_RENEW_LOCK
      Return code: Renew the lock successful
      static int RC_UNLOCK
      Return code: Unlock the resource successful.
      static int RC_UNLOCK_AND_NEWLOCK
      Return code: The lock on the resource has been released and a new lock is created on the resource successful.
      static int TCTYPE_GENERAL_OTHERS_PAGES
      The general, participants, attachment, and remarks pages type.
      static int TCTYPE_ORDER_APPROVAL
      The order approval terms and conditions type.
      static int TCTYPE_PAYMENT
      The payment terms and conditions type.
      static int TCTYPE_PRICING
      The pricing terms and conditions type.
      static int TCTYPE_RETURNS
      The returns terms and conditions type.
      static int TCTYPE_SHIPPING
      The shipping terms and conditions type.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ContractTCLockHelper(com.ibm.commerce.command.CommandContext cmdCtxt, java.lang.Long contractId, int tcType)
      Constructor for ContractTCLockHelper
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int forceUnlockTC()
      Forces an unlock operation on the resource regardless of who owns the lock.
      int forceUnlockTCAndAcquireNewLock()
      To force an unlock operation on the resource regardless who owns the lock.
      java.lang.String getCurrentLockCreationTimestamp()
      Returns the creation timestamp for the current lock.
      java.lang.String getCurrentLockOwnerLogonId()
      Returns the logon ID for the current lock's owner.
      int managingLock()
      This is the business logic that manages different lock scenarios while terms and conditions JSP pages are loaded.
      int verifyAndUnlockTC()
      Verifies if the lock still exists and is still owned by the current logon user, then unlock the terms and conditions resource.
      • Methods inherited from class java.lang.Object

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

      • CLASSNAME

        public static final java.lang.String CLASSNAME
        The full name of this command.
        See Also:
        Constant Field Values
      • COPYRIGHT

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

        public static final int RC_ACQUIRE_NEWLOCK
        Return code: acquire a new lock successful.
        See Also:
        Constant Field Values
      • RC_ALLOWED_TO_UNLOCK

        public static final int RC_ALLOWED_TO_UNLOCK
        Return code: The current logon user is allowed to unlock the resource.
        See Also:
        Constant Field Values
      • RC_DIFF_LOCK_OWNER

        public static final int RC_DIFF_LOCK_OWNER
        Return code: The lock's owner is different from the current logon user.
        See Also:
        Constant Field Values
      • RC_EXECUTION_EXCEPTION

        public static final int RC_EXECUTION_EXCEPTION
        Return code: System exception is thrown during execution.
        See Also:
        Constant Field Values
      • RC_FAIL_TO_LOCK

        public static final int RC_FAIL_TO_LOCK
        Return code: Failed to lock the resource.
        See Also:
        Constant Field Values
      • RC_FAIL_TO_UNLOCK

        public static final int RC_FAIL_TO_UNLOCK
        Return code: Failed to unlock the resource.
        See Also:
        Constant Field Values
      • RC_INVALID_LOCK

        public static final int RC_INVALID_LOCK
        Return code: The lock on the resource has been altered, it no longer belongs to the current logon user.
        See Also:
        Constant Field Values
      • RC_INVALID_LOCKINFO

        public static final int RC_INVALID_LOCKINFO
        Return code: The current lock information is invalid.
        See Also:
        Constant Field Values
      • RC_LOCK_IS_FOUND

        public static final int RC_LOCK_IS_FOUND
        Return code: The lock for the resource is found.
        See Also:
        Constant Field Values
      • RC_LOL_GREATER_TCL

        public static final int RC_LOL_GREATER_TCL
        Return code: The lock is created before the lock's owner last logon time.
        See Also:
        Constant Field Values
      • RC_LOL_LESS_TCL

        public static final int RC_LOL_LESS_TCL
        Return code: The lock is created after the lock's owner last logon time.
        See Also:
        Constant Field Values
      • RC_NOLOCK_BUT_FAIL_TO_LOCK

        public static final int RC_NOLOCK_BUT_FAIL_TO_LOCK
        Return code: Cannot find the lock for the resource but failed to create a new lock for it.
        See Also:
        Constant Field Values
      • RC_NOT_ALLOWED_TO_UNLOCK

        public static final int RC_NOT_ALLOWED_TO_UNLOCK
        Return code: The current logon user is not allowed to unlock the resource.
        See Also:
        Constant Field Values
      • RC_RENEW_LOCK

        public static final int RC_RENEW_LOCK
        Return code: Renew the lock successful
        See Also:
        Constant Field Values
      • RC_UNLOCK

        public static final int RC_UNLOCK
        Return code: Unlock the resource successful.
        See Also:
        Constant Field Values
      • RC_UNLOCK_AND_NEWLOCK

        public static final int RC_UNLOCK_AND_NEWLOCK
        Return code: The lock on the resource has been released and a new lock is created on the resource successful.
        See Also:
        Constant Field Values
      • TCTYPE_GENERAL_OTHERS_PAGES

        public static final int TCTYPE_GENERAL_OTHERS_PAGES
        The general, participants, attachment, and remarks pages type.
      • TCTYPE_ORDER_APPROVAL

        public static final int TCTYPE_ORDER_APPROVAL
        The order approval terms and conditions type.
      • TCTYPE_PAYMENT

        public static final int TCTYPE_PAYMENT
        The payment terms and conditions type.
      • TCTYPE_PRICING

        public static final int TCTYPE_PRICING
        The pricing terms and conditions type.
      • TCTYPE_RETURNS

        public static final int TCTYPE_RETURNS
        The returns terms and conditions type.
      • TCTYPE_SHIPPING

        public static final int TCTYPE_SHIPPING
        The shipping terms and conditions type.
    • Constructor Detail

      • ContractTCLockHelper

        public ContractTCLockHelper(com.ibm.commerce.command.CommandContext cmdCtxt,
                                    java.lang.Long contractId,
                                    int tcType)
        Constructor for ContractTCLockHelper
        Parameters:
        cmdCtxt - The command context.
        contractId - The Contract ID.
        tcType - The terms and conditions type.
    • Method Detail

      • forceUnlockTC

        public int forceUnlockTC()
        Forces an unlock operation on the resource regardless of who owns the lock.
        Returns:
        The possible return code will be one of the following: RC_UNLOCK RC_FAIL_TO_UNLOCK RC_EXECUTION_EXCEPTION
      • forceUnlockTCAndAcquireNewLock

        public int forceUnlockTCAndAcquireNewLock()
        To force an unlock operation on the resource regardless who owns the lock. And then create a new lock on the resource for the current logon user.
        Returns:
        The possible return code will be one of the following: RC_UNLOCK_AND_NEWLOCK RC_FAIL_TO_LOCK RC_EXECUTION_EXCEPTION
      • getCurrentLockCreationTimestamp

        public java.lang.String getCurrentLockCreationTimestamp()
        Returns the creation timestamp for the current lock.
        Returns:
        The creation timestamp for the current lock.
      • getCurrentLockOwnerLogonId

        public java.lang.String getCurrentLockOwnerLogonId()
        Returns the logon ID for the current lock's owner.
        Returns:
        The logon ID for the current lock's owner.
      • managingLock

        public int managingLock()
        This is the business logic that manages different lock scenarios while terms and conditions JSP pages are loaded.
        Returns:
        The possible return code will be one of the following: RC_ACQUIRE_NEWLOCK RC_RENEW_LOCK RC_ALLOWED_TO_UNLOCK RC_NOT_ALLOWED_TO_UNLOCK RC_EXECUTION_EXCEPTION
      • verifyAndUnlockTC

        public int verifyAndUnlockTC()
        Verifies if the lock still exists and is still owned by the current logon user, then unlock the terms and conditions resource.
        Returns:
        The possible return code will be one of the following: RC_UNLOCK RC_INVALID_LOCK RC_EXECUTION_EXCEPTION