com.ibm.commerce.account.commands

Class AccountImportCmdImpl

  • java.lang.Object
  • All Implemented Interfaces:
    AccountImportCmd, com.ibm.commerce.command.AccCommand, com.ibm.commerce.command.ControllerCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, com.ibm.commerce.security.Protectable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command


    public class AccountImportCmdImpl
    extends TradingAgreementImportBaseCmdImpl
    implements AccountImportCmd
    This is the default implementation of the AccountImportCmd controller command.

    Input parameters:

    Name Description
    xsd xsd flag to indicate if an xml instance file based on XSD or not. It is optional.
    fileName The file name of the importing xml file. It is mandatory.
    storeId The store ID. It is mandatory.
    path xml entity path. It is mandatory.
    validate validate flag to indicate if validation a importing xml file against an xml schema.It is optional.

    Output parameters:

    None.

    Behaviour:

      For each element of account:
    • if xsd flag is ture, call SaveAccountCmd task command to save account.
    • if xsd flag is false, call CreateAccountCmd task command to create a new account.

      Task commands called:

      Access Beans used:

      • AccountAccessBean
      • StoreEntityAccessBean
      • UserAccessBean
      • OrganizationAccessBean
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      com.ibm.commerce.accesscontrol.AccessVector getResources()
      Gets the access vector accessed by this command.
      void performExecute()
      Executes the business logic of this command implementation.
      void setAccountXMLFileName(java.lang.String accountXMLFileName)
      Sets the name of the account XML file.
      void setRequestProperties(com.ibm.commerce.datatype.TypedProperty aRequestProperties)
      Sets the request properties of this command implementation.
      void setRootElement(org.w3c.dom.Element rootDocElm)
      Sets the root Element of the contract XML file.
      void setStoreId(java.lang.Integer anStoreId)
      Sets the storeId.
      void setValidationFlag(boolean validationFlag)
      Sets the validation flag to indicate if XML file will be validated by XML parser against the XSD.
      void setXMLEntityPath(java.lang.String path)
      Sets the XML entity path.
      void setXSDFlag(boolean xsdFlag)
      Sets the XSD flag to indicate the XML instance file is based on XSD or DTD.
      void validateParameters()
      Extracts and validates the input parameters of this command implementation.
      • 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
        The IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AccountImportCmdImpl

        public AccountImportCmdImpl()
    • Method Detail

      • 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 the OrganizationAccessBean of the account owner.
        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()
      • 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
        See Also:
        AbstractECTargetableCommand.performExecute()
      • setAccountXMLFileName

        public void setAccountXMLFileName(java.lang.String accountXMLFileName)
        Sets the name of the account XML file.
        Specified by:
        setAccountXMLFileName in interface AccountImportCmd
        Parameters:
        accountXMLFileName - the name of the acocunt XML file
      • setRequestProperties

        public void setRequestProperties(com.ibm.commerce.datatype.TypedProperty aRequestProperties)
                                  throws com.ibm.commerce.exception.ECApplicationException
        Sets the request properties of this command implementation.
        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.
        Throws:
        com.ibm.commerce.exception.ECApplicationException - Raised with message _ERR_MISSING_CMD_PARAMETER when the input XML file name and store id is missed.
      • setRootElement

        public void setRootElement(org.w3c.dom.Element rootDocElm)
        Sets the root Element of the contract XML file.
        Specified by:
        setRootElement in interface AccountImportCmd
        Parameters:
        rootDocElm - the document Element object of the contract XML
      • setStoreId

        public void setStoreId(java.lang.Integer anStoreId)
        Sets the storeId.
        Specified by:
        setStoreId in interface AccountImportCmd
        Parameters:
        anStoreId - the ID of a store
      • setValidationFlag

        public void setValidationFlag(boolean validationFlag)
        Sets the validation flag to indicate if XML file will be validated by XML parser against the XSD.
        Specified by:
        setValidationFlag in interface AccountImportCmd
        Parameters:
        validationFlag - boolean - validation flag, true: validate the XML instance file against the XSD, false: not
      • setXMLEntityPath

        public void setXMLEntityPath(java.lang.String path)
        Sets the XML entity path.
        Specified by:
        setXMLEntityPath in interface AccountImportCmd
        Parameters:
        path - the path where it can find the DTD or XML Schema files
      • validateParameters

        public void validateParameters()
                                throws com.ibm.commerce.exception.ECException
        Extracts and validates the input parameters of this command implementation. The method checks if the information provided in account Element object is valid.
        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_DUPLICATED_ACCOUNT_NAME if the account name is duplicated during creating. Raised with message _ERR_ACCOUNT_REFERENCE_NUMBER_NOT_REQUIRED if the account ID is provided during creating. Raised with message _ERR_FILE_NOT_FOUND if the XML file or DTD/XSD file cannot be found. Raised with message _ERR_PARSE_XML_FILE if an error occurred when the XML parser parses the XML file. Raised with message _ERR_GENRIC_PARSE_XML_FILE if an IO error occurred.
        See Also:
        AbstractECTargetableCommand.validateParameters()