de.init.its.spi
Class ItsElementManager

java.lang.Object
  extended by de.init.its.spi.ItsElementManager
All Implemented Interfaces:
IitsElementManager, java.io.Serializable

public class ItsElementManager
extends java.lang.Object
implements IitsElementManager

ITS DataCategory management class. Use this class for all ITS DC Modification Operations. The manager keeps a reference to a ItsDocument, and all available IitsTagElement(s). The internally used structure is tree-like and reflects the nesting of multiple tags inside an odt document file.

Author:
mkandora
See Also:
Serialized Form

Nested Class Summary
protected static class ItsElementManager.ItsTagElementIterator
          A generic ITS tag element iterator
 
Constructor Summary
protected ItsElementManager()
           
 
Method Summary
 void clearErrors()
          Clears all possible errors
 java.util.List<IitsTagElement> findAll()
           Returns all managed IitsTagElement
 java.util.List<IitsTagElement> findByAttribute(IitsAttribute attribute)
          returns all its tag elements, that match a certain ITS attribute
 java.util.List<IitsTagElement> findByAttributeName(java.lang.String attributeName)
          Returns all Its Tag Elements, that match a certain attribute name
 IitsTagElement findById(IitsId id)
          Returns an IitsTagElement with a given id
 IitsTagElement findById(java.lang.String id)
          Returns an IitsTagElement with a given id
 java.util.List<ItsError> getErrors()
          Returns a list of errors
 java.lang.String getIdReferenceAttributeName()
          Returns the internally used tag attribute name in ODT File to resolve ITS Tags
 ItsDocument getItsDocument()
          Returns the underlying Its Document
 IitsTagElement getItsElement(java.lang.String id)
          returns an ITS tag element with its id
static ItsElementManager getManager()
          Obtains a singleton instance of the its element manager
static ItsElementManager getManager(boolean init)
           
protected  java.lang.Integer getNextId()
          returns the next available id
 boolean hasErrors()
          Returns true, if there were error during its tag processing
 IitsTagElement insert(IitsId id, ItsAttributes dcname, java.lang.String dcvalue)
          Inserts an ITS Local Attribute into a document hierarchy using a parent element for nested data categories
 IitsTagElement insert(ItsAttributes attrib, java.lang.String... params)
          Inserts an ITS Local Attribute into a document hiearchy
 IitsTagElement insert(java.util.Map<ItsAttributes,java.util.List<java.lang.String>> values)
          Inserts a new IitsTagElement using the provided values
 IitsTagElement insert(java.lang.String dcname, java.lang.String dcvalue)
          Inserts an ITS Local Attribute into a document hierarchy
 IitsTagElement insert(java.lang.String id, java.lang.String dcname, java.lang.String dcvalue)
          Inserts an ITS Local Attribute into a document hierarchy using a parent element for nested data categories
 IitsTagElement remove(java.lang.String id)
          Removes an IitsTagElement.
 void reset()
          UNSAFE OP!
 void setIdReferenceAttributeName(java.lang.String name)
          Sets the default tag attribute name for ODT files to resolve ITS tags
 void setItsDocument(ItsDocument document)
          Sets the currently available ItsDocument
 void updateId(java.lang.String id)
          Updates the Id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItsElementManager

protected ItsElementManager()
Method Detail

getManager

public static ItsElementManager getManager()
Obtains a singleton instance of the its element manager

Returns:

getManager

public static ItsElementManager getManager(boolean init)

reset

public void reset()
Description copied from interface: IitsElementManager
UNSAFE OP! REMOVE

Specified by:
reset in interface IitsElementManager

updateId

public void updateId(java.lang.String id)
              throws java.lang.Exception
Description copied from interface: IitsElementManager
Updates the Id

Specified by:
updateId in interface IitsElementManager
Throws:
java.lang.Exception

getItsElement

public IitsTagElement getItsElement(java.lang.String id)
Description copied from interface: IitsElementManager
returns an ITS tag element with its id

Specified by:
getItsElement in interface IitsElementManager
Returns:

insert

public IitsTagElement insert(ItsAttributes attrib,
                             java.lang.String... params)
Description copied from interface: IitsElementManager
Inserts an ITS Local Attribute into a document hiearchy

Specified by:
insert in interface IitsElementManager
Parameters:
attrib - the ItsAttributes prefigured constant
params - ITS Attribute values

insert

public IitsTagElement insert(IitsId id,
                             ItsAttributes dcname,
                             java.lang.String dcvalue)
Description copied from interface: IitsElementManager
Inserts an ITS Local Attribute into a document hierarchy using a parent element for nested data categories

Specified by:
insert in interface IitsElementManager
Parameters:
id - the IitsId
dcname - the data category name
dcvalue - the data category value
Returns:
See Also:
IitsElementManager.insert(String, String, String)

insert

public IitsTagElement insert(java.lang.String id,
                             java.lang.String dcname,
                             java.lang.String dcvalue)
Description copied from interface: IitsElementManager
Inserts an ITS Local Attribute into a document hierarchy using a parent element for nested data categories

Specified by:
insert in interface IitsElementManager
Parameters:
id - the parent element id
dcname - the data category nane
dcvalue - the data category value
Returns:

insert

public IitsTagElement insert(java.lang.String dcname,
                             java.lang.String dcvalue)
Description copied from interface: IitsElementManager
Inserts an ITS Local Attribute into a document hierarchy

Specified by:
insert in interface IitsElementManager
Parameters:
dcname - the name of the data category to insert.
dcvalue - the value of the data category
Returns:
a new IitsTagElement

insert

public IitsTagElement insert(java.util.Map<ItsAttributes,java.util.List<java.lang.String>> values)
Description copied from interface: IitsElementManager
Inserts a new IitsTagElement using the provided values

Specified by:
insert in interface IitsElementManager
Parameters:
values - a mapping between ItsAttributes and a list of values
Returns:
the newly inserted IitsTagElement

remove

public IitsTagElement remove(java.lang.String id)
Description copied from interface: IitsElementManager
Removes an IitsTagElement. The element, if exsisting, will also be removed from the document tree, resulting all child elements moving one depth level higher to the next parent element

Specified by:
remove in interface IitsElementManager
Returns:
the removed IitsTagElement

findAll

public java.util.List<IitsTagElement> findAll()
Description copied from interface: IitsElementManager

Returns all managed IitsTagElement

Specified by:
findAll in interface IitsElementManager
Returns:

findByAttribute

public java.util.List<IitsTagElement> findByAttribute(IitsAttribute attribute)
Description copied from interface: IitsElementManager
returns all its tag elements, that match a certain ITS attribute

Specified by:
findByAttribute in interface IitsElementManager
Returns:

findByAttributeName

public java.util.List<IitsTagElement> findByAttributeName(java.lang.String attributeName)
Description copied from interface: IitsElementManager
Returns all Its Tag Elements, that match a certain attribute name

Specified by:
findByAttributeName in interface IitsElementManager
Returns:

findById

public IitsTagElement findById(java.lang.String id)
Description copied from interface: IitsElementManager
Returns an IitsTagElement with a given id

Specified by:
findById in interface IitsElementManager
Parameters:
id - the Identifier as String
Returns:
the IitsTagElement

findById

public IitsTagElement findById(IitsId id)
Description copied from interface: IitsElementManager
Returns an IitsTagElement with a given id

Specified by:
findById in interface IitsElementManager
Parameters:
id - the Identifier as IitsId
Returns:
an IitsTagElement

getIdReferenceAttributeName

public java.lang.String getIdReferenceAttributeName()
Description copied from interface: IitsElementManager
Returns the internally used tag attribute name in ODT File to resolve ITS Tags

Specified by:
getIdReferenceAttributeName in interface IitsElementManager
Returns:

setIdReferenceAttributeName

public void setIdReferenceAttributeName(java.lang.String name)
Description copied from interface: IitsElementManager
Sets the default tag attribute name for ODT files to resolve ITS tags

Specified by:
setIdReferenceAttributeName in interface IitsElementManager

getNextId

protected java.lang.Integer getNextId()
returns the next available id

Returns:
the next id as Integer

setItsDocument

public void setItsDocument(ItsDocument document)
Description copied from interface: IitsElementManager
Sets the currently available ItsDocument

Specified by:
setItsDocument in interface IitsElementManager
Parameters:
document - an ItsDocument

getItsDocument

public ItsDocument getItsDocument()
Description copied from interface: IitsElementManager
Returns the underlying Its Document

Specified by:
getItsDocument in interface IitsElementManager
Returns:
ItsDocument

getErrors

public java.util.List<ItsError> getErrors()
Description copied from interface: IitsElementManager
Returns a list of errors

Specified by:
getErrors in interface IitsElementManager
Returns:

hasErrors

public boolean hasErrors()
Description copied from interface: IitsElementManager
Returns true, if there were error during its tag processing

Specified by:
hasErrors in interface IitsElementManager
Returns:

clearErrors

public void clearErrors()
Description copied from interface: IitsElementManager
Clears all possible errors

Specified by:
clearErrors in interface IitsElementManager