Class EntryConverter
- java.lang.Object
-
- 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 returnEntry
objects and DOM elements.- Since:
- 7.1
- See Also:
Schema
,SchemaElement
-
-
Constructor Summary
Constructors Constructor Description EntryConverter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkForOverridenUniqueKeys(SchemaElement rootMbo, Entry newEntry, Entry oldEntry, Log logger)
Check if user has tried to change any unique keysstatic void
copyUniqueKeys(SchemaElement rootMbo, Entry newEntry, Entry oldEntry)
Copies the attributes/values that compose the unique key of the specified MBO fromoldEntry
tonewEntry
.static java.lang.String
entryToXml(SchemaElement rootMbo, SchemaElement selectedMbo, Entry entry, boolean errorOnExcedentSize)
Converts anEntry
object into XML content.static java.lang.String
entryToXml(Schema schema, Entry entry, boolean errorOnExcedentSize, boolean checkUniqueKeys)
This method converts a hierarchicalEntry
object into a valid XML representation.static Entry
searchCriteriaToEntry(SearchCriteria searchCriteria, Schema schema, boolean errorOnExcedentSize)
Converts aSearchCriteria
object into XML content.static java.lang.String
searchCriteriaToXml(SearchCriteria searchCriteria, SchemaElement rootMbo, boolean errorOnExcedentSize)
Converts aSearchCriteria
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 anEntry
object.
-
-
-
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 fromoldEntry
tonewEntry
.- Parameters:
rootMbo
- MBO specificationnewEntry
- entry targetoldEntry
- 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 specificationnewEntry
- entry targetoldEntry
- entry sourcelogger
- Log object used to log warnings
-
entryToXml
public static java.lang.String entryToXml(SchemaElement rootMbo, SchemaElement selectedMbo, Entry entry, boolean errorOnExcedentSize) throws MxConnSchemaException
Converts anEntry
object into XML content.- Parameters:
rootMbo
- root MBO definitionselectedMbo
- schema element that defines the XML contententry
- entry to be convertederrorOnExcedentSize
- indicates the behavior when a field's value exceeds the maximun length:true
if an exception should be thrown, orfalse
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 hierarchicalEntry
object into a valid XML representation.- Parameters:
schema
- schema of the current object structureentry
-errorOnExcedentSize
- indicates the behavior when a field's value exceeds the maximun length:true
if an exception should be thrown, orfalse
if the field's value should be truncatedcheckUniqueKeys
- iftrue
presence of unique keys will be checked- Returns:
- XML representation of Entry object
- Throws:
MxConnSchemaException
- if a unique key is not providedMxConnExcedentSizeException
- 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 aSearchCriteria
object into XML content.- Parameters:
searchCriteria
-SearchCriteria
to be convertedrootMbo
- schema element that defines the XML content to which the specifiedcriteria
will be convertederrorOnExcedentSize
- indicates the behavior when a field's value exceeds the maximun length:true
if an exception should be thrown, orfalse
if the field's value should be truncated- Returns:
- XML content as a
String
object - Throws:
MxConnSchemaException
- ifcriteria.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 aSearchCriteria
object into XML content.- Parameters:
searchCriteria
-SearchCriteria
to be convertedschema
- schema of the current Object structureerrorOnExcedentSize
- indicates the behavior when a field's value exceeds the maximun length:true
if an exception should be thrown, orfalse
if the field's value should be truncated- Returns:
- entry representation of the link criteria
- Throws:
MxConnSchemaException
- if criteria type is different thanAND
-
xmlToEntry
public static Entry xmlToEntry(SchemaElement rootMbo, SchemaElement selectedMbo, org.w3c.dom.Node xmlElement) throws MxConnSchemaException
Converts XML content into anEntry
object.- Parameters:
rootMbo
- root MBO definitionselectedMbo
- schema element that defines the XML contentxmlElement
- 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
-
-