Package com.highdeal.pnr.hci
Class TranslationTableModel
java.lang.Object
com.highdeal.pnr.hci.TranslationTableModel
- All Implemented Interfaces:
ITagNameProvider,XMLMarshallable,ICatalogObject
public class TranslationTableModel
extends Object
implements XMLMarshallable, ICatalogObject, ITagNameProvider
This
Java class represents a translation table as seen when it comes from the back-end database system.
The order of the rows in a translation table is very important and determines the output
result when searching in the translation table using any of the following criteria:
STARTS_WITH, ENDS_WITH,
or CONTAINS or IS_CONTAINED.
Ensure that any table that you create or modify are sorted in the correct order.
XML API for HCI
The XML APIs specify the following XSD fragment:
XSD Fragment
<xs:element name="translationTable">
<xs:complexType>
<xs:sequence>
<xs:element ref="inAttribute" minOccurs="0" maxOccurs="5"/>
<xs:element ref="outAttribute" minOccurs="0" maxOccurs="15"/>
<xs:element ref="tableInstance" minOccurs="0" maxOccurs="1"/>
<xs:element ref="tableInstanceChronology" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="description" type="xs:string"/>
<xs:attribute name="owner" type="xs:string" use="required"/>
<xs:attribute name="code" type="xs:string" use="required"/>
<xs:attribute name="reference" type="xs:string"/>
<xs:attribute name="useDates" type="xs:boolean" default="false" />
<xs:attribute name="disallowDuplicateInputs" type="xs:boolean" default="false" />
</xs:complexType>
</xs:element>
<xs:element name="tableInstanceChronology">
<xs:complexType>
<xs:sequence>
<xs:element ref="chronology" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intContains comparison operator.static final intEnds with comparison operator.static final intEquality comparison operator.static final intIs_contained comparison operator.static final intThe maximum input attribute count.static final intThe maximum output attribute count.static final intStarts with comparison operator.static final StringThe value of that constant is the XML tag name of the Translation Table. -
Constructor Summary
ConstructorsConstructorDescriptionBuilds an empty TranslationTableModel.TranslationTableModel(String code, String description) Builds a TranslationTableModel from a code and a description. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCharacterData(String cData) Adds character data to the content element.voidaddChild(String tagName, XMLMarshallable child) Adds a child to the object, thechildrepresenting the marshallable object which must be added to the element.voidaddInAttribute(InAttributeModel attribute) Adds an in attribute.voidaddOutAttribute(OutAttributeModel attribute) Adds an out attribute.booleanReturns true if the translation table is valid.getCode()Gets the code.Gets the description.booleanReturns true if the translation table disallows duplicate input attributes.Returns a map which keys and values are rows indexes.Gets the in attributes.Gets the instance.Gets the instance chronology.Gets the out attributes.getOwner()Gets the owner.Gets the reference.Gets the XML tag name of the HCI model.booleanReturns true if the translation table uses validity dates, false otherwise.voidmarshal(XMLOutputter output) Gives an XML representation of this object, including its children.voidremoveInAttribute(int index) Removes an in attribute.voidremoveOutAttribute(int index) Removes an out attribute.voidsetAttributes(XMLAttributes atts) Sets the attributes of the XML representation of the element being processed.voidSets the code.voidSets the description.voidsetDisallowDuplicateInputs(boolean disallow) Sets whether the translation table disallows duplicate input attributes.voidsetInAttributes(Vector<InAttributeModel> inAttributes) Sets the in attributes.voidSets the instance.voidsetOutAttributes(Vector<OutAttributeModel> outAttributes) Sets the out attributes.voidSets the owner.voidSets the reference.voidsetUseDates(boolean use) Sets whether the translation table use validity dates.
-
Field Details
-
TAG_NAME
The value of that constant is the XML tag name of the Translation Table.- See Also:
-
EQUALS
public static final int EQUALSEquality comparison operator.- See Also:
-
STARTS_WITH
public static final int STARTS_WITHStarts with comparison operator.- See Also:
-
ENDS_WITH
public static final int ENDS_WITHEnds with comparison operator.- See Also:
-
CONTAINS
public static final int CONTAINSContains comparison operator.- See Also:
-
IS_CONTAINED
public static final int IS_CONTAINEDIs_contained comparison operator.- See Also:
-
MAX_OUT_ATTRIBUTES
public static final int MAX_OUT_ATTRIBUTESThe maximum output attribute count.- See Also:
-
MAX_IN_ATTRIBUTES
public static final int MAX_IN_ATTRIBUTESThe maximum input attribute count.- See Also:
-
-
Constructor Details
-
TranslationTableModel
public TranslationTableModel()Builds an empty TranslationTableModel. -
TranslationTableModel
Builds a TranslationTableModel from a code and a description.- Parameters:
code- The codedescription- The description
-
-
Method Details
-
getReference
Gets the reference.- Returns:
- The reference
-
setReference
Sets the reference.- Parameters:
r- The reference
-
getInstance
Gets the instance.- Returns:
- The instance
-
setInstance
Sets the instance.- Parameters:
i- The instance
-
getCode
Gets the code.- Returns:
- The code
-
setCode
Sets the code.- Parameters:
c- The code
-
getDescription
Gets the description.- Returns:
- The description
-
setDescription
Sets the description.- Parameters:
d- The description
-
setInAttributes
Sets the in attributes.- Parameters:
inAttributes- A vector ofInAttributeModelrepresenting the in attributes
-
getInAttributes
Gets the in attributes.- Returns:
- A vector of
InAttributeModelrepresenting the in attributes
-
setOutAttributes
Sets the out attributes.- Parameters:
outAttributes- A vector ofOutAttributeModelrepresenting the out attributes
-
getOutAttributes
Gets the out attributes.- Returns:
- A vector of
OutAttributeModelrepresenting the out attributes
-
addInAttribute
Adds an in attribute.- Parameters:
attribute- The in attribute to add
-
removeInAttribute
public void removeInAttribute(int index) Removes an in attribute.- Parameters:
index- The index of the in attribute to remove
-
addOutAttribute
Adds an out attribute.- Parameters:
attribute- The out attribute to add
-
removeOutAttribute
public void removeOutAttribute(int index) Removes an out attribute.- Parameters:
index- The index of the out attribute to remove
-
getOwner
Gets the owner.- Specified by:
getOwnerin interfaceICatalogObject- Returns:
- The owner
-
setOwner
Sets the owner.- Parameters:
p- The owner
-
getInstanceChronology
Gets the instance chronology.- Returns:
- A instance chronology with
TranslationInstanceModelelements
-
getUseDates
public boolean getUseDates()Returns true if the translation table uses validity dates, false otherwise.- Returns:
- true if the translation table uses validity dates, false otherwise
-
setUseDates
public void setUseDates(boolean use) Sets whether the translation table use validity dates.- Parameters:
use- true if the translation table use validity dates, false otherwise
-
getDisallowDuplicateInputs
public boolean getDisallowDuplicateInputs()Returns true if the translation table disallows duplicate input attributes.Duplicate input attributes exist when two rows, which are valid during a common period of time, have same input attributes.
When duplicate input attributes are not allowed, then an exception is thrown by translation table creation or modification operations if such duplicate exists in the passed translation table.
- Returns:
- true if the translation table disallows duplicate input attributes
-
setDisallowDuplicateInputs
public void setDisallowDuplicateInputs(boolean disallow) Sets whether the translation table disallows duplicate input attributes.- Parameters:
disallow- Indicates whether the translation table must disallow duplicate input attributes- See Also:
-
checkValidity
public boolean checkValidity()Returns true if the translation table is valid.- Returns:
- true if the translation table is valid, false otherwise
-
getDuplicateInputsMap
Returns a map which keys and values are rows indexes. Each key refers to a row which has duplicate input attributes with respect to the row refered by the corresponding value.- Returns:
- A map of row indexes
- See Also:
-
getTagName
Description copied from interface:ITagNameProviderGets the XML tag name of the HCI model.- Specified by:
getTagNamein interfaceITagNameProvider- Returns:
- The XML tag name
-
setAttributes
Description copied from interface:XMLMarshallableSets the attributes of the XML representation of the element being processed.- Specified by:
setAttributesin interfaceXMLMarshallable- Parameters:
atts- TheXML attributesof the current element
-
addChild
Description copied from interface:XMLMarshallableAdds a child to the object, thechildrepresenting the marshallable object which must be added to the element.- Specified by:
addChildin interfaceXMLMarshallable- Parameters:
tagName- The name of tag for the childchild- The child to be added
-
addCharacterData
Description copied from interface:XMLMarshallableAdds character data to the content element.- Specified by:
addCharacterDatain interfaceXMLMarshallable- Parameters:
cData- The character data to be added
-
marshal
Description copied from interface:XMLMarshallableGives an XML representation of this object, including its children.- Specified by:
marshalin interfaceXMLMarshallable- Parameters:
output- TheXML outputto marshal the object into
-