com.ibm.pim.selection
Interface StaticItemSelection

All Superinterfaces:
Selection, StaticSelection

public interface StaticItemSelection
extends StaticSelection

Interface representing a static item selection.
Static Item Selection represents a list of items. The list is created by the user, by adding items using addItem(Item)
or adding all items in a category using addCategory(Category).

Since:
6.0.0
See Also:
StaticSelection

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.ibm.pim.selection.Selection
Selection.Type
 
Field Summary
static java.lang.String copyright
           
 
Method Summary
 void addCategory(Category category)
          Adds a category to the selection.
 void addItem(Item item)
          Adds an item to the selection.
 Catalog getCatalog()
          Fetches the catalog with which this selection is associated
 PIMCollection<Category> getCategories()
          Fetches the categories present in the selection
 int getCategoryCount()
          Fetches the count of categories present in the selection
 Hierarchy getHierarchy()
          Fetches the hierarchy used with the selection
 PIMCollection<Item> getItems()
          Fetches the items in the selection
 void removeCategory(Category category)
          Removes the category from the selection if it is present in the selection.
 void removeItem(Item item)
          Removes the item from the selection if it is present in the selection.
 
Methods inherited from interface com.ibm.pim.selection.Selection
delete, getAccessControlGroup, getCount, getName, getType, save, setAccessControlGroup, setName
 

Field Detail

copyright

static final java.lang.String copyright
See Also:
Constant Field Values
Method Detail

addItem

void addItem(Item item)
Adds an item to the selection. Returns false if the item is already present in the selection else true.

Parameters:
item - The Item object to be added to the selection. The item has to belong to the catalog for which the selection was created, otherwise PIMInternalException will be thrown.
Throws:
PIMInternalException - If an internal error occurs
PIMAuthorizationException - If the user does not have the equivalent of Permission.SELECTION_EDIT_RULE
java.lang.IllegalArgumentException - If item is null
java.lang.IllegalStateException - If item has not been persisted.

removeItem

void removeItem(Item item)
Removes the item from the selection if it is present in the selection.

Parameters:
item - The item to be removed from the selection
Throws:
PIMInternalException - If an internal error occurs
PIMAuthorizationException - If the user does not have the equivalent of Permission.SELECTION_EDIT_RULE
java.lang.IllegalArgumentException - If item is null
java.lang.IllegalStateException - If item has not been persisted.

addCategory

void addCategory(Category category)
Adds a category to the selection. Adding a category to a static item selection adds all the items in that category to the selection. When getItems() is invoked on this selection, all items belonging to the category added shall be returned. The category must be a category of the hierarchy associated with this selection. Otherwise a PIMInternalException will be thrown.

Parameters:
category - The category to be added to the selection
Throws:
PIMInternalException - If an internal error occurs or when the category does not belong to the hierarchy associated with this selection.
PIMAuthorizationException - If the user does not have the equivalent of Permission.SELECTION_EDIT_RULE
java.lang.IllegalArgumentException - If category is null
java.lang.IllegalStateException - If category has not been persisted.

removeCategory

void removeCategory(Category category)
Removes the category from the selection if it is present in the selection. When a category is removed, all items belonging to that category are removed from the selection, except those items which were added to the selection using addItem().

Parameters:
category - The category to be removed from the selection
Throws:
PIMInternalException - If an internal error occurs
PIMAuthorizationException - If the user does not have the equivalent of Permission.SELECTION_EDIT_RULE
java.lang.IllegalArgumentException - If category is null
java.lang.IllegalStateException - If category has not been persisted.

getHierarchy

Hierarchy getHierarchy()
Fetches the hierarchy used with the selection

Returns:
The hierarchy object used with the selection
Throws:
PIMInternalException - If an internal error occurs
PIMAuthorizationException - If the user does not have the equivalent of Permission.HIERARCHY_LIST

getCategories

PIMCollection<Category> getCategories()
Fetches the categories present in the selection

Returns:
A PIMCollection of Category objects. The collection is empty if there are no categories defined for use with this selection.
Throws:
PIMInternalException - If an internal error occurs
PIMAuthorizationException - If the current user does not have the equivalent of Permission.SELECTION_EDIT_RULE AND (Permission.HIERARCHY_VIEW_HIERARCHY_NODES OR Permission.SELECTION_MEMBERS_VIEW_HIERARCHY_NODES)

getCategoryCount

int getCategoryCount()
Fetches the count of categories present in the selection

Returns:
the count of categories present in the selection
Throws:
PIMInternalException - If an internal error occurs
PIMAuthorizationException - If the current user does not have the equivalent of Permission.SELECTION_EDIT_RULE AND (Permission.HIERARCHY_VIEW_HIERARCHY_NODES OR Permission.SELECTION_MEMBERS_VIEW_HIERARCHY_NODES)

getItems

PIMCollection<Item> getItems()
Fetches the items in the selection

Returns:
A PIMCollection of items. The collection is empty if there are no items in this selection.
Throws:
PIMInternalException - If an internal error occurs
PIMAuthorizationException - If the current user does not have the equivalent of Permission.CATALOG_VIEW_ITEMS OR Permission.SELECTION_MEMBERS_VIEW_ITEMS

getCatalog

Catalog getCatalog()
Fetches the catalog with which this selection is associated

Returns:
A Catalog object
Throws:
PIMInternalException - If an internal error occurs
PIMAuthorizationException - If the user does not have the equivalent of Permission.CATALOG_LIST