com.sas.commands.dataselectors
Class DataItemSelectorCommand

com.sas.commands.dataselectors.DataItemSelectorCommand
All Implemented Interfaces:
CommandSupportedInterface, CancelInterface, ContentsChangedInterface, DataSelectorCommandInterface, DynamicAttributeCommandInterface, PendingCommandInterface, BaseEntityInterface, BaseEntityValueInterface, EntityKeyInterface, com.sas.lang.StringDataInterface, com.sas.PublicClonable, com.sas.util.Command, com.sas.util.SimpleCommand, java.lang.Cloneable, java.rmi.Remote

public class DataItemSelectorCommand
implements CommandSupportedInterface

This class is responsible for assisting in the processing of user actions through a user-interface representation of a Query selector. When the selector is initially displayed, the show method creates the selector model and sets it on the selector for data retrieval. During selector processing of user interactions, the process method updates the selector model. The commit method commits all user selections to the business model represented by the selector model, and the cancel method removes all changes made by the user.

Since:
3.1

Field Summary
protected  java.lang.String action
          The user remote javascripting action.
static java.lang.String CANCEL_MODE
          The mode key for cancelling all selector actions
static java.lang.String CHANGE_QUERY_TYPE
          Remote scripting action key that indicates the value for the query type changed
static java.lang.String CHANGE_ROLE
          Remote scripting action key that indicates the selected role changed
static java.lang.String COMMIT
          Remote scripting action key that indicates the OK button was clicked
static java.lang.String COMMIT_MODE
          The mode key for committing changes to the viewer model
protected  java.lang.String data
          The selector data for a remote javascript action.
static java.lang.String ENABLE_BUTTONS
           
protected  java.lang.Object model
          The data model of the viewer
static java.lang.String MOVE_ITEM_DOWN
          Remote scripting action key that indicates the down arrow was clicked to move an item down
static java.lang.String MOVE_ITEM_UP
          Remote scripting action key that indicates the up arrow was clicked to move an item up
static java.lang.String MOVE_ITEMS
          Remote scripting action key that indicates the Move Item button was clicked
static java.lang.String PROCESS_MODE
          The mode key for interacting with the selector
protected  java.lang.String queryType
          The query type value
protected  java.lang.String role
          The selected role value
protected  java.lang.String[] selectedIndexes
           
protected  java.lang.String[] selectedItems
          Array of data items that have been selected for the selected role
protected  DataItemSelectorInterface selectorModel
          The selector data model.
static java.lang.String SHOW_MODE
          The mode key for initially displaying the selector
static java.lang.String SORT_ITEMS
          Remote scripting action key that indicates the available tree display format changed
protected  java.lang.String[] unselectedItems
          Array of data items that have been removed from the selected role
static java.lang.String UPDATE_ITEMS
          Remote scripting action key that indicates an add or delete of a data item occurred
 
Fields inherited from class com.sas.commands.dataselectors.BaseSelectorCommand
complete, contentsChanged, eventInfo, eventSource, modal, selector
 
Fields inherited from interface com.sas.commands.DynamicAttributeCommandInterface
COMMAND_NAME_PREFIX
 
Constructor Summary
DataItemSelectorCommand()
          Default constructor
DataItemSelectorCommand(java.lang.String name)
          Constructor that accepts a command name
DataItemSelectorCommand(java.lang.String name, java.lang.String actionClass)
          Constructor that accepts a command name and an action class type
 
Method Summary
 void cancel(java.lang.Object o)
          Cancel is called when the user clicks on the cancel button on the selector or another selector becomes active.
protected  void commit(java.lang.Object o)
          Commits all changes made to the selector model to the viewer's business model.
static DataItemSelectorModel createRoleProvider(com.sas.iquery.metadata.business.BusinessQuery query)
          Creates the dataitem selector model from the BusinessQuery.
protected  com.sas.util.RoleInterface findRoleForItem(java.lang.Object thisitem)
           
 java.lang.String getAction()
          Returns the user action string.
 java.lang.String getData()
          Returns the user data string.
 java.lang.String getQueryType()
          Returns the current query type
 java.lang.String getRole()
          Returns the current working role
 java.lang.String[] getSelectedIndexes()
           
 java.lang.String[] getSelectedItems()
          Returns the array of selected data items
 java.lang.String[] getUnselectedItems()
          Returns the array of unselected data items
protected  boolean isMeasure(java.lang.Object item)
           
 boolean isSupported(ActionSupportFilter actionFilter)
          Returns a boolean indicating whether the command is supported for the area specified on the ActionSupportFilter argument.
protected  void moveItemsToRole(java.util.List items, com.sas.util.RoleInterface targetRole)
           
protected  void process(java.lang.Object o)
          Performs processing to update the selector model as the user makes selections in the user interface.
 void setAction(java.lang.String actionstr)
          Sets the user action string.
 void setData(java.lang.String datastr)
          Sets the data string associated with the user action.
 void setQueryType(java.lang.String queryType)
          Sets the value for the query type for relational queries.
 void setRole(java.lang.String role)
          Sets the value for the current working role.
 void setSelectedIndexes(java.lang.String[] indexes)
           
 void setSelectedItems(java.lang.String[] items)
          Sets the array of selected data items.
 void setUnselectedItems(java.lang.String[] items)
          Sets the array of unselected data items.
protected  void setUsageOnResultItems(java.util.List itemlist, java.lang.String querytype)
          Sets the usage property of each data item in Itemlist to the value corresponding to the querytype key.
protected  void show(java.lang.Object o)
          Creates the selector model and sets it on the selector.
 
Methods inherited from class com.sas.commands.dataselectors.BaseSelectorCommand
cancel, closeSelector, execute, getEventInfo, getEventSource, getMode, getModel, getSelector, getSelectorModel, isComplete, isContentsChanged, isModal, setComplete, setModal, setMode, setModel, setSelector, setSelectorModel
 
Methods inherited from class com.sas.commands.BaseCommand
getLocale, getName, getNextCommandName, getText, isExecutable, isUndoable, setLocale, setName, setText, undo
 
Methods inherited from class com.sas.entities.BaseEntity
clone, containsAttributeNamed, equals, equals, getAttribute, getAttribute, getAttributeCount, getAttributes, getEntityKey, getPropertyDescriptors, getStringAttribute, listAttributeNames, removeAllAttributes, removeAttribute, reset, sameEntity, setAttribute, setAttributes, setEntityKey, toString
 
Methods inherited from interface com.sas.entities.BaseEntityValueInterface
getAttribute, setAttribute
 
Methods inherited from interface com.sas.util.Command
clone
 

Field Detail

model

protected java.lang.Object model
The data model of the viewer


selectorModel

protected DataItemSelectorInterface selectorModel
The selector data model. This is a subset of the viewer's model that the selector is responsible for modifying.


action

protected java.lang.String action
The user remote javascripting action. Valid values are linked below.

See Also:
UPDATE_ITEMS, SORT_ITEMS, MOVE_ITEMS, CHANGE_ROLE, MOVE_ITEM_UP, MOVE_ITEM_DOWN, CHANGE_QUERY_TYPE, COMMIT

data

protected java.lang.String data
The selector data for a remote javascript action.


SHOW_MODE

public static final java.lang.String SHOW_MODE
The mode key for initially displaying the selector

See Also:
Constant Field Values

PROCESS_MODE

public static final java.lang.String PROCESS_MODE
The mode key for interacting with the selector

See Also:
Constant Field Values

CANCEL_MODE

public static final java.lang.String CANCEL_MODE
The mode key for cancelling all selector actions

See Also:
Constant Field Values

COMMIT_MODE

public static final java.lang.String COMMIT_MODE
The mode key for committing changes to the viewer model

See Also:
Constant Field Values

UPDATE_ITEMS

public static final java.lang.String UPDATE_ITEMS
Remote scripting action key that indicates an add or delete of a data item occurred

See Also:
Constant Field Values

SORT_ITEMS

public static final java.lang.String SORT_ITEMS
Remote scripting action key that indicates the available tree display format changed

See Also:
Constant Field Values

MOVE_ITEMS

public static final java.lang.String MOVE_ITEMS
Remote scripting action key that indicates the Move Item button was clicked

See Also:
Constant Field Values

CHANGE_ROLE

public static final java.lang.String CHANGE_ROLE
Remote scripting action key that indicates the selected role changed

See Also:
Constant Field Values

MOVE_ITEM_UP

public static final java.lang.String MOVE_ITEM_UP
Remote scripting action key that indicates the up arrow was clicked to move an item up

See Also:
Constant Field Values

MOVE_ITEM_DOWN

public static final java.lang.String MOVE_ITEM_DOWN
Remote scripting action key that indicates the down arrow was clicked to move an item down

See Also:
Constant Field Values

CHANGE_QUERY_TYPE

public static final java.lang.String CHANGE_QUERY_TYPE
Remote scripting action key that indicates the value for the query type changed

See Also:
Constant Field Values

ENABLE_BUTTONS

public static final java.lang.String ENABLE_BUTTONS
See Also:
Constant Field Values

COMMIT

public static final java.lang.String COMMIT
Remote scripting action key that indicates the OK button was clicked

See Also:
Constant Field Values

selectedItems

protected java.lang.String[] selectedItems
Array of data items that have been selected for the selected role


unselectedItems

protected java.lang.String[] unselectedItems
Array of data items that have been removed from the selected role


selectedIndexes

protected java.lang.String[] selectedIndexes

role

protected java.lang.String role
The selected role value


queryType

protected java.lang.String queryType
The query type value

Constructor Detail

DataItemSelectorCommand

public DataItemSelectorCommand()
Default constructor


DataItemSelectorCommand

public DataItemSelectorCommand(java.lang.String name)
Constructor that accepts a command name


DataItemSelectorCommand

public DataItemSelectorCommand(java.lang.String name,
                               java.lang.String actionClass)
Constructor that accepts a command name and an action class type

Method Detail

show

protected void show(java.lang.Object o)
Creates the selector model and sets it on the selector. This is typically run when the selector dialog is initially displayed.

Overrides:
show in class BaseSelectorCommand

process

protected void process(java.lang.Object o)
Performs processing to update the selector model as the user makes selections in the user interface.

Overrides:
process in class BaseSelectorCommand

moveItemsToRole

protected void moveItemsToRole(java.util.List items,
                               com.sas.util.RoleInterface targetRole)

cancel

public void cancel(java.lang.Object o)
Cancel is called when the user clicks on the cancel button on the selector or another selector becomes active. Sets the selector visible property to false so the selector window gets closed.

Overrides:
cancel in class BaseSelectorCommand

commit

protected void commit(java.lang.Object o)
               throws java.io.IOException
Commits all changes made to the selector model to the viewer's business model. The items selected for each role are set as the result items on the BusinessQuery. If problems are enountered while updating the BusinessQuery, the error message describing the problem will be places on the EventInfo map for display by viewers listening for events, and all changes committed to the business model will be rolled back to the original state.

Overrides:
commit in class BaseSelectorCommand
Throws:
java.io.IOException
See Also:
BusinessQuery, BusinessModel

setUsageOnResultItems

protected void setUsageOnResultItems(java.util.List itemlist,
                                     java.lang.String querytype)
Sets the usage property of each data item in Itemlist to the value corresponding to the querytype key. The querytype key must be either DataItemSelectorInterface.DISPLAY_DETAIL_VALUES ("detail") or DataItemSelectorInterface.GROUP_BY_CATEGORY_VALUES ("group").
If querytype is...Item usage is...
detailDataItemActionType.USAGE_DETAIL
group AND item is a DataItemReferenceusage of item's baseDataItem
group AND item is not a DataItemReferenceDataItemActionType.USAGE_CATEGORY if supported
 otherwise, DataItemActionType.USAGE_AGGREGATE

Parameters:
itemlist - - the list of data items
querytype - - the query type key
See Also:
com.sas.dataselectors.dataitems.DataItemSelectorInferface, DataItem, DataItemActionType

createRoleProvider

public static DataItemSelectorModel createRoleProvider(com.sas.iquery.metadata.business.BusinessQuery query)
                                                throws com.sas.iquery.metadata.MetadataException
Creates the dataitem selector model from the BusinessQuery.

Parameters:
query - - the current business query
Returns:
- the dataitem selector model
Throws:
com.sas.iquery.metadata.MetadataException

isSupported

public boolean isSupported(ActionSupportFilter actionFilter)
Returns a boolean indicating whether the command is supported for the area specified on the ActionSupportFilter argument.

Specified by:
isSupported in interface CommandSupportedInterface
Parameters:
actionFilter - - the object that describes the current area.
Returns:
a boolean indicating whether the command is supported.
See Also:
BaseAction.setReturnStatus(int)

isMeasure

protected boolean isMeasure(java.lang.Object item)

setRole

public void setRole(java.lang.String role)
Sets the value for the current working role.

Parameters:
role - The current role

getRole

public java.lang.String getRole()
Returns the current working role

Returns:
The current role

setSelectedItems

public void setSelectedItems(java.lang.String[] items)
Sets the array of selected data items. This is set when the user is moving items from the available to selected tree.

Parameters:
items - The array of selected items

getSelectedItems

public java.lang.String[] getSelectedItems()
Returns the array of selected data items

Returns:
the array of selected items

setSelectedIndexes

public void setSelectedIndexes(java.lang.String[] indexes)

getSelectedIndexes

public java.lang.String[] getSelectedIndexes()

setUnselectedItems

public void setUnselectedItems(java.lang.String[] items)
Sets the array of unselected data items. This is set when the user is moving items from the selected to available tree.

Parameters:
items - The array of unselected items

getUnselectedItems

public java.lang.String[] getUnselectedItems()
Returns the array of unselected data items

Returns:
the array of selected items

setAction

public void setAction(java.lang.String actionstr)
Sets the user action string. The action string is a key used with the JSP query selector for remote javascripting, and indicates the user action from the selector.

Parameters:
actionstring - The user action

getAction

public java.lang.String getAction()
Returns the user action string. The action string is a key used with the JSP query selector for remote javascripting, and indicates the user action from the selector.

Returns:
action The user action

setData

public void setData(java.lang.String datastr)
Sets the data string associated with the user action. The data string is used with the JSP query selector for remote javascripting, and indicates the user data selection from the selector.

Parameters:
data - The user data string

getData

public java.lang.String getData()
Returns the user data string. The data string is used with the JSP query selector for remote javascripting, and indicates the user data selection from the selector.

Returns:
data The user data

setQueryType

public void setQueryType(java.lang.String queryType)
Sets the value for the query type for relational queries.

Parameters:
role - The query type

getQueryType

public java.lang.String getQueryType()
Returns the current query type

Returns:
The current query type

findRoleForItem

protected com.sas.util.RoleInterface findRoleForItem(java.lang.Object thisitem)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.