public class ItemCollection extends Object implements Cloneable
A ItemCollection contains various Items (attributes). Every Item exist of a Name (String) and a list of values (List of Object). Internal every Value is stored inside a Vector Class. All values are stored internally in a Map containing key values pairs.
NOTE: An ItemCollection is not serializable and can not be stored into another ItemCollection. To serialize a ItemCollection use the XMLItemCollection. @see XMLItemCollectionAdapter.
WorkflowManager
Constructor and Description |
---|
ItemCollection()
Creates a new empty ItemCollection
|
ItemCollection(ItemCollection itemCol)
Creates a new ItemCollection and makes a deep copy from a given
ItemCollection
|
ItemCollection(Map<String,List<Object>> map)
Creates a new ItemCollection and makes a deep copy from a given value Map
|
Modifier and Type | Method and Description |
---|---|
void |
addFile(byte[] data,
String fileName,
String contentType)
Deprecated.
|
void |
addFileData(FileData filedata)
This method adds a fileData object to the ItemCollection.
|
ItemCollection |
appendItemValue(String itemName,
Object itemValue)
Appends a value to an existing item.
|
ItemCollection |
appendItemValueUnique(String itemName,
Object itemValue)
Appends a value to an existing item.
|
Object |
clone()
This method clones the current ItemCollection.
|
ItemCollection |
clone(List<String> itemNames)
This method clones the current ItemCollection with a subset of items.
|
void |
cloneItem(String itemName,
ItemCollection source)
This method makes a deep copy of a single item value from a given source
ItemCollection.
|
void |
copy(ItemCollection source)
Copies all items of a source ItemCollection.
|
static ItemCollection |
createByReference(Map<String,List<Object>> map)
Creates a new ItemCollection by a reference to a given value Map.
|
boolean |
equals(Object o)
This method compares the values of two item collections by comparing the hash
maps.
|
ItemCollection |
event(int eventID)
Set the event id for a workitem.
|
int |
getActivityID()
Deprecated.
|
Map<String,List<Object>> |
getAllItems()
returns all Items of the Collection as a Map
|
int |
getEventID() |
List<Object> |
getFile(String filename)
Deprecated.
|
List<FileData> |
getFileData()
Returns a list of all FileData objects.
|
FileData |
getFileData(String filename)
Returns a FileData object for an attached file.
|
List<String> |
getFileNames()
Returns a list of file names attached to the current workitem.
|
Map<String,List<Object>> |
getFiles()
Deprecated.
|
Map<String,?> |
getItem()
Returns an ItemAdapter for this instance.
|
Map<String,?> |
getItemList()
Returns an ItemListAdapter for this instance.
|
Map<String,?> |
getItemListArray()
Returns an ItemListArrayAdapter for this instance.
|
List<String> |
getItemNames()
Returns a sorted list of all item names stored in the current ItemCollection.
|
List |
getItemValue(String itemName)
Returns the value list for the specified Item.
|
<T> T |
getItemValue(String itemName,
Class<T> itemType)
Returns the resolved item value of the specified type.
|
boolean |
getItemValueBoolean(String itemName)
Returns the resolved Boolean value of the specified item.
|
Date |
getItemValueDate(String aName)
Returns the resolved Date value of the specified item.
|
double |
getItemValueDouble(String itemName)
Returns the resolved Double value of the specified item.
|
float |
getItemValueFloat(String itemName)
Returns the resolved Float value of the specified item.
|
int |
getItemValueInteger(String itemName)
Returns the resolved Integer value of the specified item.
|
<T> List<T> |
getItemValueList(String itemName,
Class<T> itemType)
Returns the resolved list of item values of the specified type.
|
LocalDate |
getItemValueLocalDate(String aName)
Returns the resolved LocalDate value of the specified item.
|
LocalDateTime |
getItemValueLocalDateTime(String aName)
Returns the resolved LocalDateTime value of the specified item.
|
long |
getItemValueLong(String itemName)
Returns the resolved Long value of the specified item.
|
String |
getItemValueString(String itemName)
Returns the resolved String value of the specified item.
|
String |
getModelVersion() |
int |
getProcessID()
Deprecated.
|
int |
getTaskID() |
String |
getType() |
String |
getUniqueID() |
String |
getWorkflowGroup() |
boolean |
hasItem(String aName)
Indicates whether an item exists in the document.
|
boolean |
isItemEmpty(String itemName)
Returns true if the given itemname does not exist or no value is assigned to.
|
boolean |
isItemValueDate(String aName)
Returns true if the value of an item is from type 'Date'
|
boolean |
isItemValueDouble(String aName)
Returns true if the value of an item with a single numeric value is from type
'Double'
|
boolean |
isItemValueFloat(String aName)
Returns true if the value of an item with a single numeric value is from type
'Float'
|
boolean |
isItemValueInteger(String aName)
Returns true if the value of an item with a single numeric value is from type
'Integer'
|
boolean |
isItemValueLong(String aName)
Returns true if the value of an item with a single numeric value is from type
'Long'
|
void |
mergeItems(Map<String,List<Object>> map)
Merges all items from a source map into the current instance.
|
ItemCollection |
model(String modelversion) |
void |
purgeItemValue(String itemName)
This method removes duplicates and null or empty values from an item list
|
void |
removeFile(String aFilename)
This method removes a single file attachment from the workitem
|
void |
removeItem(String name)
removes a attribute from the item collection
|
void |
replaceAllItems(Map<String,List<Object>> map)
Replaces all items specified in the map with new items, which are assigned to
the specified values inside the map.
|
void |
replaceItemValue(String itemName,
Object itemValue)
Replaces the value of an item.
|
void |
setActivityID(int activityID)
Deprecated.
|
void |
setAllItems(Map<String,List<Object>> aHash)
replaces the current map object.
|
void |
setEventID(int eventID)
set $eventID
|
ItemCollection |
setItemValue(String itemName,
Object itemValue)
Set the value of an item.
|
ItemCollection |
setItemValueUnique(String itemName,
Object itemValue)
Set the value of an item.
|
void |
setModelVersion(String modelversion)
set the $ModelVersion
|
void |
setTaskID(int taskID)
set $taskID
|
void |
setType(String type)
set type
|
void |
setWorkflowGroup(String group)
set the $ModelVersion
|
ItemCollection |
task(int taskID) |
ItemCollection |
workflowGroup(String group) |
public ItemCollection()
public ItemCollection(Map<String,List<Object>> map)
map
- - with item valuespublic ItemCollection(ItemCollection itemCol)
itemCol
- - ItemCollection with valuespublic static ItemCollection createByReference(Map<String,List<Object>> map)
map
- - reference with item valuespublic Object clone()
public ItemCollection clone(List<String> itemNames)
The list of itemNames can contain exact names or a regular expression.
A itemName can also be mapped into a new itemName by separating the target name with a | (e.g. name|parentName)
itemNames
- - list of items to be copied into the clonepublic void cloneItem(String itemName, ItemCollection source)
itemvalue
- public boolean equals(Object o)
public ItemCollection setItemValue(String itemName, Object itemValue)
Each item can contain a list of values (multivalue item). If a single value is provided the method creates a List with one single value (singlevalue item).
If the value is null the method will remove the item. This is equal to the method call removeItem()
If the ItemValue is not serializable the item will be removed.
itemName
- The name of the item or items you want to replace.itemValue
- The value of the new item. The data type of the item depends
upon the data type of value, and does not need to match the
data type of the old item.public ItemCollection setItemValueUnique(String itemName, Object itemValue)
Each item can contain a list of values (multivalue item). If a single value is provided the method creates a List with one single value (singlevalue item).
If the value is null the method will remove the item. This is equal to the method call removeItem()
If the ItemValue is not serializable the item will be removed.
This method ensures that all values are unique and null or empty values will be removed
itemName
- The name of the item or items you want to replace.itemValue
- The value of the new item. The data type of the item depends
upon the data type of value, and does not need to match the
data type of the old item.public ItemCollection appendItemValue(String itemName, Object itemValue)
If a value list is provided the method appends each single value.
If the value is null the method will remove the item. This is equal to the method call removeItem()
If the ItemValue is not serializable the item will be removed.
itemName
- The name of the item or items you want to replace.itemValue
- The value of the new item. The data type of the item depends
upon the data type of value, and does not need to match the
data type of the old item.public ItemCollection appendItemValueUnique(String itemName, Object itemValue)
If a value list is provided the method appends each single value.
If the value is null the method will remove the item. This is equal to the method call removeItem()
If the ItemValue is not serializable the item will be removed.
This method ensures that all values are unique and null or empty values will be removed
itemName
- The name of the item or items you want to replace.itemValue
- The value of the new item. The data type of the item depends
upon the data type of value, and does not need to match the
data type of the old item.public List getItemValue(String itemName)
setItemValue(String itemName, Object itemValue)
. To get a typed
value list, see the method getItemValue(itemName, itemType)
.
If the item does not exist or has no values, the method returns an empty List.
The ItemName is not case sensitive. Use hasItem to verify the existence of an item.
itemName
- The name of an item.public <T> T getItemValue(String itemName, Class<T> itemType)
If the item isn't present in the itemCollection the method returns null.
If the specified type is int, float, long, double, Integer, Float, Long or Double, the method returns 0 instead of null
If the item contains no value with the specified type, the method returns null. The ItemName is not case sensitive. Use hasItem to verify the existence of an item.
itemName
- The item Name.itemType
- The type into which the resolve item value should get
convertedpublic <T> List<T> getItemValueList(String itemName, Class<T> itemType)
If the item isn't present in the itemCollection the method returns an empty list.
The ItemName is not case sensitive. Use hasItem to verify the existence of an item.
itemName
- The item Name.itemType
- The type into which the resolved item values should get
convertedpublic void removeItem(String name)
name
- - item namepublic boolean hasItem(String aName)
aName
- - item namepublic boolean isItemEmpty(String itemName)
itemName
- - the item to be verifiedpublic boolean isItemValueInteger(String aName)
aName
- - item namepublic boolean isItemValueLong(String aName)
aName
- - item namepublic boolean isItemValueDouble(String aName)
aName
- - item namepublic boolean isItemValueFloat(String aName)
aName
- - item namepublic boolean isItemValueDate(String aName)
aName
- - item namepublic Map<String,List<Object>> getAllItems()
public void setAllItems(Map<String,List<Object>> aHash)
aHash
- public List<String> getItemNames()
public void replaceItemValue(String itemName, Object itemValue)
Each item can contain a list of values (multivalue item). If a single value is provided the method creates a List with one single value (singlevalue item).
If the value is null the method will remove the item. This is equal to the method call removeItem()
If the ItemValue is not serializable the item will be removed. This method is deprecated and should be replaced by the method setItemvValue.
itemName
- The name of the item or items you want to replace.itemValue
- The value of the new item. The data type of the item depends
upon the data type of value, and does not need to match the
data type of the old item.setItemValue.
public String getItemValueString(String itemName)
The ItemName is not case sensitive. Use hasItem to verify the existence of an item.
itemName
- The name of an item.public int getItemValueInteger(String itemName)
The ItemName is not case sensitive. Use hasItem to verify the existence of an item.
itemName
- The name of an item.public long getItemValueLong(String itemName)
The ItemName is not case sensitive. Use hasItem to verify the existence of an item.
itemName
- The name of an item.public Date getItemValueDate(String aName)
The ItemName is not case sensitive. Use hasItem to verify the existence of an item.
itemName
- The name of an item.public LocalDateTime getItemValueLocalDateTime(String aName)
Note: internally the ItemCollection store LocalDateTime values as Date objects!
If the item has no value or the value is not of the type Date, the method returns null. If the item has multiple values, this method returns the first value.
The ItemName is not case sensitive. Use hasItem to verify the existence of an item.
itemName
- The name of an item.public LocalDate getItemValueLocalDate(String aName)
Note: internally the ItemCollection store LocalDateTime values as Date objects!
If the item has no value or the value is not of the type Date, the method returns null. If the item has multiple values, this method returns the first value.
The ItemName is not case sensitive. Use hasItem to verify the existence of an item.
itemName
- The name of an item.public double getItemValueDouble(String itemName)
The ItemName is not case sensitive. Use hasItem to verify the existence of an item.
itemName
- The name of an item.public float getItemValueFloat(String itemName)
The ItemName is not case sensitive. Use hasItem to verify the existence of an item.
itemName
- The name of an item.public boolean getItemValueBoolean(String itemName)
The ItemName is not case sensitive. Use hasItem to verify the existence of an item.
itemName
- The name of an item.public void replaceAllItems(Map<String,List<Object>> map)
map
- deepCopyOfMap
public void copy(ItemCollection source)
The method makes a deep copy of the source map using serialization. This is to make sure, that no object reference is copied. Other wise for example embedded arrays are not cloned. This is also important for JPA to avoid changes of attached entity beans with references in the data of an ItemCollection.
map
- deepCopyOfMap
public void mergeItems(Map<String,List<Object>> map)
The method makes a deep copy of the source map using serialization. This is to make sure, that no object reference is copied. Other wise for example embedded arrays are not cloned. This is also important for JPA to avoid changes of attached entity beans with references in the data of an ItemCollection.
map
- deepCopyOfMap
public void purgeItemValue(String itemName)
itemName
- - item to be processedpublic void addFileData(FileData filedata)
filedata
- - a file data objectFileData
@Deprecated public void addFile(byte[] data, String fileName, String contentType)
data
- - byte array with file datafileName
- - name of the file attachmentcontentType
- - the contenttype (e.g. 'Text/HTML')@Deprecated public List<Object> getFile(String filename)
filename
- public FileData getFileData(String filename)
filename
- public List<FileData> getFileData()
FileData objects are stored in the attribute '$file'.
public void removeFile(String aFilename)
@Deprecated public Map<String,List<Object>> getFiles()
public List<String> getFileNames()
public Map<String,?> getItemList()
public Map<String,?> getItemListArray()
public String getType()
public void setType(String type)
type
- public int getTaskID()
public void setTaskID(int taskID)
taskID
- public ItemCollection task(int taskID)
public int getEventID()
public void setEventID(int eventID)
eventID
- public ItemCollection event(int eventID)
eventID
- public String getModelVersion()
public void setModelVersion(String modelversion)
public ItemCollection model(String modelversion)
public String getWorkflowGroup()
public void setWorkflowGroup(String group)
public ItemCollection workflowGroup(String group)
public String getUniqueID()
@Deprecated public int getProcessID()
@Deprecated public int getActivityID()
@Deprecated public void setActivityID(int activityID)
activityID
- Copyright © 2006–2022 Imixs Software Solutions GmbH. All rights reserved.