com.ibm.carma.ui.action.custom
Class CustomActionParameterManager

java.lang.Object
  extended by com.ibm.carma.ui.action.custom.CustomActionParameterManager
All Implemented Interfaces:
ICarmaPreferenceConstants

public class CustomActionParameterManager
extends java.lang.Object
implements ICarmaPreferenceConstants

This Class is used to manage the storing of retrieval of CustomParameters for CARMA actions.

There is a cache which stores recently made calls so that the preference store isn't hit unless it's necessary to do so. Typically this class is used in the following way:

 CustomActionParameterManager manager = CustomActionParameterManager.getManager();
 Object[] parameters = null;
 if (manager.isPromptNeeded(resource, ActionIdentifier.LOCK)) {
    //fill out parameters for lock action through some means,
    //typically using the CustomActionParameterDialog is the common method
    //but if one is doing that, they should probably use CustomActionUtil.getCustomParameters() instead
    parameters = fillUserParameters();
    manager.setUserStoreParamValues(resource.getRepository(), 
       resource.findActionFor(ActionIdentifier.LOCK));
 }
 
 parameters = manager.getCustomParameters(resource, ActionIdentifier.LOCK);
 resource.lock(monitor, parameters);
 

This class is not intended to be subclassed

See Also:
CustomActionParameterDialog, CustomActionUtil, ActionIdentifier

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.ibm.carma.ui.property.ICarmaPreferenceConstants
ICarmaPreferenceConstants.ParameterOrder
 
Field Summary
static java.lang.String COPYRIGHT
           
 
Fields inherited from interface com.ibm.carma.ui.property.ICarmaPreferenceConstants
PREF_ACTION_UNSUPPORTED, PREF_DELETE_CONFIRM, PREF_EDIT_UPLOAD_CHECK, PREF_META_DISPLAY, PREF_META_RETRIEVE, PREF_PARAM_ORDER, PREF_PARAM_ORDER_DEFAULT_ID, PREF_PARAM_ORDER_LABELS, PREF_PARAM_ORDER_METADATA_ID, PREF_PARAM_ORDER_USER_ID, PREF_PARAM_PROMPT, PREF_REMOTE_COPY, PREF_REMOTE_COPY_CONFIRM, PREF_REMOTE_DELETE, PREF_REMOTE_DELETE_CONFIRM, PREF_REMOTE_MOVE, PREF_REMOTE_MOVE_CONFIRM
 
Constructor Summary
CustomActionParameterManager()
           
 
Method Summary
 void clearAllUserStoredParamValues()
          This method clears all of the user store parameters values from CARMA's memory.
 java.lang.Object[] getCustomParameters(CustomActionAccepter resource, java.lang.String actionId)
          This will return the correct customer parameters for the given action on the given resource.
static CustomActionParameterManager getManager()
           
 java.lang.Object[] getUserStoredParamValues(CustomActionAccepter accepter, Action action)
          This method can be used to directly access what the user stored values are.
 boolean isPromptNeeded(CustomActionAccepter resource, java.lang.String actionId)
           
 void setUserStoredParamValues(RepositoryInstance repository, Action action, java.lang.Object[] values)
          This method can be used to directly set the user stored values for a specific action against a specific repository
 void setUserStoredParamValues(RepositoryManager repositoryManager, Action action, java.lang.Object[] values)
          This method can be used to directly set the user stored values for a specific action against a specific repository
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values
Constructor Detail

CustomActionParameterManager

public CustomActionParameterManager()
Method Detail

getManager

public static CustomActionParameterManager getManager()

isPromptNeeded

public boolean isPromptNeeded(CustomActionAccepter resource,
                              java.lang.String actionId)
                       throws NotSynchronizedException
Parameters:
resource -
actionId -
Returns:
false if there are no custom parameters, or (all of the parameters are filled in and the preference to always prompt isn't set). true otherwise.
Throws:
NotSynchronizedException - if the actions aren't available from the RepositoryManager The caller needs to execute resource.getRespository().getRepositoryManager().connection and try again

getCustomParameters

public java.lang.Object[] getCustomParameters(CustomActionAccepter resource,
                                              java.lang.String actionId)
                                       throws NotSynchronizedException
This will return the correct customer parameters for the given action on the given resource. All of the associated preferences will be consulted and utilized. These values are ready to send assuming isPromptNeeded returns false. If isPromptNeeded returns true callers should fill in the missing values by some other means (either looking it up through some external method, or by prompting the user)

Parameters:
resource - the CARMA resource being executed on
actionId - the Id being executed
Returns:
the stored custom parameter values for the resource
Throws:
NotSynchronizedException - if the actions aren't available from the RepositoryManager The caller needs to execute resource.getRespository().getRepositoryManager().connection and try again

getUserStoredParamValues

public java.lang.Object[] getUserStoredParamValues(CustomActionAccepter accepter,
                                                   Action action)
This method can be used to directly access what the user stored values are.

This method may be called directly, but more often clients should call getCustomParameters() as it references user preference and is more likely to produce values that the user expects.

Parameters:
accepter - the resource you'd like to check for the values against.
action - The Action to locate stored parameters for
Returns:
an Object[] of the user values for action against repository

setUserStoredParamValues

public void setUserStoredParamValues(RepositoryManager repositoryManager,
                                     Action action,
                                     java.lang.Object[] values)
This method can be used to directly set the user stored values for a specific action against a specific repository

Parameters:
repositoryManager - The repositoryManager to store the parameters values for.
action - The Action to store the paremter values for.
values - The values to store.

setUserStoredParamValues

public void setUserStoredParamValues(RepositoryInstance repository,
                                     Action action,
                                     java.lang.Object[] values)
This method can be used to directly set the user stored values for a specific action against a specific repository

Parameters:
repository - The repository to store the parameters values for.
action - The Action to store the paremter values for.
values - The values to store, where only non-null values are stored.

clearAllUserStoredParamValues

public void clearAllUserStoredParamValues()
This method clears all of the user store parameters values from CARMA's memory.