com.ibm.commerce.accesscontrol.policyeditor.commands
Class PolicyUpdateCmdImpl

com.ibm.commerce.command.AbstractECTargetableCommand
  |
  +--com.ibm.commerce.command.ControllerCommandImpl
        |
        +--com.ibm.commerce.tools.command.ToolsControllerCommandImpl
              |
              +--com.ibm.commerce.accesscontrol.policyeditor.commands.PolicyUpdateCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, PolicyUpdateCmd, Protectable, ToolsControllerCommand

public class PolicyUpdateCmdImpl
extends ToolsControllerCommandImpl
implements PolicyUpdateCmd

Modifies a pre-existing policy in the datasource. Following is the list of parameters the command accepts from the User Interface:

This command checks to see whether the user logged in is a Site Admin or a Store Admin and if the policy being updated is a default policy. Depending upon the registration type of the user logged in and the type of the policy one of the following four scenarios is handled:
  1. Site Admin tries to modify default policy - Policy is mofified
  2. Site Admin tries to modify non-default policy - Policy is modified
  3. Store Admin tries to modify default policy - a copy of the policy is
    created as a non-default policy and assigned to the current org
  4. Store Admin tries to modify non-default policy - Policy is modified


Fields inherited from class com.ibm.commerce.command.ControllerCommandImpl
requestProperties, responseProperties, retriable, viewReqProperties
 
Fields inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.accesscontrol.policyeditor.commands.PolicyUpdateCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command.ECTargetableCommand
COPYRIGHT
 
Constructor Summary
PolicyUpdateCmdImpl()
           
 
Method Summary
 java.lang.Integer getActionGroupId()
          Gets the action group id tuple of the policy
 java.lang.Long getOwnerId()
          Gets the owner id of the policy
 java.lang.String getPolicyDesc()
          Gets the description of the policy
 java.lang.String getPolicyDisplayName()
          Gets the display name of the policy
 java.lang.Integer getPolicyId()
          Gets the policyId of the policy
 java.lang.String getPolicyName()
          Gets the name of the policy
 java.lang.Integer getRelationId()
          Gets the relation id tuple of the policy
 java.lang.Integer getResourceGroupId()
          Gets the resource group id tuple of the policy
 AccessVector getResources()
          This method returns the resources accessed by this command It will return null if no resources are being accessed by this command.
 java.lang.Long getUserGroupId()
          Gets the user group id tuple of the policy
 TypedProperty getViewInputProperties()
          This method is called by the web controller to retrieve the request properties set by the setRequestProperties() method.
 java.lang.String getViewTask()
          Gets the view task name to be returned to the caller.
 void performExecute()
          Updates the specified policies in the datasource.
 void setActionGroupId(java.lang.Integer actionGroupId)
          Sets the action group id tuple of the policy
 void setOwnerId(java.lang.Long ownerId)
          Sets the owner id of the policy
 void setPolicyDesc(java.lang.String policyDesc)
          Sets the description of the policy
 void setPolicyDisplayName(java.lang.String policyDisplayName)
          Sets the display name of the policy
 void setPolicyId(java.lang.Integer policyId)
          Sets the policyId of the policy
 void setPolicyName(java.lang.String policyName)
          Sets the name of the policy
 void setRelationId(java.lang.Integer relationId)
          Sets the relation id tuple of the policy
 void setRequestProperties(TypedProperty reqParms)
          Sets the various properties of the command with the parameters received
 void setResourceGroupId(java.lang.Integer resourceGroupId)
          Sets the resource group id tuple of the policy
 void setUserGroupId(java.lang.Long userGroupId)
          Sets the user group id tuple of the policy
 void setViewTask(java.lang.String newViewTask)
          Sets the view task name to be returned to the caller.
 void validateParameters()
          Check whether all the parameters are set properly.
 
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command.AccCommand
accessControlCheck, getAccCheck, getForUserId, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Constructor Detail

PolicyUpdateCmdImpl

public PolicyUpdateCmdImpl()
Method Detail

getActionGroupId

public java.lang.Integer getActionGroupId()
Gets the action group id tuple of the policy
Specified by:
getActionGroupId in interface PolicyUpdateCmd
Returns:
The action group id tuple of the policy

getOwnerId

public java.lang.Long getOwnerId()
Gets the owner id of the policy
Specified by:
getOwnerId in interface PolicyUpdateCmd
Returns:
The owner id of the policy

getPolicyDesc

public java.lang.String getPolicyDesc()
Gets the description of the policy
Specified by:
getPolicyDesc in interface PolicyUpdateCmd
Returns:
The description of the policy

getPolicyDisplayName

public java.lang.String getPolicyDisplayName()
Gets the display name of the policy
Specified by:
getPolicyDisplayName in interface PolicyUpdateCmd
Returns:
The display name of the policy

getPolicyId

public java.lang.Integer getPolicyId()
Gets the policyId of the policy
Specified by:
getPolicyId in interface PolicyUpdateCmd
Returns:
The policyId of the policy

getPolicyName

public java.lang.String getPolicyName()
Gets the name of the policy
Specified by:
getPolicyName in interface PolicyUpdateCmd
Returns:
The name of the policy

getRelationId

public java.lang.Integer getRelationId()
Gets the relation id tuple of the policy
Specified by:
getRelationId in interface PolicyUpdateCmd
Returns:
The relation id tuple of the policy

getResourceGroupId

public java.lang.Integer getResourceGroupId()
Gets the resource group id tuple of the policy
Specified by:
getResourceGroupId in interface PolicyUpdateCmd
Returns:
The resource group id tuple of the policy

getResources

public AccessVector getResources()
                          throws ECException
This method returns the resources accessed by this command It will return null if no resources are being accessed by this command.
Specified by:
getResources in interface ECCommand
Overrides:
getResources in class AbstractECTargetableCommand
Returns:
Object[] - an array of protectable resources

getUserGroupId

public java.lang.Long getUserGroupId()
Gets the user group id tuple of the policy
Specified by:
getUserGroupId in interface PolicyUpdateCmd
Returns:
The user group id tuple of the policy

getViewInputProperties

public TypedProperty getViewInputProperties()
This method is called by the web controller to retrieve the request properties set by the setRequestProperties() method. The command need to override this method because otherwise the properties passed into the controller command would be then passed onto the view command. This is unnecessary for the tools and actually will break us when using the ReDirectView comman because the URL to re-direct to cannot be more than 500 chars. The command calls the getViewInputProperties() method in the ToolsControllerCommandImpl command. This takes care of removing the parameters specific to the tools framework.
Specified by:
getViewInputProperties in interface ControllerCommand
Overrides:
getViewInputProperties in class ToolsControllerCommandImpl
Returns:
com.ibm.commerce.datatype.TypeProperty

getViewTask

public java.lang.String getViewTask()
Gets the view task name to be returned to the caller.
Specified by:
getViewTask in interface PolicyUpdateCmd
Returns:
View that is executed upon completion of the command

performExecute

public void performExecute()
                    throws ECException
Updates the specified policies in the datasource.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - If an error is encountered while updating the datasource

setActionGroupId

public void setActionGroupId(java.lang.Integer actionGroupId)
Sets the action group id tuple of the policy
Specified by:
setActionGroupId in interface PolicyUpdateCmd
Parameters:
actionGroupId - The action group id tuple of the policy

setOwnerId

public void setOwnerId(java.lang.Long ownerId)
Sets the owner id of the policy
Specified by:
setOwnerId in interface PolicyUpdateCmd
Parameters:
ownerId - The owner id of the policy

setPolicyDesc

public void setPolicyDesc(java.lang.String policyDesc)
Sets the description of the policy
Specified by:
setPolicyDesc in interface PolicyUpdateCmd
Parameters:
policyDesc - The description of the policy

setPolicyDisplayName

public void setPolicyDisplayName(java.lang.String policyDisplayName)
Sets the display name of the policy
Specified by:
setPolicyDisplayName in interface PolicyUpdateCmd
Parameters:
policyDisplayName - The display name of the policy

setPolicyId

public void setPolicyId(java.lang.Integer policyId)
Sets the policyId of the policy
Specified by:
setPolicyId in interface PolicyUpdateCmd
Parameters:
policyId - The policyId of the policy

setPolicyName

public void setPolicyName(java.lang.String policyName)
Sets the name of the policy
Specified by:
setPolicyName in interface PolicyUpdateCmd
Parameters:
policyName - The name of the policy

setRelationId

public void setRelationId(java.lang.Integer relationId)
Sets the relation id tuple of the policy
Specified by:
setRelationId in interface PolicyUpdateCmd
Parameters:
relationId - The relation id tuple of the policy

setRequestProperties

public void setRequestProperties(TypedProperty reqParms)
                          throws ECApplicationException
Sets the various properties of the command with the parameters received
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ToolsControllerCommandImpl
Parameters:
reqParms - TypedProperty containing the input parameters.
Throws:
ECApplicationException - If a required parameter is missing

setResourceGroupId

public void setResourceGroupId(java.lang.Integer resourceGroupId)
Sets the resource group id tuple of the policy
Specified by:
setResourceGroupId in interface PolicyUpdateCmd
Parameters:
resourceGroupId - The resource group id tuple of the policy

setUserGroupId

public void setUserGroupId(java.lang.Long userGroupId)
Sets the user group id tuple of the policy
Specified by:
setUserGroupId in interface PolicyUpdateCmd
Parameters:
userGroupId - The user group id tuple of the policy

setViewTask

public void setViewTask(java.lang.String newViewTask)
Sets the view task name to be returned to the caller.
Specified by:
setViewTask in interface PolicyUpdateCmd
Parameters:
viewTask - View that is executed upon completion of the command

validateParameters

public void validateParameters()
                        throws ECException
Check whether all the parameters are set properly.
Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -