com.ibm.di.connector.maximo.parsing
Class EntryConverter

java.lang.Object
  extended by com.ibm.di.connector.maximo.parsing.EntryConverter

public final class EntryConverter
extends java.lang.Object

This class consists exclusively of static methods that operate on or return Entry objects and DOM elements.

Since:
7.1
See Also:
Schema, SchemaElement

Constructor Summary
EntryConverter()
           
 
Method Summary
static void checkForOverridenUniqueKeys(SchemaElement rootMbo, Entry newEntry, Entry oldEntry, Log logger)
          Check if user has tried to change any unique keys
static void copyUniqueKeys(SchemaElement rootMbo, Entry newEntry, Entry oldEntry)
          Copies the attributes/values that compose the unique key of the specified MBO from oldEntry to newEntry.
static java.lang.String entryToXml(SchemaElement rootMbo, SchemaElement selectedMbo, Entry entry, boolean errorOnExcedentSize)
          Converts an Entry object into XML content.
static java.lang.String entryToXml(Schema schema, Entry entry, boolean errorOnExcedentSize, boolean checkUniqueKeys)
          This method converts a hierarchical Entry object into a valid XML representation.
static Entry searchCriteriaToEntry(SearchCriteria searchCriteria, Schema schema, boolean errorOnExcedentSize)
          Converts a SearchCriteria object into XML content.
static java.lang.String searchCriteriaToXml(SearchCriteria searchCriteria, SchemaElement rootMbo, boolean errorOnExcedentSize)
          Converts a SearchCriteria object into XML content.
static void setAttributeActions(Entry e)
          This method circles trough all attributes (except leafs) of a hierarchical entry and if some of the attributes has operation Add, Modify or Delete the proper Maximo action will be added as XML attribute.
static Entry xmlToEntry(SchemaElement rootMbo, SchemaElement selectedMbo, org.w3c.dom.Node xmlElement)
          Converts XML content into an Entry object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntryConverter

public EntryConverter()
Method Detail

copyUniqueKeys

public static void copyUniqueKeys(SchemaElement rootMbo,
                                  Entry newEntry,
                                  Entry oldEntry)
Copies the attributes/values that compose the unique key of the specified MBO from oldEntry to newEntry.

Parameters:
rootMbo - MBO specification
newEntry - entry target
oldEntry - entry source

checkForOverridenUniqueKeys

public static void checkForOverridenUniqueKeys(SchemaElement rootMbo,
                                               Entry newEntry,
                                               Entry oldEntry,
                                               Log logger)
Check if user has tried to change any unique keys

Parameters:
rootMbo - MBO specification
newEntry - entry target
oldEntry - entry source
logger - Log object used to log warnings

entryToXml

public static java.lang.String entryToXml(SchemaElement rootMbo,
                                          SchemaElement selectedMbo,
                                          Entry entry,
                                          boolean errorOnExcedentSize)
                                   throws MxConnSchemaException
Converts an Entry object into XML content.

Parameters:
rootMbo - root MBO definition
selectedMbo - schema element that defines the XML content
entry - entry to be converted
errorOnExcedentSize - indicates the behavior when a field's value exceeds the maximun length: true if an exception should be thrown, or false if the field's value should be truncated
Returns:
XML content as a String object
Throws:
MxConnSchemaException - if the specified entry does not comply to the schema definition

entryToXml

public static java.lang.String entryToXml(Schema schema,
                                          Entry entry,
                                          boolean errorOnExcedentSize,
                                          boolean checkUniqueKeys)
                                   throws MxConnSchemaException
This method converts a hierarchical Entry object into a valid XML representation.

Parameters:
schema - schema of the current object structure
entry -
errorOnExcedentSize - indicates the behavior when a field's value exceeds the maximun length: true if an exception should be thrown, or false if the field's value should be truncated
checkUniqueKeys - if true presence of unique keys will be checked
Returns:
XML representation of Entry object
Throws:
MxConnSchemaException - if a unique key is not provided
MxConnExcedentSizeException - if a string field contains value longer than the maximum allowed value for this field

searchCriteriaToXml

public static java.lang.String searchCriteriaToXml(SearchCriteria searchCriteria,
                                                   SchemaElement rootMbo,
                                                   boolean errorOnExcedentSize)
                                            throws MxConnSchemaException
Converts a SearchCriteria object into XML content.

Parameters:
searchCriteria - SearchCriteria to be converted
rootMbo - schema element that defines the XML content to which the specified criteria will be converted
errorOnExcedentSize - indicates the behavior when a field's value exceeds the maximun length: true if an exception should be thrown, or false if the field's value should be truncated
Returns:
XML content as a String object
Throws:
MxConnSchemaException - if criteria.getType() != SearchCriteria.SEARCH_AND
MxConnSchemaException - if criteria has any SearchCriteria.rscSearch with the match attribute different than SearchCriteria.EXACT and SearchCriteria.NOT_STRING

searchCriteriaToEntry

public static Entry searchCriteriaToEntry(SearchCriteria searchCriteria,
                                          Schema schema,
                                          boolean errorOnExcedentSize)
                                   throws MxConnSchemaException
Converts a SearchCriteria object into XML content.

Parameters:
searchCriteria - SearchCriteria to be converted
schema - schema of the current Object structure
errorOnExcedentSize - indicates the behavior when a field's value exceeds the maximun length: true if an exception should be thrown, or false if the field's value should be truncated
Returns:
entry representation of the link criteria
Throws:
MxConnSchemaException - if criteria type is different than AND

xmlToEntry

public static Entry xmlToEntry(SchemaElement rootMbo,
                               SchemaElement selectedMbo,
                               org.w3c.dom.Node xmlElement)
                        throws MxConnSchemaException
Converts XML content into an Entry object.

Parameters:
rootMbo - root MBO definition
selectedMbo - schema element that defines the XML content
xmlElement - XML element to be converted
Returns:
Entry object converted from XML content
Throws:
MxConnSchemaException - if the specified XML content does not comply to the schema definition

setAttributeActions

public static void setAttributeActions(Entry e)
This method circles trough all attributes (except leafs) of a hierarchical entry and if some of the attributes has operation Add, Modify or Delete the proper Maximo action will be added as XML attribute. Also all parents in the above hierarchy will be marked with "Change" action.

Parameters:
e - Entry object