com.sas.dataselectors.dataitems
Class BaseDataItemSelectorModel

com.sas.dataselectors.dataitems.BaseDataItemSelectorModel
All Implemented Interfaces:
DataItemSelectorInterface, SelectorCommitInterface, SelectorProcessInterface, com.sas.util.RoleProviderInterface
Direct Known Subclasses:
DataItemSelectorModel

public abstract class BaseDataItemSelectorModel
implements DataItemSelectorInterface, SelectorProcessInterface, SelectorCommitInterface

This base class defines the common behaviors for the DataItem selector. This selector allows the user to assign data items to a set of specific roles (e.g. row, column). This class contains much of the common business logic, and it should be subclassed to provide behavior to a specific data source or API layer. It also implements the selector's process and commit interfaces so that it can take the place of the selector command model, allowing this selector to operate in a more consolidated manner outside of the ActionProvider framework.


Nested Class Summary
protected  class BaseDataItemSelectorModel.Role
          This inner class defines the functionality of a "role", which maintains a list of items associated with each role.
 
Field Summary
protected  java.util.Map _dataItemMap
           
protected  java.util.Locale _locale
           
protected  java.util.ArrayList _rolesList
           
protected  java.lang.String 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
           
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_TO_POSITION
          Remote scripting action key that indicates a set of items is being moved within a role to a specific position
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
protected  java.util.List originalItemList
           
protected  java.lang.String positionToMoveTo
           
static java.lang.String PROCESS_MODE
          The mode key for interacting with the selector
protected  java.lang.String queryType
           
static java.lang.String RB_KEY
           
protected  java.lang.String role
           
protected  java.lang.String[] selectedItems
           
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
           
static java.lang.String UPDATE_ITEMS
          Remote scripting action key that indicates an add or delete of a data item occurred
 
Fields inherited from interface com.sas.dataselectors.dataitems.DataItemSelectorInterface
DISPLAY_DETAIL_VALUES, GROUP_BY_CATEGORY_VALUES
 
Fields inherited from interface com.sas.dataselectors.SelectorCommitInterface
EXCEPTION_OCCURRED
 
Constructor Summary
BaseDataItemSelectorModel()
           
 
Method Summary
protected  void addItemToRole(java.lang.Object item, com.sas.util.RoleInterface role, java.util.List roleList, java.util.Map itemMap)
           
protected  void addResultItemsToQuery(com.sas.util.RoleInterface[] rolesUsed, java.lang.String queryType)
           
protected  int adjustMoveToPosition(java.util.List items, int positionIndex)
           
 boolean allQueryItemsAreDetailUsage()
          Indicates if all items selected for each role are set to detail usage.
 void cleanUp(java.lang.String mode)
          For each added role, removes from the business model all DataItemReference objects created during processing of the selector.
 java.util.Map commit()
          Used to commit the changes to the model.
protected  java.util.List createAddItemsList(java.util.Vector itemVector, java.util.Map itemmap)
           
 void deleteResultItemsFromQuery(com.sas.util.RoleInterface[] rolesUsed, java.util.Map oldResultItemsMap)
           
 void deleteSortCriteriaFromQuery()
           
protected  com.sas.util.RoleInterface findRoleForItem(java.lang.Object thisitem)
           
 java.lang.String getAction()
          Returns the user action string.
 java.util.List getAllAvailableNodeIds(boolean useOriginalIds)
          Returns a list of the ids for all items in the available list.
 java.util.List getAvailableEnabledNodeIds(java.lang.String selectedRole)
          Returns a list of the item ids for the items available for selection for the selected role.
 java.util.List getAvailableItemInfoList(java.lang.String selectedRole)
          Returns a list of DataItemTreeNodeInfo objects, representing the list of items available for the selected role.
protected  java.util.List getAvailableRoleItems(com.sas.util.RoleInterface role)
          Return the list of items available to add to the role
protected  javax.swing.tree.TreeModel getAvailableTreeModel(java.util.List allItems, java.util.List availableItems, com.sas.util.transforms.TransformInterface transform)
           
 javax.swing.tree.TreeModel getAvailableTreeModel(com.sas.util.transforms.TransformInterface transform, java.lang.String selectedRole)
          Creates a tree model representing the available items for the business model.
protected  java.lang.Object getBaseItem(java.lang.Object item)
           
 java.lang.String getBaseItemId(java.lang.String itemid)
          Returns the base item id of the DataItemReference in the stored dataItem map identified by itemid.
 java.lang.String getData()
          Returns the user data string.
 java.util.Map getDataItemMap()
          Returns the map of DataItems stored by their id
 java.util.List getDropTargetRoles()
          getMoveTargetRoles() is used for disabling a move menu based on current selections.
protected  java.lang.String getIdFromDataItemRefList(java.lang.String itemid)
          Searches through the dataitemreference lists looking for item with id itemid.
protected  java.lang.String getItemCategory(java.lang.Object item)
           
protected  java.lang.String getItemDefaultImage(java.lang.Object item)
           
protected  java.lang.String getItemDescription(java.lang.Object item)
           
protected  java.lang.String getItemDisabledImage(java.lang.Object item)
           
 java.lang.Object getItemFromItemMap(java.lang.String itemid)
          Returns the data item in the stored itemmap that corresponds to the itemid.
protected  java.lang.Object getItemFromReference(java.lang.Object object)
           
protected  java.lang.String getItemID(java.lang.Object item)
           
protected  java.lang.Object getItemInRolePosition(com.sas.util.RoleInterface role, int pos)
           
protected  java.lang.String getItemLabel(java.lang.Object item)
           
protected  int getItemPositionInRole(java.lang.Object item)
           
 java.util.Locale getLocale()
          Returns the locale object
 java.util.List getMoveTargetRoles()
          Returns a list of RoleInterface objects that the items contained in the selectedItems parameter can be moved to.
 java.lang.String getPositionToMoveTo()
          Returns the position index to move data items when dragging items from one role to another and putting in a specific position within target role.
 java.lang.Object getPropertiesBean()
           
 java.lang.String getQueryType()
          Returns the current query type
 java.lang.String getReason(java.lang.Object reason)
           
 java.util.List getReasonsQueryNotValid()
           
 java.lang.String getRole()
          Returns the current working role
protected  java.lang.String getRoleDetailedLabel(java.lang.String role)
           
abstract  java.util.List getRoleItems()
           
protected  java.lang.String getRoleLabel(java.lang.String role)
           
 com.sas.util.RoleInterface[] getRoles()
           
 java.util.List getSelectedItemInfoList(java.lang.String selectedRole)
          Returns a list of DataItemTreeNodeInfo objects, representing the list of items assigned to the selected role.
 java.lang.String[] getSelectedItems()
          Returns the array of selected data items
 javax.swing.tree.TreeModel getSelectedTreeModel(com.sas.util.transforms.TransformInterface transform, java.lang.String selectedRole)
          Creates a tree model representing the selected items for the business model.
protected  javax.swing.tree.TreeNode getSelectedTreeNode(com.sas.util.RoleInterface role, com.sas.util.transforms.TransformInterface transform, java.lang.String selectedRole)
           
 java.lang.String getStatusMessage()
          Checks for basic validity/completeness of the adapter and returns a status message indicating what is wrong with the adapter.
 java.lang.String[] getUnselectedItems()
          Returns the array of unselected data items
 boolean hasValidRoles()
           
protected  boolean isCalculatedItem(java.lang.Object item)
           
 boolean isCalculatedItemSelected()
          Indicates if a calculated item is selected for any of the assigned roles.
protected  boolean isDetailUsageSupported(java.lang.Object item)
           
protected  boolean isItemActionSupported(java.lang.Object item, java.lang.String queryType)
           
protected  boolean isItemAReference(java.lang.Object item)
           
protected  boolean isItemFirstInRole(java.lang.Object item)
           
protected  boolean isItemLastInRole(java.lang.Object item)
           
 boolean isItemMoveDownValid()
          Returns true if the items contained in the selectedItems parameter can be moved down in the model order.
 boolean isItemMoveUpValid()
          Returns true if the items contained in the selectedItems parameter can be moved up in the model order.
protected  boolean isItemUsageDetail(java.lang.Object item)
           
protected  boolean isMeasure(java.lang.Object object)
           
protected  boolean isQueryActionSupported()
           
 boolean isQueryValid()
           
 boolean isThisItemAReferenceInItemMap(java.lang.String itemid)
          Convenience method that indicates if the item in the stored dataitem map identified by the passed in id is a DataItemReference.
 boolean isThisItemInAvailableList(java.lang.String itemid, com.sas.util.RoleInterface role)
          Convenience method to determine if the data item identified by the passed in item id is available for selection for the indicated role.
 boolean isThisItemInRoleRefList(java.lang.String itemid, com.sas.util.RoleInterface role)
          Indicates if the item identified by the passed in item id is in the list of DataItemReferences created by addRoleItem for the indicated role.
 void mapDataSource()
          Creates a map of selected items with their item id as the key.
protected  void moveItemsToPosition(java.util.List items, int positionIndex)
          Moves the specified items to a new position within their existing role The positionIndex is the zero based index they would move to in the list of nodes as it currently exists.
protected  void moveItemsToRole(java.util.List items, com.sas.util.RoleInterface targetRole)
          Moves the specified items to the specified role.
protected  void moveItemsUpDown(java.util.List items, int offset)
          Moves the specified items up or down in their roles by the specified offset.
 java.util.Map process()
          Used to update the state of the model.
 boolean queryItemsSupportDetailUsage()
          Indicates if all items selected for each role support the detail usage.
protected  java.util.List removeDuplicateItems(java.util.List allItems)
          Convenience method to create a list of items such that each item in the list is unique.
protected  void removeItemFromRole(java.lang.Object item, java.util.List roleList, java.util.List refList)
           
protected  java.util.List removeItemsNotSupportingDetail(java.util.List items)
          Removes the items from the passed in list that do not support the detail usage.
protected  java.util.List removeNotUsableItems(java.util.List allDataItems)
          Convenience method that removes all items in the list that are not usable in the query for some reason.
 void rollBackQuery(java.util.Map itemMap)
           
 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 setDataItemMap(java.util.Map map)
           
protected  void setItemUsage(java.lang.Object item, java.lang.String queryType)
           
 void setLocale(java.util.Locale locale)
          Sets the locale object to ensure that all messages returned are properly translated.
protected  void setOriginalItemList(java.util.List allItems)
          Maintains a list of item IDs for the specified items.
 void setPositionToMoveTo(java.lang.String datastr)
          Sets the position index to move data items when dragging items from one role to another.
 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 setSelectedItems(java.lang.String[] items)
          Sets the array of selected data items.
 void setSelectedItemsQueryType(java.lang.String queryType)
          Sets the DataItem usage for each of the selected items.
 void setUnselectedItems(java.lang.String[] items)
          Sets the array of unselected data items.
protected  java.util.List sortItemListByRolePosition(java.util.List items)
          Sorts the specified list of items by their position in their role.
 

Field Detail

_rolesList

protected java.util.ArrayList _rolesList

_dataItemMap

protected java.util.Map _dataItemMap

_locale

protected java.util.Locale _locale

queryType

protected java.lang.String queryType

originalItemList

protected java.util.List originalItemList

action

protected java.lang.String action

data

protected java.lang.String data

positionToMoveTo

protected java.lang.String positionToMoveTo

role

protected java.lang.String role

selectedItems

protected java.lang.String[] selectedItems

unselectedItems

protected java.lang.String[] unselectedItems

RB_KEY

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

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

MOVE_ITEM_TO_POSITION

public static final java.lang.String MOVE_ITEM_TO_POSITION
Remote scripting action key that indicates a set of items is being moved within a role to a specific position

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

COMMIT

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

See Also:
Constant Field Values
Constructor Detail

BaseDataItemSelectorModel

public BaseDataItemSelectorModel()
Method Detail

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

setPositionToMoveTo

public void setPositionToMoveTo(java.lang.String datastr)
Sets the position index to move data items when dragging items from one role to another. This gets automatically popuplated via the remote scripting process (process action) from a hidden form field.

Parameters:
data - The user data string

getPositionToMoveTo

public java.lang.String getPositionToMoveTo()
Returns the position index to move data items when dragging items from one role to another and putting in a specific position within target role.

Returns:
data The user data

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.

Specified by:
setSelectedItems in interface DataItemSelectorInterface
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

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

getRoles

public com.sas.util.RoleInterface[] getRoles()
Specified by:
getRoles in interface com.sas.util.RoleProviderInterface

getRoleItems

public abstract java.util.List getRoleItems()
Specified by:
getRoleItems in interface com.sas.util.RoleProviderInterface

getAvailableTreeModel

public javax.swing.tree.TreeModel getAvailableTreeModel(com.sas.util.transforms.TransformInterface transform,
                                                        java.lang.String selectedRole)
Description copied from interface: DataItemSelectorInterface
Creates a tree model representing the available items for the business model. By default, the tree nodes are of type DefaultMutableTreeNode, but a transform can be passed in to transform the tree nodes to a different type.

Specified by:
getAvailableTreeModel in interface DataItemSelectorInterface
Parameters:
transform - - an optional transform object
selectedRole - - the currently selected role
Returns:
a TreeModel representing the available items

getAvailableEnabledNodeIds

public java.util.List getAvailableEnabledNodeIds(java.lang.String selectedRole)
Description copied from interface: DataItemSelectorInterface
Returns a list of the item ids for the items available for selection for the selected role.

Specified by:
getAvailableEnabledNodeIds in interface DataItemSelectorInterface
Parameters:
selectedRole - - the currently selected role
Returns:
the list of available item ids

getAllAvailableNodeIds

public java.util.List getAllAvailableNodeIds(boolean useOriginalIds)
Description copied from interface: DataItemSelectorInterface
Returns a list of the ids for all items in the available list. Some or all of these items may not be available for selection for the selected role.

Specified by:
getAllAvailableNodeIds in interface DataItemSelectorInterface
Returns:
the list of ids for the available list

getAvailableItemInfoList

public java.util.List getAvailableItemInfoList(java.lang.String selectedRole)
Description copied from interface: DataItemSelectorInterface
Returns a list of DataItemTreeNodeInfo objects, representing the list of items available for the selected role.

Specified by:
getAvailableItemInfoList in interface DataItemSelectorInterface
Returns:
items The list of available items
See Also:
DataItemTreeNodeInfo

getSelectedItemInfoList

public java.util.List getSelectedItemInfoList(java.lang.String selectedRole)
Description copied from interface: DataItemSelectorInterface
Returns a list of DataItemTreeNodeInfo objects, representing the list of items assigned to the selected role.

Specified by:
getSelectedItemInfoList in interface DataItemSelectorInterface
Parameters:
selectedRole - The role of interest
Returns:
The list of available items
See Also:
DataItemTreeNodeInfo

getSelectedTreeModel

public javax.swing.tree.TreeModel getSelectedTreeModel(com.sas.util.transforms.TransformInterface transform,
                                                       java.lang.String selectedRole)
Description copied from interface: DataItemSelectorInterface
Creates a tree model representing the selected items for the business model. By default, the tree nodes are of type DefaultMutableTreeNode, but a transform can be passed in to transform the tree nodes to a different type.

Specified by:
getSelectedTreeModel in interface DataItemSelectorInterface
Parameters:
transform - - an optional transform object
selectedRole - - the currently selected role
Returns:
a TreeModel representing the selected items

getDataItemMap

public java.util.Map getDataItemMap()
Description copied from interface: DataItemSelectorInterface
Returns the map of DataItems stored by their id

Specified by:
getDataItemMap in interface DataItemSelectorInterface
Returns:
the dataitem map

setDataItemMap

public void setDataItemMap(java.util.Map map)

hasValidRoles

public boolean hasValidRoles()

cleanUp

public void cleanUp(java.lang.String mode)
Description copied from interface: DataItemSelectorInterface
For each added role, removes from the business model all DataItemReference objects created during processing of the selector. This is typically done when the user cancels out of the selector to restore the business model to its original state.

Specified by:
cleanUp in interface DataItemSelectorInterface
Parameters:
mode - - an optional mode identifier (this can be null)

setLocale

public void setLocale(java.util.Locale locale)
Description copied from interface: DataItemSelectorInterface
Sets the locale object to ensure that all messages returned are properly translated.

Specified by:
setLocale in interface DataItemSelectorInterface
Parameters:
locale - - the locale object

getLocale

public java.util.Locale getLocale()
Description copied from interface: DataItemSelectorInterface
Returns the locale object

Specified by:
getLocale in interface DataItemSelectorInterface
Returns:
the locale

getItemFromItemMap

public java.lang.Object getItemFromItemMap(java.lang.String itemid)
Description copied from interface: DataItemSelectorInterface
Returns the data item in the stored itemmap that corresponds to the itemid. Returns null if the item is not found in the map.

Specified by:
getItemFromItemMap in interface DataItemSelectorInterface
Parameters:
itemid - - the id of the item to return
Returns:
the item in the map corresponding to the passed in item id

getBaseItemId

public java.lang.String getBaseItemId(java.lang.String itemid)
Description copied from interface: DataItemSelectorInterface
Returns the base item id of the DataItemReference in the stored dataItem map identified by itemid. Null will be returned if the item is not found in the map.

Specified by:
getBaseItemId in interface DataItemSelectorInterface
Parameters:
itemid - - the id of the DataItemReference to find in the map
Returns:
the id of the baseDataItem of the reference corresponding to the passed in item id

isThisItemAReferenceInItemMap

public boolean isThisItemAReferenceInItemMap(java.lang.String itemid)
Description copied from interface: DataItemSelectorInterface
Convenience method that indicates if the item in the stored dataitem map identified by the passed in id is a DataItemReference.

Specified by:
isThisItemAReferenceInItemMap in interface DataItemSelectorInterface
Parameters:
itemid - - the id of the item to search for in the dataitem map
Returns:
true if an item is in the dataitem map corresponding to the passed in id and the item is a DataItemReference, otherwise false

isThisItemInAvailableList

public boolean isThisItemInAvailableList(java.lang.String itemid,
                                         com.sas.util.RoleInterface role)
Description copied from interface: DataItemSelectorInterface
Convenience method to determine if the data item identified by the passed in item id is available for selection for the indicated role.

Specified by:
isThisItemInAvailableList in interface DataItemSelectorInterface
Parameters:
itemid - - the id of the item in the available list
role - - the role of interest
Returns:
true if the item was found in the available list, otherwise false

isThisItemInRoleRefList

public boolean isThisItemInRoleRefList(java.lang.String itemid,
                                       com.sas.util.RoleInterface role)
Description copied from interface: DataItemSelectorInterface
Indicates if the item identified by the passed in item id is in the list of DataItemReferences created by addRoleItem for the indicated role.

Specified by:
isThisItemInRoleRefList in interface DataItemSelectorInterface
Parameters:
itemid - - the id of the DataItem
role - - the role of interest
Returns:
true if the item is in the role available list, otherwise false

isCalculatedItemSelected

public boolean isCalculatedItemSelected()
Description copied from interface: DataItemSelectorInterface
Indicates if a calculated item is selected for any of the assigned roles.

Specified by:
isCalculatedItemSelected in interface DataItemSelectorInterface
Returns:
true if a calculated item is selected

queryItemsSupportDetailUsage

public boolean queryItemsSupportDetailUsage()
Description copied from interface: DataItemSelectorInterface
Indicates if all items selected for each role support the detail usage.

Specified by:
queryItemsSupportDetailUsage in interface DataItemSelectorInterface
Returns:
true if every selected item supports detail
See Also:
DataItemActionType

allQueryItemsAreDetailUsage

public boolean allQueryItemsAreDetailUsage()
Description copied from interface: DataItemSelectorInterface
Indicates if all items selected for each role are set to detail usage.

Specified by:
allQueryItemsAreDetailUsage in interface DataItemSelectorInterface
Returns:
true if every selected item is set to detail usage
See Also:
DataItemActionType

setSelectedItemsQueryType

public void setSelectedItemsQueryType(java.lang.String queryType)
Description copied from interface: DataItemSelectorInterface
Sets the DataItem usage for each of the selected items. If the queryType is "group", the usage for each dataitem is set to DataItemActionType.USAGE_CATEGORY. If the queryType is "detail", the usage for each dataitem is set to DataitemActionType.USAGE_DETAIL. This is only used for relational queries, and provides the functionality to create a detail query or a query that is grouped by certain data items.

Specified by:
setSelectedItemsQueryType in interface DataItemSelectorInterface
Parameters:
queryType - - The query type string. This should be "group" or "detail".
See Also:
DataItemActionType

setQueryType

public void setQueryType(java.lang.String queryType)
Description copied from interface: DataItemSelectorInterface
Sets the value for the query type for relational queries.

Specified by:
setQueryType in interface DataItemSelectorInterface

getQueryType

public java.lang.String getQueryType()
Description copied from interface: DataItemSelectorInterface
Returns the current query type

Specified by:
getQueryType in interface DataItemSelectorInterface
Returns:
The current query type

isItemMoveUpValid

public boolean isItemMoveUpValid()
Description copied from interface: DataItemSelectorInterface
Returns true if the items contained in the selectedItems parameter can be moved up in the model order.

Specified by:
isItemMoveUpValid in interface DataItemSelectorInterface
Returns:
True if items can move up, otherwise false

isItemMoveDownValid

public boolean isItemMoveDownValid()
Description copied from interface: DataItemSelectorInterface
Returns true if the items contained in the selectedItems parameter can be moved down in the model order.

Specified by:
isItemMoveDownValid in interface DataItemSelectorInterface
Returns:
True if items can move down, otherwise false

getStatusMessage

public java.lang.String getStatusMessage()
Description copied from interface: DataItemSelectorInterface
Checks for basic validity/completeness of the adapter and returns a status message indicating what is wrong with the adapter. If the adapter contains complete or valid data that can be applied to the model, a null string is returned.

Specified by:
getStatusMessage in interface DataItemSelectorInterface
Returns:
The adapter status message

getMoveTargetRoles

public java.util.List getMoveTargetRoles()
Description copied from interface: DataItemSelectorInterface
Returns a list of RoleInterface objects that the items contained in the selectedItems parameter can be moved to.

Specified by:
getMoveTargetRoles in interface DataItemSelectorInterface
Returns:
The list of roles the items can move to

getDropTargetRoles

public java.util.List getDropTargetRoles()
getMoveTargetRoles() is used for disabling a move menu based on current selections. getDropTargetRoles follows a similar purpose but is for roles that are valid drop targets for the selected items. The main difference between the two is that the role the selected items belong to will typically not be a valid move role as wrs wants that action grayed out (moving from role to the same role). However for dragging you want to be able to drag within the role the selected items belong to for positioning. WRS overrides both getMoveTargetRoles and getDropTargetRoles...


process

public java.util.Map process()
Description copied from interface: SelectorProcessInterface
Used to update the state of the model.

Specified by:
process in interface SelectorProcessInterface

getPropertiesBean

public java.lang.Object getPropertiesBean()
Specified by:
getPropertiesBean in interface SelectorCommitInterface

commit

public java.util.Map commit()
Description copied from interface: SelectorCommitInterface
Used to commit the changes to the model.

Specified by:
commit in interface SelectorCommitInterface

getAvailableTreeModel

protected javax.swing.tree.TreeModel getAvailableTreeModel(java.util.List allItems,
                                                           java.util.List availableItems,
                                                           com.sas.util.transforms.TransformInterface transform)

getSelectedTreeNode

protected javax.swing.tree.TreeNode getSelectedTreeNode(com.sas.util.RoleInterface role,
                                                        com.sas.util.transforms.TransformInterface transform,
                                                        java.lang.String selectedRole)

removeNotUsableItems

protected java.util.List removeNotUsableItems(java.util.List allDataItems)
Convenience method that removes all items in the list that are not usable in the query for some reason.

Parameters:
allDataItems - - a list of DataItems
Returns:
the list of usable items

removeDuplicateItems

protected java.util.List removeDuplicateItems(java.util.List allItems)
Convenience method to create a list of items such that each item in the list is unique.

Parameters:
allItems - - a list of items
Returns:
the list of unique items

removeItemsNotSupportingDetail

protected java.util.List removeItemsNotSupportingDetail(java.util.List items)
Removes the items from the passed in list that do not support the detail usage.

Parameters:
items - - a list of items
Returns:
the list of items supporting detail usage

setOriginalItemList

protected void setOriginalItemList(java.util.List allItems)
Maintains a list of item IDs for the specified items.


getItemID

protected java.lang.String getItemID(java.lang.Object item)

getItemLabel

protected java.lang.String getItemLabel(java.lang.Object item)

getItemDescription

protected java.lang.String getItemDescription(java.lang.Object item)

getItemCategory

protected java.lang.String getItemCategory(java.lang.Object item)

getItemDefaultImage

protected java.lang.String getItemDefaultImage(java.lang.Object item)

getItemDisabledImage

protected java.lang.String getItemDisabledImage(java.lang.Object item)

isCalculatedItem

protected boolean isCalculatedItem(java.lang.Object item)

isDetailUsageSupported

protected boolean isDetailUsageSupported(java.lang.Object item)

isItemUsageDetail

protected boolean isItemUsageDetail(java.lang.Object item)

isItemActionSupported

protected boolean isItemActionSupported(java.lang.Object item,
                                        java.lang.String queryType)

setItemUsage

protected void setItemUsage(java.lang.Object item,
                            java.lang.String queryType)

isItemAReference

protected boolean isItemAReference(java.lang.Object item)

getIdFromDataItemRefList

protected java.lang.String getIdFromDataItemRefList(java.lang.String itemid)
Searches through the dataitemreference lists looking for item with id itemid. If found, returns the baseitem id, otherwise returns original itemid.

Parameters:
itemid - - the id of the item to search for
Returns:
the id of the base item if the item was found, otherwise returns original item id

getBaseItem

protected java.lang.Object getBaseItem(java.lang.Object item)

mapDataSource

public void mapDataSource()
Creates a map of selected items with their item id as the key. For every selected reference item, the map also contains the baseItem with its id as the key.


getRoleLabel

protected java.lang.String getRoleLabel(java.lang.String role)

getRoleDetailedLabel

protected java.lang.String getRoleDetailedLabel(java.lang.String role)

getAvailableRoleItems

protected java.util.List getAvailableRoleItems(com.sas.util.RoleInterface role)
Return the list of items available to add to the role


addItemToRole

protected void addItemToRole(java.lang.Object item,
                             com.sas.util.RoleInterface role,
                             java.util.List roleList,
                             java.util.Map itemMap)

removeItemFromRole

protected void removeItemFromRole(java.lang.Object item,
                                  java.util.List roleList,
                                  java.util.List refList)

getReason

public java.lang.String getReason(java.lang.Object reason)

findRoleForItem

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

addResultItemsToQuery

protected void addResultItemsToQuery(com.sas.util.RoleInterface[] rolesUsed,
                                     java.lang.String queryType)
                              throws java.lang.Exception
Throws:
java.lang.Exception

deleteResultItemsFromQuery

public void deleteResultItemsFromQuery(com.sas.util.RoleInterface[] rolesUsed,
                                       java.util.Map oldResultItemsMap)

isQueryActionSupported

protected boolean isQueryActionSupported()

isMeasure

protected boolean isMeasure(java.lang.Object object)

getItemFromReference

protected java.lang.Object getItemFromReference(java.lang.Object object)

createAddItemsList

protected java.util.List createAddItemsList(java.util.Vector itemVector,
                                            java.util.Map itemmap)

isQueryValid

public boolean isQueryValid()

getReasonsQueryNotValid

public java.util.List getReasonsQueryNotValid()

rollBackQuery

public void rollBackQuery(java.util.Map itemMap)

deleteSortCriteriaFromQuery

public void deleteSortCriteriaFromQuery()

getItemPositionInRole

protected int getItemPositionInRole(java.lang.Object item)

getItemInRolePosition

protected java.lang.Object getItemInRolePosition(com.sas.util.RoleInterface role,
                                                 int pos)

isItemFirstInRole

protected boolean isItemFirstInRole(java.lang.Object item)

isItemLastInRole

protected boolean isItemLastInRole(java.lang.Object item)

moveItemsToRole

protected void moveItemsToRole(java.util.List items,
                               com.sas.util.RoleInterface targetRole)
Moves the specified items to the specified role. Subclasses can provide specific behavior (such as bumping) as required.

Parameters:
items - The items to move.
targetRole - The role to move items into.

adjustMoveToPosition

protected int adjustMoveToPosition(java.util.List items,
                                   int positionIndex)

moveItemsToPosition

protected void moveItemsToPosition(java.util.List items,
                                   int positionIndex)
Moves the specified items to a new position within their existing role The positionIndex is the zero based index they would move to in the list of nodes as it currently exists. In other words if you have items a,b,c,d and you are moving c to the end then the positionIndex would be 4. The distinction here is that the index is as if c was still also in the 2nd position as well. We adjust this position internally to take take into account selected items

Parameters:
items - The items to move.
offset - The integer position to move each item to.

moveItemsUpDown

protected void moveItemsUpDown(java.util.List items,
                               int offset)
Moves the specified items up or down in their roles by the specified offset.

Parameters:
items - The items to move.
offset - The integer offset to move each item (e.g. 1 or -1)

sortItemListByRolePosition

protected java.util.List sortItemListByRolePosition(java.util.List items)
Sorts the specified list of items by their position in their role. It's allowed for items to be in different roles. In that case, items with the same position will appear next to eachother in the returned list.

Parameters:
items - The items to be sorted
Returns:
The List of sorted items



Copyright © 2009 SAS Institute Inc. All Rights Reserved.