com.ibm.workflow.servlet.client
Class Command

java.lang.Object
  |
  +--com.ibm.workflow.servlet.client.Command

public final class Command
extends java.lang.Object

This class encapsulates what commands are allowed in the various states of process templates, process instances, activity instances, persistent lists, and work items. It also holds the default image names for the commands.

See also the HTMLDocHandler and AuditTrailHandler samples for how to use this class in custom handlers.


Field Summary
static Command AI_FORCE_FINISH
          Command for ActivityInstance.forceFinish()
static Command AI_FORCE_RESTART
          Command for ActivityInstance.forceRestart()
static Command AI_SHOW_PROPERTIES
          Command to show activity properties
static Command AI_TERMINATE
          Command for ActivityInstance.terminate()
static Command AIL_QUERY_INSTANCES
          Command for ActivityInstanceList.queryActivityInstances()
static Command ITEM_DELETE
          Command for Item.delete()
static Command ITEM_TRANSFER
          Command for Item.transfer(java.lang.String)
static Command LIST_DELETE
          Command for PersistentList.delete()
static Command LIST_QUERY_LISTS
          Command to query all persistent lists
static Command LIST_SHOW_PROPERTIES
          Command to show a persistent list's properties
static Command PI_DELETE
          Command for ProcessInstance.delete()
static Command PI_RESTART
          Command for ProcessInstance.restart()
static Command PI_RESUME
          Command for ProcessInstance.resume(boolean)
static Command PI_SHOW_MONITOR
          Command to show a process instance monitor
static Command PI_SHOW_PROPERTIES
          Command to show process instance properties
static Command PI_START
          Command for ProcessInstance.start()
static Command PI_SUSPEND
          Command for ProcessInstance.suspend(boolean)
static Command PI_TERMINATE
          Command for ProcessInstance.terminate()
static Command PIL_QUERY_INSTANCES
          Command for ProcessInstanceList.queryProcessInstances()
static Command PT_CREATE_AND_START_INSTANCE
          Command for ProcessTemplate.createAndStartInstance(java.lang.String, java.lang.String, java.lang.String, boolean)
static Command PT_CREATE_INSTANCE
          Command for ProcessTemplate.createInstance(java.lang.String, java.lang.String, java.lang.String, boolean)
static Command PT_DELETE
          Command for ProcessTemplate.delete()
static Command PT_SHOW_PROPERTIES
          Command to show process template properties
static Command PTL_QUERY_TEMPLATES
          Command for ProcessTemplateList.queryProcessTemplates()
static Command WI_CANCEL_CHECKOUT
          Command for WorkItem.cancelCheckOut()
static Command WI_CHECKIN
          Command for WorkItem.checkIn(com.ibm.workflow.api.ReadWriteContainer, int)
static Command WI_CHECKOUT
          Command for WorkItem.checkOut()
static Command WI_FINISH
          Command for WorkItem.finish()
static Command WI_FORCE_FINISH
          Command for WorkItem.forceFinish()
static Command WI_FORCE_RESTART
          Command for WorkItem.forceRestart()
static Command WI_RESTART
          Command for WorkItem.restart()
static Command WI_SHOW_PROPERTIES
          Command to show work item properties
static Command WI_START
          Command for WorkItem.start()
static Command WI_TERMINATE
          Command for WorkItem.terminate()
static Command WL_QUERY_WORK_ITEMS
          Command for WorkList.queryWorkItems()
 
Constructor Summary
Command(java.lang.String commandString, java.lang.String commandPicture, java.lang.String commandText)
          Constructs a Command object.
Command(java.lang.String commandString, java.lang.String commandPrompt, java.lang.String commandParameter, java.lang.String commandPicture, java.lang.String commandText)
          Constructs a Command object.
 
Method Summary
 java.lang.String getActionButton(RequestContext context, java.lang.String imageAttr)
          Creates an img tag pointing to the action button for this command (<documentRoot>/images/navigation/<commandPicture>).
 java.lang.String getActionIcon(RequestContext context, java.lang.String imageAttr)
          Creates an img tag pointing to the action icon for this command (<documentRoot>/images/action/<commandPicture>).
static Command[] getActions(com.ibm.workflow.api.ActivityInstance activity)
          Get the list of allowed commands for an activity instance.
static Command[] getActions(com.ibm.workflow.api.ActivityInstanceNotification item)
          Get the list of allowed commands for a activity notification item.
static Command[] getActions(com.ibm.workflow.api.PersistentList list)
          Get the list of allowed commands for a persistent list.
static Command[] getActions(com.ibm.workflow.api.ProcessInstance instance)
          Get the list of allowed commands for a process instance.
static Command[] getActions(com.ibm.workflow.api.ProcessInstanceNotification item)
          Get the list of allowed commands for a process notification item.
static Command[] getActions(com.ibm.workflow.api.ProcessTemplate template)
          Get the list of allowed commands for a process template.
static Command[] getActions(java.lang.String user, com.ibm.workflow.api.WorkItem workItem)
          Get the list of allowed commands for a work item.
static Command[] getActions(java.lang.String user, com.ibm.workflow.api.WorkItem workitem, javax.servlet.http.HttpServletRequest request)
           
 java.lang.String getCommand()
          Query the command string.
 java.lang.String getText(SessionContext cat)
          Query the command's text that can be used as alt text or as button label.
 java.lang.String getTriggerTag(RequestContext context, java.lang.String id, java.lang.String name)
          Construct a HTML anchor (a href) tag that will cause the command to be executed.
 java.lang.String getTriggerTag(RequestContext context, java.lang.String id, java.lang.String name, boolean isActivityList)
           
 java.lang.String getTriggerTag(RequestContext context, java.lang.String id, java.lang.String name, int item)
           
 java.lang.String getURL(RequestContext context, java.lang.String id, java.lang.String name, boolean replace)
          Construct a URL that will cause the command to be executed.
 Command withParameter(java.lang.String commandParameter)
          Creates a new command with the same attributes and a new parameter.
 Command withPrompt(java.lang.String commandPrompt, java.lang.String commandParameter)
          Creates a new command with the same attributes and a new prompt.
 Command withText(java.lang.String commandText)
          Creates a new command with the same attributes and a new text.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIST_QUERY_LISTS

public static final Command LIST_QUERY_LISTS
Command to query all persistent lists

LIST_DELETE

public static final Command LIST_DELETE
Command for PersistentList.delete()

LIST_SHOW_PROPERTIES

public static final Command LIST_SHOW_PROPERTIES
Command to show a persistent list's properties

AIL_QUERY_INSTANCES

public static final Command AIL_QUERY_INSTANCES
Command for ActivityInstanceList.queryActivityInstances()

PTL_QUERY_TEMPLATES

public static final Command PTL_QUERY_TEMPLATES
Command for ProcessTemplateList.queryProcessTemplates()

PIL_QUERY_INSTANCES

public static final Command PIL_QUERY_INSTANCES
Command for ProcessInstanceList.queryProcessInstances()

WL_QUERY_WORK_ITEMS

public static final Command WL_QUERY_WORK_ITEMS
Command for WorkList.queryWorkItems()

PT_CREATE_AND_START_INSTANCE

public static final Command PT_CREATE_AND_START_INSTANCE
Command for ProcessTemplate.createAndStartInstance(java.lang.String, java.lang.String, java.lang.String, boolean)

PT_CREATE_INSTANCE

public static final Command PT_CREATE_INSTANCE
Command for ProcessTemplate.createInstance(java.lang.String, java.lang.String, java.lang.String, boolean)

PT_DELETE

public static final Command PT_DELETE
Command for ProcessTemplate.delete()

PT_SHOW_PROPERTIES

public static final Command PT_SHOW_PROPERTIES
Command to show process template properties

PI_DELETE

public static final Command PI_DELETE
Command for ProcessInstance.delete()

PI_RESTART

public static final Command PI_RESTART
Command for ProcessInstance.restart()

PI_RESUME

public static final Command PI_RESUME
Command for ProcessInstance.resume(boolean)

PI_START

public static final Command PI_START
Command for ProcessInstance.start()

PI_SUSPEND

public static final Command PI_SUSPEND
Command for ProcessInstance.suspend(boolean)

PI_TERMINATE

public static final Command PI_TERMINATE
Command for ProcessInstance.terminate()

PI_SHOW_PROPERTIES

public static final Command PI_SHOW_PROPERTIES
Command to show process instance properties

PI_SHOW_MONITOR

public static final Command PI_SHOW_MONITOR
Command to show a process instance monitor

AI_FORCE_FINISH

public static final Command AI_FORCE_FINISH
Command for ActivityInstance.forceFinish()

AI_FORCE_RESTART

public static final Command AI_FORCE_RESTART
Command for ActivityInstance.forceRestart()

AI_SHOW_PROPERTIES

public static final Command AI_SHOW_PROPERTIES
Command to show activity properties

AI_TERMINATE

public static final Command AI_TERMINATE
Command for ActivityInstance.terminate()

ITEM_DELETE

public static final Command ITEM_DELETE
Command for Item.delete()

ITEM_TRANSFER

public static final Command ITEM_TRANSFER
Command for Item.transfer(java.lang.String)

WI_CANCEL_CHECKOUT

public static final Command WI_CANCEL_CHECKOUT
Command for WorkItem.cancelCheckOut()

WI_CHECKIN

public static final Command WI_CHECKIN
Command for WorkItem.checkIn(com.ibm.workflow.api.ReadWriteContainer, int)

WI_CHECKOUT

public static final Command WI_CHECKOUT
Command for WorkItem.checkOut()

WI_FINISH

public static final Command WI_FINISH
Command for WorkItem.finish()

WI_FORCE_FINISH

public static final Command WI_FORCE_FINISH
Command for WorkItem.forceFinish()

WI_FORCE_RESTART

public static final Command WI_FORCE_RESTART
Command for WorkItem.forceRestart()

WI_RESTART

public static final Command WI_RESTART
Command for WorkItem.restart()

WI_START

public static final Command WI_START
Command for WorkItem.start()

WI_TERMINATE

public static final Command WI_TERMINATE
Command for WorkItem.terminate()

WI_SHOW_PROPERTIES

public static final Command WI_SHOW_PROPERTIES
Command to show work item properties
Constructor Detail

Command

public Command(java.lang.String commandString,
               java.lang.String commandPicture,
               java.lang.String commandText)
Constructs a Command object.
Parameters:
commandString - the command to be invoked
commandPicture - the name of the .gif file to be shown (see getActionIcon and getActionButton)
commandText - the description of the command (used for example as alt text or button label)

Command

public Command(java.lang.String commandString,
               java.lang.String commandPrompt,
               java.lang.String commandParameter,
               java.lang.String commandPicture,
               java.lang.String commandText)
Constructs a Command object.
Parameters:
commandString - the command to be invoked
commandPrompt - the question to be prompted before the command is invoked; may be null
commandParameter - any additional parameter that is to be passed to the command when it is invoked; may be null
commandPicture - the name of the .gif to be shown
commandText - the description of the command (used for example as alt text or button label)
Method Detail

withParameter

public Command withParameter(java.lang.String commandParameter)
Creates a new command with the same attributes and a new parameter.
Parameters:
commandParameter - the new command's parameter
Returns:
the new command

withPrompt

public Command withPrompt(java.lang.String commandPrompt,
                          java.lang.String commandParameter)
Creates a new command with the same attributes and a new prompt.
Parameters:
commandPrompt - the new command's prompt
commandParameter - the new command's parameter
Returns:
the new command

withText

public Command withText(java.lang.String commandText)
Creates a new command with the same attributes and a new text.
Parameters:
commandText - the new command's text
Returns:
the new command

getCommand

public java.lang.String getCommand()
Query the command string.
Returns:
the command string

getText

public java.lang.String getText(SessionContext cat)
Query the command's text that can be used as alt text or as button label.
Parameters:
context - the context to be used for localized strings
Returns:
the command's text

getTriggerTag

public java.lang.String getTriggerTag(RequestContext context,
                                      java.lang.String id,
                                      java.lang.String name)
Construct a HTML anchor (a href) tag that will cause the command to be executed. This tag will contain JavaScript code if a client-side prompt is needed. For example, the BuiltinHandler.deleteTemplate() command will prompt before actually deleting the template.
Parameters:
context - the request context
id - the OID of the object on which the command should be invoked
name - the name of the object (only used in JavaScript prompts)
Returns:
a HTML a href tag

getTriggerTag

public java.lang.String getTriggerTag(RequestContext context,
                                      java.lang.String id,
                                      java.lang.String name,
                                      boolean isActivityList)

getTriggerTag

public java.lang.String getTriggerTag(RequestContext context,
                                      java.lang.String id,
                                      java.lang.String name,
                                      int item)

getURL

public java.lang.String getURL(RequestContext context,
                               java.lang.String id,
                               java.lang.String name,
                               boolean replace)
Construct a URL that will cause the command to be executed. This URL will contain JavaScript code if a client-side prompt is needed for the command. For example, the BuiltinHandler.deleteTemplate() command will prompt before actually deleting the template.
Parameters:
context - the request context
id - the OID of the object on which the command should be invoked
name - the name of the object (only used in JavaScript prompts)
replace - indicates if the URL should overwrite the browser's history entry
Returns:
a URL containing the command string

getActionIcon

public java.lang.String getActionIcon(RequestContext context,
                                      java.lang.String imageAttr)
Creates an img tag pointing to the action icon for this command (<documentRoot>/images/action/<commandPicture>). This icon is typically used in list rows.
Parameters:
context - the request context
imageAttr - any additional image attribute (for example, border="0")
Returns:
the img HTML code for the action image

getActionButton

public java.lang.String getActionButton(RequestContext context,
                                        java.lang.String imageAttr)
Creates an img tag pointing to the action button for this command (<documentRoot>/images/navigation/<commandPicture>). This button is typically used in navigation bars.
Parameters:
context - the request context
imageAttr - any additional image attribute (for example, border="0")
Returns:
the img HTML code for the action button

getActions

public static Command[] getActions(com.ibm.workflow.api.ProcessTemplate template)
                            throws com.ibm.workflow.api.FmcException
Get the list of allowed commands for a process template. The returned list is never null, but may be empty.
Parameters:
template - the process template for which the allowed commands are queried
Returns:
an array of allowed commands
Throws:
com.ibm.workflow.api.FmcException - if an API error occured

getActions

public static Command[] getActions(com.ibm.workflow.api.ProcessInstance instance)
                            throws com.ibm.workflow.api.FmcException
Get the list of allowed commands for a process instance. The returned list is never null, but may be empty.
Parameters:
instance - the process instance for which the allowed commands are queried
Returns:
an array of allowed commands
Throws:
com.ibm.workflow.api.FmcException - if an API error occured

getActions

public static Command[] getActions(com.ibm.workflow.api.ActivityInstance activity)
                            throws com.ibm.workflow.api.FmcException
Get the list of allowed commands for an activity instance. The returned list is never null, but may be empty.
Parameters:
activity - the activity instance for which the allowed commands are queried
Returns:
an array of allowed commands
Throws:
com.ibm.workflow.api.FmcException - if an API error occured

getActions

public static Command[] getActions(com.ibm.workflow.api.ProcessInstanceNotification item)
Get the list of allowed commands for a process notification item. The
Parameters:
item - the process notification item for which the allowed commands are queried
Returns:
an array of allowed commands

getActions

public static Command[] getActions(com.ibm.workflow.api.ActivityInstanceNotification item)
Get the list of allowed commands for a activity notification item. The
Parameters:
item - the activity notification item for which the allowed commands are queried
Returns:
an array of allowed commands

getActions

public static Command[] getActions(com.ibm.workflow.api.PersistentList list)
                            throws com.ibm.workflow.api.FmcException
Get the list of allowed commands for a persistent list. The returned list is never null, but may be empty.
Parameters:
list - the persistent list for which the allowed commands are queried
Returns:
an array of allowed commands
Throws:
com.ibm.workflow.api.FmcException - if an API error occured

getActions

public static Command[] getActions(java.lang.String user,
                                   com.ibm.workflow.api.WorkItem workitem,
                                   javax.servlet.http.HttpServletRequest request)
                            throws com.ibm.workflow.api.FmcException

getActions

public static Command[] getActions(java.lang.String user,
                                   com.ibm.workflow.api.WorkItem workItem)
                            throws com.ibm.workflow.api.FmcException
Get the list of allowed commands for a work item. The returned list is never null, but may be empty.
Parameters:
user - the ID of the current user
workItem - the work item for which the allowed commands are queried
Returns:
an array of allowed commands
Throws:
com.ibm.workflow.api.FmcException - if an API error occured


© Copyright IBM Corporation 1999, 2008. All Rights Reserved.