Class EntryConverter
- java.lang.Object
-
- com.ibm.di.connector.maximo.parsing.EntryConverter
-
public final class EntryConverter extends java.lang.ObjectThis class consists exclusively of static methods that operate on or returnEntryobjects 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 voidcheckForOverridenUniqueKeys(SchemaElement rootMbo, Entry newEntry, Entry oldEntry, Log logger)Check if user has tried to change any unique keysstatic voidcopyUniqueKeys(SchemaElement rootMbo, Entry newEntry, Entry oldEntry)Copies the attributes/values that compose the unique key of the specified MBO fromoldEntrytonewEntry.static java.lang.StringentryToXml(SchemaElement rootMbo, SchemaElement selectedMbo, Entry entry, boolean errorOnExcedentSize)Converts anEntryobject into XML content.static java.lang.StringentryToXml(Schema schema, Entry entry, boolean errorOnExcedentSize, boolean checkUniqueKeys)This method converts a hierarchicalEntryobject into a valid XML representation.static EntrysearchCriteriaToEntry(SearchCriteria searchCriteria, Schema schema, boolean errorOnExcedentSize)Converts aSearchCriteriaobject into XML content.static java.lang.StringsearchCriteriaToXml(SearchCriteria searchCriteria, SchemaElement rootMbo, boolean errorOnExcedentSize)Converts aSearchCriteriaobject into XML content.static voidsetAttributeActions(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 EntryxmlToEntry(SchemaElement rootMbo, SchemaElement selectedMbo, org.w3c.dom.Node xmlElement)Converts XML content into anEntryobject.
-
-
-
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 fromoldEntrytonewEntry.- 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 anEntryobject 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:trueif an exception should be thrown, orfalseif the field's value should be truncated- Returns:
- XML content as a
Stringobject - 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 hierarchicalEntryobject 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:trueif an exception should be thrown, orfalseif the field's value should be truncatedcheckUniqueKeys- iftruepresence 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 aSearchCriteriaobject into XML content.- Parameters:
searchCriteria-SearchCriteriato be convertedrootMbo- schema element that defines the XML content to which the specifiedcriteriawill be convertederrorOnExcedentSize- indicates the behavior when a field's value exceeds the maximun length:trueif an exception should be thrown, orfalseif the field's value should be truncated- Returns:
- XML content as a
Stringobject - Throws:
MxConnSchemaException- ifcriteria.getType() != SearchCriteria.SEARCH_ANDMxConnSchemaException- 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 aSearchCriteriaobject into XML content.- Parameters:
searchCriteria-SearchCriteriato be convertedschema- schema of the current Object structureerrorOnExcedentSize- indicates the behavior when a field's value exceeds the maximun length:trueif an exception should be thrown, orfalseif 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 anEntryobject.- Parameters:
rootMbo- root MBO definitionselectedMbo- schema element that defines the XML contentxmlElement- XML element to be converted- Returns:
Entryobject 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
-
-