com.ibm.commerce.contract.commands

Class PolicyAddCmdImpl

  • java.lang.Object
    • com.ibm.websphere.command.CacheableCommandImpl
      • com.ibm.commerce.command.MeasuredCacheableCommandImpl
        • com.ibm.commerce.command.AbstractECTargetableCommand
          • com.ibm.commerce.command.ControllerCommandImpl
            • com.ibm.commerce.contract.commands.PolicyAddCmdImpl
  • All Implemented Interfaces:
    com.ibm.commerce.command.AccCommand, com.ibm.commerce.command.ControllerCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, PolicyAddCmd, com.ibm.commerce.security.Protectable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command


    public class PolicyAddCmdImpl
    extends com.ibm.commerce.command.ControllerCommandImpl
    implements PolicyAddCmd
    This is the default implementation of the PolicyAddCmd controller command.

    Input parameters:

    Name Description
    BusinessPolicyName The name of the business policy. Mandatory.
    BusinessPolicyType The type of the business policy. Mandatory.
    commands A Hashtable object contains all the commands process the business policy. The keys of this Hashtable are Integer objects which start with 0 to number of the commands. The values of the Hashtable are String objects which represent the commands. Optional.
    CommonProperty The common property string which business policy commands need. Mandatory.
    StartDate The start date of the business policy. Mandatory.
    EndDate The end date of the business policy. Mandatory.
    StoreEntityId The store entity Id to which the business policy belongs. Mandatory.
    Properties The specific properties of the business policy commands need. Optional.
    RequestProperties The request properties.Possible values include: type,name,plcyStoreId,cmd,props,commonProps,startDate,endDate. Optional.

    Output parameters:

    Name Description
    EndDate The end date of the business policy.
    PolicyId The new policy ID.
    StartDate The start date of the business policy.
    Resources The access vector accessed by this command.

    Behaviour:

      Adds the business policy to policy table, and creates the business policy and command(s) relationship.

    AccessBeans called:

    • StoreEntityAccessBean
    • BusinessPolicyAccessBean
    • PolicyCommandAccessBean
    • com.ibm.commerce.contract.objects.ContractJDBCHelperAccessBean#findAllBusinessPolicyType()
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String CLASSNAME
      The name of this class.
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Constructor Summary

      Constructors 
      Constructor and Description
      PolicyAddCmdImpl() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.sql.Timestamp getEndDate()
      Gets the end date of the business policy.
      java.lang.Long getPolicyId()
      Gets the new policy ID.
      com.ibm.commerce.accesscontrol.AccessVector getResources()
      Gets the access vector accessed by this command.
      java.sql.Timestamp getStartDate()
      Gets the start date of the business policy.
      void performExecute()
      Executes the business logic of this command implementation.
      void setBusinessPolicyName(java.lang.String name)
      Sets the name of the business policy.
      void setBusinessPolicyType(java.lang.String type)
      Sets the type of the business policy.
      void setCommands(java.util.Hashtable commands)
      Sets the commands which process the business policy.
      void setCommonProperty(java.lang.String commonProp)
      Sets the common property string which business policy commands need.
      void setEndDate(java.lang.Long anEndDate)
      Sets the end date of the business policy.
      void setEndDate(java.lang.String endDate)
      Sets the end date of the business policy.
      void setEndDate(java.sql.Timestamp newEndDate)
      Sets the end date of the business policy.
      void setProperties(java.util.Hashtable props)
      Sets the specific properties of the business policy commands need.
      void setRequestProperties(com.ibm.commerce.datatype.TypedProperty aRequestProperties)
      Retrieves input parameters from the request properties.
      void setStartDate(java.lang.Long anStartDate)
      Sets the start date of the business policy.
      void setStartDate(java.lang.String startDate)
      Sets the starting date of the business policy.
      void setStartDate(java.sql.Timestamp startDate)
      Sets the start date of the business policy.
      void setStoreEntityId(java.lang.Integer storeEntId)
      Sets the store entity Id to which the business policy belongs.
      void validateParameters()
      Checks the input parameters.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl

        checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
      • Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand

        accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
      • Methods inherited from interface com.ibm.commerce.command.ControllerCommand

        checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
      • Methods inherited from interface com.ibm.commerce.command.AccCommand

        accessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwner
      • Methods inherited from interface com.ibm.commerce.command.ECCommand

        checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
      • Methods inherited from interface com.ibm.commerce.security.Protectable

        fulfills, getOwner
    • Field Detail

      • CLASSNAME

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

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

      • PolicyAddCmdImpl

        public PolicyAddCmdImpl()
    • Method Detail

      • getEndDate

        public java.sql.Timestamp getEndDate()
        Gets the end date of the business policy.
        Returns:
        the end date of the business policy in Timestamp object
      • getPolicyId

        public java.lang.Long getPolicyId()
        Gets the new policy ID.
        Specified by:
        getPolicyId in interface PolicyAddCmd
        Returns:
        Long the new policy ID.
      • getResources

        public com.ibm.commerce.accesscontrol.AccessVector getResources()
                                                                 throws com.ibm.commerce.exception.ECException
        Gets the access vector accessed by this command. The default implementation returns StoreEntityAccessBean of the store which the business policy will be added to.

        Specified by:
        getResources in interface com.ibm.commerce.command.ECCommand
        Overrides:
        getResources in class com.ibm.commerce.command.AbstractECTargetableCommand
        Returns:
        AccessVector - a vector of resource action pairs
        Throws:
        com.ibm.commerce.exception.ECException
        See Also:
        AbstractECTargetableCommand.getResources()
      • getStartDate

        public java.sql.Timestamp getStartDate()
        Gets the start date of the business policy.
        Returns:
        the start date of the business policy in Timestamp object
      • performExecute

        public void performExecute()
                            throws com.ibm.commerce.exception.ECException
        Executes the business logic of this command implementation.
        Specified by:
        performExecute in interface com.ibm.commerce.command.ECCommand
        Overrides:
        performExecute in class com.ibm.commerce.command.AbstractECTargetableCommand
        Throws:
        com.ibm.commerce.exception.ECException - Raised with message _ERR_DUPLICATED_POLICY_NAME if a business policy with the same name and type for the same store already exists. Raised with message _ERR_DUPLICATED_BUSINESS_CMD_NAME if a business policy command with the same already exists for this business policy.
        See Also:
        AbstractECTargetableCommand.performExecute()
      • setBusinessPolicyName

        public void setBusinessPolicyName(java.lang.String name)
        Sets the name of the business policy.
        Specified by:
        setBusinessPolicyName in interface PolicyAddCmd
        Parameters:
        name - the name of the business policy.
      • setBusinessPolicyType

        public void setBusinessPolicyType(java.lang.String type)
        Sets the type of the business policy.
        Specified by:
        setBusinessPolicyType in interface PolicyAddCmd
        Parameters:
        type - the business policy type
      • setCommands

        public void setCommands(java.util.Hashtable commands)
        Sets the commands which process the business policy. A Hashtable object contains all the commands process the business policy. The keys of this Hashtable are Integer objects which start with 0 to the number of the commands. The values of the Hashtable are String objects which represent the commands. For example, if there are three commands. the keys of the Hashtable object will be 0, 1, 2.
        Specified by:
        setCommands in interface PolicyAddCmd
        Parameters:
        commands - all the commands to process the business policy
      • setCommonProperty

        public void setCommonProperty(java.lang.String commonProp)
        Sets the common property string which business policy commands need.
        Specified by:
        setCommonProperty in interface PolicyAddCmd
        Parameters:
        commonProp - the common property which business policy commands need to process the policy
      • setEndDate

        public void setEndDate(java.lang.Long anEndDate)
        Sets the end date of the business policy.
        Parameters:
        anEndDate - the end date of the business policy in Long object
      • setEndDate

        public void setEndDate(java.lang.String endDate)
        Sets the end date of the business policy.
        Specified by:
        setEndDate in interface PolicyAddCmd
        Parameters:
        endDate - A string object in yyyy-mm-dd hh:mm:ss.fffffffff format represents the end date of the business policy
      • setEndDate

        public void setEndDate(java.sql.Timestamp newEndDate)
        Sets the end date of the business policy.
        Parameters:
        newEndDate - The end date of the business policy.
      • setProperties

        public void setProperties(java.util.Hashtable props)
        Sets the specific properties of the business policy commands need. The keys of this Hashtable are Integer objects. The values of the Hashtable are String objects which represent the properties. The keys of this Hashtable are depended on which command the property is for. For example, if you have three commands in commands Hashtable, the first one and the third one have the common property. And the second command needs a specific property, then you set the key to Integer 2.
        Specified by:
        setProperties in interface PolicyAddCmd
        Parameters:
        props - a hashtable contains the business properties for a business command
      • setRequestProperties

        public void setRequestProperties(com.ibm.commerce.datatype.TypedProperty aRequestProperties)
                                  throws com.ibm.commerce.exception.ECApplicationException
        Retrieves input parameters from the request properties.
        Specified by:
        setRequestProperties in interface com.ibm.commerce.command.ControllerCommand
        Overrides:
        setRequestProperties in class com.ibm.commerce.command.ControllerCommandImpl
        Parameters:
        aRequestProperties - An TypedProperty object contains the input parameters. For this default implementation, the following parameter are required parameters: name, type, plcyStoreId. optional parameters are cmd, commonProps, props, endDate, startDate.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with message _ERR_MISSING_CMD_PARAMETER if one of the these required parameters are missing. Raised with message _ERR_WRONG_GMT_TIMESTAMP_FORMAT if the startDate or endDate parameter is not in "yyyy-mm-dd hh:mm:ss.fffffffff" format.
        See Also:
        ControllerCommandImpl.setRequestProperties(TypedProperty)
      • setStartDate

        public void setStartDate(java.lang.Long anStartDate)
        Sets the start date of the business policy.
        Parameters:
        anStartDate - the start date of the business policy in Long object
      • setStartDate

        public void setStartDate(java.lang.String startDate)
        Sets the starting date of the business policy.
        Specified by:
        setStartDate in interface PolicyAddCmd
        Parameters:
        startDate - a string object in yyyy-mm-dd hh:mm:ss.fffffffff format for the business policy's start date
      • setStartDate

        public void setStartDate(java.sql.Timestamp startDate)
        Sets the start date of the business policy.
        Parameters:
        startDate - the start date of the business policy in Timestamp object
      • setStoreEntityId

        public void setStoreEntityId(java.lang.Integer storeEntId)
        Sets the store entity Id to which the business policy belongs.
        Specified by:
        setStoreEntityId in interface PolicyAddCmd
        Parameters:
        storeEntId - the store entity id.
      • validateParameters

        public void validateParameters()
                                throws com.ibm.commerce.exception.ECException
        Checks the input parameters.
        Specified by:
        validateParameters in interface com.ibm.commerce.command.ECCommand
        Overrides:
        validateParameters in class com.ibm.commerce.command.AbstractECTargetableCommand
        Throws:
        com.ibm.commerce.exception.ECException - Raised with message _ERR_UNSUPPORTED_BIZ_POLICY_TYPE if the given business policy type is an unsupported business policy type.
        See Also:
        AbstractECTargetableCommand.validateParameters()