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

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

public class ResGrpAddCmdImpl
extends ToolsControllerCommandImpl
implements ResGrpAddCmd

Adds a new resource Group to the datasource. Following is the list of parameters the command accepts from the User Interface:

This command creates a new entry in the resource group table. Using the dynamically generated resGroupId for this new entry it also enters a description for the resource group in the resource group description table if a description is specified in the user interface.

The command then parses the comma delimited String containing the resCgryIds of all the resources to be associated with this resource group and iteratively calls the ResCgryResGrpAddTaskCmd task command to populate the relationship table associating an resource group with its constituent resources.


Field Summary
protected  java.lang.String resCgryIds
          Comma delimited string containing ids of resources to be added to resource group
 
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.ResGrpAddCmd
COPYRIGHT, defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command.ECTargetableCommand
COPYRIGHT
 
Constructor Summary
ResGrpAddCmdImpl()
           
 
Method Summary
 java.lang.String getDescription()
          Gets the description of the resource group.
 java.lang.String getResCgryIds()
          Gets the list of resCgry ids to be added to the resource group.
 java.lang.String getResGrpDisplayName()
          Gets the display name of the resource group.
 java.lang.String getResGrpName()
          Gets the name of the resource group.
 AccessVector getResources()
          This method returns the resources accessed by this command It will return null if no resources are being accessed by this command.
 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.
 void performExecute()
          Adds the resource group to the datasource.
 void setDescription(java.lang.String description)
          Sets the description of the resource group
 void setRequestProperties(TypedProperty reqParms)
          Sets the various properties of the command with the parameters received
 void setResCgryIds(java.lang.String resCgryIds)
          Sets the list of resCgry ids to be added to the resource group.
 void setResGrpDisplayName(java.lang.String resGrpDisplayName)
          Sets the display name of the resource group
 void setResGrpName(java.lang.String resGrpName)
          Sets the name of the resource group
 void setViewTask(java.lang.String viewTask)
          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
 

Field Detail

resCgryIds

protected java.lang.String resCgryIds
Comma delimited string containing ids of resources to be added to resource group
Constructor Detail

ResGrpAddCmdImpl

public ResGrpAddCmdImpl()
Method Detail

getDescription

public java.lang.String getDescription()
Gets the description of the resource group.
Specified by:
getDescription in interface ResGrpAddCmd
Returns:
The description of the resource group

getResCgryIds

public java.lang.String getResCgryIds()
Gets the list of resCgry ids to be added to the resource group.
Specified by:
getResCgryIds in interface ResGrpAddCmd
Returns:
The comma delimited String of resCgryIds

getResGrpDisplayName

public java.lang.String getResGrpDisplayName()
Gets the display name of the resource group.
Specified by:
getResGrpDisplayName in interface ResGrpAddCmd
Returns:
The display name of the resource group

getResGrpName

public java.lang.String getResGrpName()
Gets the name of the resource group.
Specified by:
getResGrpName in interface ResGrpAddCmd
Returns:
The name of the resource group

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

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.
Specified by:
getViewTask in interface ResGrpAddCmd
Returns:
View that is executed upon completion of the command

performExecute

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

setDescription

public void setDescription(java.lang.String description)
Sets the description of the resource group
Specified by:
setDescription in interface ResGrpAddCmd
Parameters:
description - The description of the resource group

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

setResCgryIds

public void setResCgryIds(java.lang.String resCgryIds)
Sets the list of resCgry ids to be added to the resource group.
Specified by:
setResCgryIds in interface ResGrpAddCmd
Parameters:
resCgryIds - The comma delimited String of resCgryIds

setResGrpDisplayName

public void setResGrpDisplayName(java.lang.String resGrpDisplayName)
Sets the display name of the resource group
Specified by:
setResGrpDisplayName in interface ResGrpAddCmd
Parameters:
resGrpDisplayName - The display name of the resource group

setResGrpName

public void setResGrpName(java.lang.String resGrpName)
Sets the name of the resource group
Specified by:
setResGrpName in interface ResGrpAddCmd
Parameters:
resGrpName - The name of the resource group

setViewTask

public void setViewTask(java.lang.String viewTask)
Sets the view task name to be returned to the caller.
Specified by:
setViewTask in interface ResGrpAddCmd
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
Throws:
ECException - If an error is encountered while checking the parameters