org.imixs.workflow
Class ItemCollection

java.lang.Object
  extended by org.imixs.workflow.ItemCollection
All Implemented Interfaces:
java.io.Serializable

public class ItemCollection
extends java.lang.Object
implements java.io.Serializable

This Class defines a ValueObject to be used to exchange Datastructures used by the org.imixs.workflow Framework. Every component of this framework should use this wrapper class to easy transport workflowrelevant data between the different workflow modules. ValueObjects, particular in J2EE Applications, have the advantage to improve perfomance of remote methode calls and also enables a flexibly datastructure. A ItemCollection contains various Items (attributes). Every Item exist of a Name and a Value. Internal every Value is stored inside a Vector Class. So it is also possible to store multivalueobjects. The ItemCollection wraps the java.util.Hashtable Class and implements the java.io.Serializable Interface, so the ValeOject can also be serialised inside a remote methode call.

Version:
1.0
Author:
Ralph Soika
See Also:
WorkflowManager, Serialized Form

Constructor Summary
ItemCollection()
          Creates a empty ItemCollection
ItemCollection(java.util.Map map)
          Creates a new ItemCollection and transfers all Objects of map as new values.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.util.Map getAllItems()
          returns all Items of the Collection as a Map
 java.util.Vector getItemValue(java.lang.String aName)
          returns the Value of a single Item inside the ItemCollection.
 boolean getItemValueBoolean(java.lang.String aName)
          Returns the boolean value of an item.
 java.util.Date getItemValueDate(java.lang.String aName)
          Returns the value of an item with a single Date value.
 double getItemValueDouble(java.lang.String aName)
          Returns the value of an item with a single numeric value.
 int getItemValueInteger(java.lang.String aName)
          Returns the value of an item with a single numeric value.
 java.lang.String getItemValueString(java.lang.String aName)
          Returns the value of an item with a single text value.
 boolean hasItem(java.lang.String aName)
          Indicates whether an item exists in the document.
 void removeItem(java.lang.String name)
          removes a attribute from the item collection
 void replaceAllItems(java.util.Map map)
          Replaces all items specified in the map with new items, which are assigned to the specified values inside the map
 void replaceItemValue(java.lang.String aName, java.lang.Object o)
          Replaces a item of the specified name with one new item, which is assigned the specified value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemCollection

public ItemCollection()
Creates a empty ItemCollection

Throws:
java.lang.Exception

ItemCollection

public ItemCollection(java.util.Map map)
               throws java.lang.Exception
Creates a new ItemCollection and transfers all Objects of map as new values.

Parameters:
map -
Throws:
java.lang.Exception
Method Detail

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

getItemValue

public java.util.Vector getItemValue(java.lang.String aName)
returns the Value of a single Item inside the ItemCollection. If the item has no value, this method returns an empty vector. If no item with the specified name exists, this method returns an empty vector. It does not throw an exception. The Itemname is not case sensetive. Use hasItem to verify the existence of an item.

Parameters:
aName - The name of an item.
Returns:
The value or values contained in the item. The data type of the value depends on the data type of the item.
Throws:
java.lang.Exception

getItemValueString

public java.lang.String getItemValueString(java.lang.String aName)
Returns the value of an item with a single text value. If the item has no value or the value is numeric or non text, this method returns an empty String. If no item with the specified name exists, this method returns an empty String. It does not throw an exception. If the item has multiple values, this method returns the first value. The Itemname is not case sensetive. Use hasItem to verify the existence of an item.

Parameters:
aName - The name of an item.
Returns:
The value of the item
Throws:
java.lang.Exception

getItemValueInteger

public int getItemValueInteger(java.lang.String aName)
Returns the value of an item with a single numeric value. If the item has no value or the value is no Integer, or empty, this method returns 0. If no item with the specified name exists, this method returns 0. It does not throw an exception. If the item has multiple values, this method returns the first value. This method throws a Exception if the stored Item has another item type The Itemname is not case sensetive. Use hasItem to verify the existence of an item.

Parameters:
aName -
Returns:
integer value
Throws:
java.lang.Exception

getItemValueDate

public java.util.Date getItemValueDate(java.lang.String aName)
Returns the value of an item with a single Date value. If the item has no value or the value is no Date, or empty, this method returns null. If no item with the specified name exists, this method returns null. It does not throw an exception. If the item has multiple values, this method returns the first value. This method throws a Exception if the stored Item has another item type The Itemname is not case sensetive. Use hasItem to verify the existence of an item.

Parameters:
aName -
Returns:
integer value
Throws:
java.lang.Exception

getItemValueDouble

public double getItemValueDouble(java.lang.String aName)
Returns the value of an item with a single numeric value. If the item has no value or the value is no Double, or empty, this method returns 0.0. If no item with the specified name exists, this method returns 0.0. It does not throw an exception. If the item has multiple values, this method returns the first value. The Itemname is not case sensetive. Use hasItem to verify the existence of an item.

Parameters:
aName -
Returns:
double value
Throws:
java.lang.Exception

getItemValueBoolean

public boolean getItemValueBoolean(java.lang.String aName)
Returns the boolean value of an item. If the item has no value or the value is no boolean, or empty, this method returns false. If no item with the specified name exists, this method returns false. It does not throw an exception. If the item has multiple values, this method returns the first value. This method throws a Exception if the stored Item has another item type. The Itemname is not case sensetive. Use hasItem to verify the existence of an item.

Parameters:
aName -
Returns:
boolean value
Throws:
java.lang.Exception

hasItem

public boolean hasItem(java.lang.String aName)
Indicates whether an item exists in the document.

Parameters:
aName - The name of an item.
Returns:
true if an item with name exists in the document, false if no item with name exists in the document
Throws:
java.lang.Exception

getAllItems

public java.util.Map getAllItems()
returns all Items of the Collection as a Map

Returns:
Map with all Items

replaceItemValue

public void replaceItemValue(java.lang.String aName,
                             java.lang.Object o)
                      throws java.lang.Exception
Replaces a item of the specified name with one new item, which is assigned the specified value. If the ItemCollection does not contain an item with the specified name, this method creates a new item and adds it to the ItemCollection. The Itemname is not case sensetive. Use hasItem to verify the existence of an item.

Parameters:
aName - The name of the item or items you want to replace.
o - 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.
Throws:
java.lang.Exception

replaceAllItems

public void replaceAllItems(java.util.Map map)
                     throws java.lang.Exception
Replaces all items specified in the map with new items, which are assigned to the specified values inside the map

Parameters:
map -
Throws:
java.lang.Exception

removeItem

public void removeItem(java.lang.String name)
removes a attribute from the item collection

Parameters:
name -


Copyright © 2006-2010 Imixs Software Solutions GmbH. All Rights Reserved.