com.ibm.commerce.command
Class ControllerCommandImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, Protectable
Direct Known Subclasses:
AcceptCouponFromBannerAdCmdImpl, AccountDeleteCmdImpl, AccountImportCmdImpl, AccountSaveCmdImpl, AddEventControllerCommandTestImpl, AddJobCmdImpl, AddProductsToSearchSpaceCmdImpl, AdminReturnApproveCmdImpl, AsyncControllerCommandImpl, AttributeValueAddCmdImpl, AttributeValueDeleteCmdImpl, AttributeValueUpdateCmdImpl, AuctionNotificationCmdImpl, BalancePaymentCmdImpl, BroadcastMessageCmdImpl, CatalogAddCmdImpl, CatalogDeleteCmdImpl, CatalogEntryAddCmdImpl, CatalogEntryDeleteCmdImpl, CatalogEntryUpdateCmdImpl, CatalogGroupAddCmdImpl, CatalogGroupDeleteCmdImpl, CatalogGroupUpdateCmdImpl, CatalogUpdateCmdImpl, CategoryDisplayCmdImpl, CatGroupCatEntryRelAddCmdImpl, CatGroupCatEntryRelDeleteCmdImpl, CatGroupRelAddCmdImpl, CatGroupRelDeleteCmdImpl, CleanJobCmdImpl, ClickMonitorCommandImpl, CompleteOrderCmdImpl, ContractAttachmentAddCmdImpl, ContractAttachmentDeleteCmdImpl, ContractCancelCmdImpl, ContractCloseCmdImpl, ContractCopyCmdImpl, ContractCreateCmdImpl, ContractDeleteCmdImpl, ContractDisplayCmdImpl, ContractExportCmdImpl, ContractImportApprovedVersionCmdImpl, ContractImportDraftVersionCmdImpl, ContractListAsBuyerCmdImpl, ContractNewVersionCmdImpl, ContractResumeCmdImpl, ContractSaveCmdImpl, ContractSetInSessionCmdImpl, ContractSuspendCmdImpl, ContractTCCreateCmdImpl, ContractTCDeleteCmdImpl, ContractTCUpdateCmdImpl, ContractUpdateCmdImpl, CouponDSSCmdImpl, DeleteCouponsFromWalletCmdImpl, DeleteMailCmdImpl, DeployContractProcess, DisplayAuctionItemCmdImpl, DisplayAuctionListCmdImpl, DisplayAuctionRulesCmdImpl, DisplayMessageCmdImpl, DisplayShopperBidsCmdImpl, DoAuctionNotifyCmdImpl, DynamicKitConfigurationAddCmdImpl, FinalizeAuctionCmdImpl, GalleryDisplayCmdImpl, GetBroadcastJobStatusCmdImpl, GetJobStatusCmdImpl, GetPaymentInfoCmdImpl, GetPickPackListDetailCmdImpl, InterestItemAddCmdImpl, InterestItemDeleteCmdImpl, InterestItemDisplayCmdImpl, InterestItemListCopyCmdImpl, InterestItemListDeleteCmdImpl, ListRegistryCmdImpl, LogoffCmdImpl, LogonCmdImpl, MemberRoleAssignCmdImpl, MemberRoleUnassignCmdImpl, MonitorAuctionCmdImpl, NewInboundMessageCmdImpl, OfferAddCmdImpl, OfferDeleteCmdImpl, OfferUpdateCmdImpl, OrderCancelCmdImpl, OrderItemBaseCmdImpl, OrderItemDeleteCmdImpl, OrderItemDisplayCmdImpl, OrderItemMoveCmdImpl, OrderListCmdImpl, OrderProcessCmdImpl, OrderProfileUpdateCmdImpl, OrderScheduleCmdImpl, OrderStatusCmdImpl, OrderUnlockCmdImpl, ParticipantAddCmdImpl, ParticipantDeleteCmdImpl, PayCleanupPMCmdImpl, PaymentSummaryGenerateCmdImpl, PayResetPMCmdImpl, PaySynchronizePMCmdImpl, PolicyAddCmdImpl, PolicyDeleteCmdImpl, PolicyDescriptionDeleteCmdImpl, PolicyDescriptionUpdateCmdImpl, ProcessBackordersCmdImpl, ProductAttributeAddCmdImpl, ProductAttributeDeleteCmdImpl, ProductAttributeUpdateCmdImpl, ProductDisplayCmdImpl, ProductInventoryUpdateCmdImpl, ProductListPriceUpdateCmdImpl, ProductOfferPriceUpdateCmdImpl, ProductSetAddCmdImpl, ProductSetDeleteCmdImpl, ProductSetPolicyAddCmdImpl, ProductSetPolicyDeleteCmdImpl, ProductSetPublishCmdImpl, PVCBufferUrlCmdImpl, PVCChangeDeviceCmdImpl, PVCRegisterDeviceCmdImpl, PVCRegistrationCmdImpl, RAReallocateCmdImpl, RedeemCouponCmdImpl, ReEnterPasswordCmdImpl, RefreshRegistryCmdImpl, ReleaseExpiredAllocationsCmdImpl, ReleaseToFulfillmentCmdImpl, RemoveJobCmdImpl, RemoveProductsFromAllSearchSpacesCmdImpl, RemoveProductsFromSearchSpaceCmdImpl, RequisitionListBaseCmdImpl, ResetPasswordAdministratorCmdImpl, ResetPasswordCmdImpl, RetrieveShopperProfileCmdImpl, RetrieveShoppingCartCmdImpl, ReturnCancelCmdImpl, ReturnCreditAndCloseScanCmdImpl, ReturnDisplayCmdImpl, ReturnItemBaseCmdImpl, ReturnItemComponentUpdateCmdImpl, ReturnItemDeleteCmdImpl, ReturnListDisplayCmdImpl, ReturnPrepareCmdImpl, ReturnProcessCmdImpl, ReturnUpdateCmdImpl, RFQActivateAllDueCmdImpl, RFQCloseAllExpiredCmdImpl, RFQMarkForDeleteCmdImpl, RFQNotificationMonitorBaseCmdImpl, RoleAddCmdImpl, SchedCouponCmdImpl, ScheduledOrderCancelCmdImpl, SchedulerInterruptCmdImpl, SecurityCheckCmdImpl, SendTransactedMsgCmdImpl, SetCurrencyPreferenceCmdImpl, SetInterestItemListCmdImpl, SetPendingOrderCmdImpl, StoreCatalogDisplayCmdImpl, StoreCollabListDisplayCmdImpl, StoreCollabMembersDisplayCmdImpl, ToolsControllerCommandImpl, TopCatalogGroupAddCmdImpl, TopCatalogGroupDeleteCmdImpl, TopCategoriesDisplayCmdImpl, UpdateLocalRegistryCmdImpl, UpdateRegistryCmdImpl, UpdateSearchSpacesCmdImpl, UseCouponIdCmdImpl, UserRegistrationCmdImpl

public class ControllerCommandImpl
extends AbstractECTargetableCommand
implements ControllerCommand, Protectable

An abstract base implemention for any controller command. At a minimum, a command writer has to implement its own performExecute method and set up the proper response data.


Field Summary
protected  TypedProperty requestProperties
           
protected  TypedProperty responseProperties
           
protected  boolean retriable
           
protected  TypedProperty viewReqProperties
           
 
Fields inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.command.ControllerCommand
COPYRIGHT
 
Fields inherited from interface com.ibm.commerce.command.ECCommand
defaultCommandClassName
 
Fields inherited from interface com.ibm.commerce.command.ECTargetableCommand
COPYRIGHT
 
Constructor Summary
ControllerCommandImpl()
          ControllerCommandImpl constructor.
 
Method Summary
 boolean fulfills(java.lang.Long member, java.lang.String relationship)
          Determines if a given member fulfills a given relationship with the resource.
 java.lang.Long getForUserId()
          Gets the user Id for a customer agent command.
 boolean getGeneric()
          Gets the generic property for this command.
 java.lang.Long getOwner()
          Returns the owner of this command.
 TypedProperty getRequestProperties()
          Retrieve the request properties associated with a command.
 TypedProperty getResolvedRequestProperties()
          Gets the resolved request properties associated with this command.
 TypedProperty getResponseProperties()
          Gets the response properties after a controller command has been executed successfully.
 boolean getRetriable()
          Gets the retriable property for this command.
 TypedProperty getViewInputProperties()
          Gets the input properties that will be passed onto the view command.
 boolean isGeneric()
          Check to see if this is a generic command.
 boolean isRetriable()
          Check to see if this command is retriable on transaction rollback exception.
 TypedProperty mergeProperties(TypedProperty reqProp)
          Merges the properties passedto the request with the default properties.
 void setForUserId(java.lang.Long value)
          Sets the forUserId for a customer agent command.
 void setGeneric(boolean value)
          Sets the generic property of this command.
 void setOwner(java.lang.Long value)
          Sets owner for this command for the purpose of command level access control
 void setRequestProperties(TypedProperty reqProperties)
          Sets the requestProperties for the command.
 void setResponseProperties(TypedProperty respProperties)
          Sets the response properties.
 void setRetriable(boolean value)
          Sets the retriable properties for this command.
 void setViewInputProperties(TypedProperty reqProperties)
          Sets the input properties to be passed to the for the view command.
 
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, performExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties, validateParameters
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
execute
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, setAccCheck
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, performExecute, setCommandContext, setCommandIfName, setDefaultProperties, validateParameters
 

Field Detail

requestProperties

protected TypedProperty requestProperties

responseProperties

protected TypedProperty responseProperties

retriable

protected boolean retriable

viewReqProperties

protected TypedProperty viewReqProperties
Constructor Detail

ControllerCommandImpl

public ControllerCommandImpl()
ControllerCommandImpl constructor.
Method Detail

fulfills

public boolean fulfills(java.lang.Long member,
                        java.lang.String relationship)
                 throws java.rmi.RemoteException,
                        java.lang.Exception
Determines if a given member fulfills a given relationship with the resource.
Specified by:
fulfills in interface Protectable
Parameters:
member - Member id of the member
relationship - The relationship the member has with respect to the resource
Returns:
true if the member fulfills the relationship with the resource

getForUserId

public java.lang.Long getForUserId()
Gets the user Id for a customer agent command.
Specified by:
getForUserId in interface AccCommand
Returns:
(java.lang.Long) The for user Id.

getGeneric

public boolean getGeneric()
Gets the generic property for this command. A generic command is a command that can be executed by a generic user. The default implemention by ControllerCommandImpl returns 'false' for this method. Command writer needs to overwrite this method if this command can be executed by a generic user.
Specified by:
getGeneric in interface ControllerCommand
Returns:
boolean - true if this command can be called by a generic user - false if this command cannot be called by a generic user

getOwner

public java.lang.Long getOwner()
                        throws java.rmi.RemoteException,
                               java.lang.Exception
Returns the owner of this command. This method is part of the Protectable interface. This is required for command level access control where the command is the protectable resource.

Specified by:
getOwner in interface Protectable
Returns:
java.lang.Long
Throws:
java.rmi.RemoteException. -  
Exception. -  

getRequestProperties

public TypedProperty getRequestProperties()
Retrieve the request properties associated with a command.
Specified by:
getRequestProperties in interface ControllerCommand
Returns:
com.ibm.commerce.datatype.TypedProperty

getResolvedRequestProperties

public TypedProperty getResolvedRequestProperties()
Gets the resolved request properties associated with this command. This method is called after a controller command has been executed successfully. It return a a hashtable of name value pairs of interpreted request properties. This method needs to be implemented for all commands that accepts wild card parameter values and where user traffic data monitoring is desired. The default implementation returns null. The command will return only the properties with expanded parameter values.
Specified by:
getResolvedRequestProperties in interface ControllerCommand
Returns:
com.ibm.commerce.datatype.TypeProperty

getResponseProperties

public TypedProperty getResponseProperties()
Gets the response properties after a controller command has been executed successfully. It return a a hashtable of name value pairs. The controller command should normally return a view command name for returning response data. For example, it could contain the following properties: EC_VIEWTASKNAME (viewTaskName) - name of a view command / view task this is a required parameter EC_DOCPATHNAME (docname) - name of a jsp to be forwarded EC_TEXTDOCUMENT (textDocument)- inputStream for the text document to be returned EC_RAWDOCUMENT (rawDocument)- inputStream for the raw document to be returned EC_REDIRECTURL (redirecturl) - name of a redirect url or other additional information to be passed as requestParameters to the view command The response properties are combined with any default parameters defined in the properties column of the viewreg before passing on the the view command.
Specified by:
getResponseProperties in interface ControllerCommand
Returns:
com.ibm.commerce.datatype.TypeProperty

getRetriable

public boolean getRetriable()
Gets the retriable property for this command. A retriable command is one that should be retried on a rollback exception. The default implementation is to return false.
Specified by:
getRetriable in interface ControllerCommand
Returns:
boolean - true if this command is retriable - false if this command is not retriable

getViewInputProperties

public TypedProperty getViewInputProperties()
Gets the input properties that will be passed onto the view command. The default implementation is to return all of the request properties to the view comamnd Command writer can overwrite this method to return all, part or non of the request properties to the view command

Specified by:
getViewInputProperties in interface ControllerCommand
Returns:
com.ibm.commerce.datatype.TypeProperty

isGeneric

public boolean isGeneric()
Check to see if this is a generic command. A generic command is a command that can be invoked by a generic user. The default is false for all controller commands and true for all view commands.
Specified by:
isGeneric in interface ControllerCommand
Returns:
boolean - true if this command can be called by a generic user - false if this command cannot be called by a generic user

isRetriable

public boolean isRetriable()
Check to see if this command is retriable on transaction rollback exception. A retriable command will be retried once on transaction rollback exception. The default implementation is to return false.
Specified by:
isRetriable in interface ControllerCommand
Returns:
boolean - true if this command is retriable - false if this command is not retriable

mergeProperties

public TypedProperty mergeProperties(TypedProperty reqProp)
Merges the properties passedto the request with the default properties. The default behavior is to give a higher priority to the properties passed in the request. The default properties, retrieved from CMDREG is given a lower priority. Command implementators can overwrite this method if they want a different merge policy.
Specified by:
mergeProperties in interface ControllerCommand
Parameters:
requestProp - com.ibm.commerce.datatype.TypedProperty - input request properties
Returns:
com.ibm.commerce.datatype.TypedProperty - this will become the request properties for this command

setForUserId

public void setForUserId(java.lang.Long value)
Sets the forUserId for a customer agent command. This method is for internal use by the framework only.
Specified by:
setForUserId in interface AccCommand
Parameters:
value - Long - userID

setGeneric

public final void setGeneric(boolean value)
Sets the generic property of this command. The generic property is initialized by the command factory code based on the properties specified in the cmdreg table.

Specified by:
setGeneric in interface ControllerCommand
Parameters:
value - boolean - true if the command is a generic command false if this command is not a generic command

setOwner

public void setOwner(java.lang.Long value)
Sets owner for this command for the purpose of command level access control

Specified by:
setOwner in interface AccCommand
Parameters:
java.lang.Long -  

setRequestProperties

public void setRequestProperties(TypedProperty reqProperties)
                          throws ECException
Sets the requestProperties for the command. The WebController calls the setRequestProperties method before invoking the execute method for this command. It is the responsibility of the implementer of the ControllerCommand to extract the required input parameters from the requestProperties object.
Specified by:
setRequestProperties in interface ControllerCommand
Parameters:
requestProperties - com.ibm.commerce.datatype.TypedProperty
Throws:
com.ibm.commerce.exception.ECException. -  

setResponseProperties

public void setResponseProperties(TypedProperty respProperties)
Sets the response properties. This is called by the command to set the response properties to be returned.
Parameters:
respProperties - com.ibm.commerce.datatype.TypedProperty

setRetriable

public final void setRetriable(boolean value)
Sets the retriable properties for this command. The retriable property is initialized command factory based on the properties defined in the cmdreg table.
Specified by:
setRetriable in interface ControllerCommand
Parameters:
value - boolean - true if retriable false if not retriable

setViewInputProperties

public void setViewInputProperties(TypedProperty reqProperties)
                            throws ECException
Sets the input properties to be passed to the for the view command. This is initialized to be the request properties for this command.

Specified by:
setViewInputProperties in interface ControllerCommand
Parameters:
requestProperties - com.ibm.commerce.datatype.TypedProperty
Throws:
com.ibm.commerce.exception.ECException. -