Class ComponentProperty

java.lang.Object
com.highdeal.pnr.hci.ComponentProperty
All Implemented Interfaces:
XMLMarshallable

public class ComponentProperty extends Object implements XMLMarshallable
This Java class is a Helper class to marshal and unmarshal all the rating components.
See Also:

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:simpleType name="componentPropertyType">
   <xs:restriction base="xs:string">
      <xs:enumeration value="number"/>
      <xs:enumeration value="decimal"/>
      <xs:enumeration value="string"/>
      <xs:enumeration value="date"/>
      <xs:enumeration value="money"/>
      <xs:enumeration value="boolean"/>
   </xs:restriction>
 </xs:simpleType>
  <xs:element name="property">
   <xs:complexType>
    <xs:attribute name="name" type="xs:string"/>
    <xs:attribute name="type" type="componentPropertyType"/>
    <xs:attribute name="value" type="xs:string"/>
    <xs:attribute name="propertyNameValue" type="xs:boolean" default="false"/>
   </xs:complexType>
  </xs:element>

  • Field Details

    • TYPE_STRING

      public static final int TYPE_STRING
      Constant for property type string.
      See Also:
    • TYPE_NUMBER

      public static final int TYPE_NUMBER
      Constant for property type number.
      See Also:
    • TYPE_DATE

      public static final int TYPE_DATE
      Constant for property type date.
      See Also:
    • TYPE_MONEY

      public static final int TYPE_MONEY
      Constant for property type money.
      See Also:
    • TYPE_BOOLEAN

      public static final int TYPE_BOOLEAN
      Constant for property type boolean.
      See Also:
  • Constructor Details

    • ComponentProperty

      public ComponentProperty()
      Constructs an empty component property.
    • ComponentProperty

      public ComponentProperty(String name, int type, Object value, boolean isPropertyNameValue)
      Build the ComponentProperty from the given parameters.
  • Method Details

    • getName

      public String getName()
      Returns the name of the component property.
      Returns:
      The name of the component property
    • setName

      public void setName(String name)
      Set the component property name.
      Parameters:
      name - The new name of the component property
    • getStringValue

      public String getStringValue()
      Returns the value of the component property as a string.
      Returns:
      The value of the component property as a string
    • setStringValue

      public void setStringValue(String stringValue)
      Set the value of the component property with a string.
      Parameters:
      stringValue - The value to set up
    • getDecimalValue

      public BigDecimal getDecimalValue()
      Returns the value of the component property as a decimal.
      Returns:
      The value of the component property as a decimal
    • setDecimalValue

      public void setDecimalValue(BigDecimal decimalValue)
      Set the value of the component property with a decimal.
      Parameters:
      decimalValue - The value to set up
    • getDateValue

      public Date getDateValue()
      Returns the value of the component property as a date.
      Returns:
      The value of the component property as a date
    • setDateValue

      public void setDateValue(Date dateValue)
      Set the value f the component property with a date.
      Parameters:
      dateValue - The value to set up
    • getMoneyValue

      public Money getMoneyValue()
      Returns the value of the component property as a money.
      Returns:
      The value of the component property as a money
    • setMoneyValue

      public void setMoneyValue(Money moneyValue)
      Set the value of the component property with a money.
      Parameters:
      moneyValue - The value to set up
    • getAmount

      public BigDecimal getAmount()
      Returns the value of the component property as an amount.
      Returns:
      the amount
    • getBooleanValue

      public boolean getBooleanValue()
      Returns the value of the component property as a boolean.
      Returns:
      The value of the component property as a boolean
    • setBooleanValue

      public void setBooleanValue(boolean booleanValue)
      Set the value of the component property with a boolean.
      Parameters:
      booleanValue - The value to set up
    • getPropertyNameValue

      public String getPropertyNameValue()
      Returns the value of the component property as a property name.
      Returns:
      The value of the component property as a property name
    • setPropertyNameValue

      public void setPropertyNameValue(String propertyNameValue)
      Set the value of the component property with a property name.
      Parameters:
      propertyNameValue - The value to set up
    • getValue

      public Object getValue()
      Get the value of the component property as an object.
      Returns:
      The component property value
    • setValue

      public void setValue(Object value)
      Set the value of the component property with an object.
      Parameters:
      value - The value to set up
    • isPropertyNameValue

      public boolean isPropertyNameValue()
      Whether the property value is a property name
      Returns:
      Whether the property value is a property name
    • isPropertyNameValue

      public void isPropertyNameValue(boolean isPropertyNameValue)
      Set whether the component property is pointing to a property.
      Parameters:
      isPropertyNameValue - Whether the component property is pointing to a property
    • getType

      public int getType()
      Returns the type of the component property.
      Returns:
      The type of the component property
    • setType

      public void setType(int type)
      Set the component property type.
      Parameters:
      type - The type to set up
    • getHciType

      public static int getHciType(int componentPropertyType)
      Gets the HCI type which corresponds to a property type.
      Parameters:
      componentPropertyType - a property type
      Returns:
      the corresponding HCI type
    • getComponentPropertyType

      public static int getComponentPropertyType(int hciType)
      Gets the property type which corresponds to an HCI type.
      Parameters:
      hciType - an HCI type
      Returns:
      the corresponding property type
    • getHciType

      public int getHciType()
    • setAttributes

      public void setAttributes(XMLAttributes atts)
      Description copied from interface: XMLMarshallable
      Sets the attributes of the XML representation of the element being processed.
      Specified by:
      setAttributes in interface XMLMarshallable
      Parameters:
      atts - The XML attributes of the current element
    • addCharacterData

      public void addCharacterData(String cData)
      Description copied from interface: XMLMarshallable
      Adds character data to the content element.
      Specified by:
      addCharacterData in interface XMLMarshallable
      Parameters:
      cData - The character data to be added
    • addChild

      public void addChild(String tagName, XMLMarshallable child)
      Description copied from interface: XMLMarshallable
      Adds a child to the object, the child representing the marshallable object which must be added to the element.
      Specified by:
      addChild in interface XMLMarshallable
      Parameters:
      tagName - The name of tag for the child
      child - The child to be added
    • marshal

      public void marshal(XMLOutputter output, String fullName)
    • marshal

      public void marshal(XMLOutputter output)
      Description copied from interface: XMLMarshallable
      Gives an XML representation of this object, including its children.
      Specified by:
      marshal in interface XMLMarshallable
      Parameters:
      output - The XML output to marshal the object into
    • marshal

      public static void marshal(XMLOutputter output, String name, String value)
      Helper static method to marshall a component property of type string.
      Parameters:
      output - The XML outputter where the output has to go
      name - The name of the property
      value - The value of the property
    • marshal

      public static void marshal(XMLOutputter output, String name, Date value)
      Helper static method to marshall a component property of type date.
      Parameters:
      output - The XML outputter where the output has to go
      name - The name of the property
      value - The value of the property
    • marshal

      public static void marshal(XMLOutputter output, String name, BigDecimal value)
      Helper static method to marshall a component property of type decimal.
      Parameters:
      output - The XML outputter where the output has to go
      name - The name of the property
      value - The value of the property
    • marshal

      public static void marshal(XMLOutputter output, String name, Money value)
      Helper static method to marshall a component property of type money.
      Parameters:
      output - The XML outputter where the output has to go
      name - The name of the property
      value - The value of the property
    • marshal

      public static void marshal(XMLOutputter output, String name, boolean value)
      Helper static method to marshall a component property of type boolean.
      Parameters:
      output - The XML outputter where the output has to go
      name - The name of the property
      value - The value of the property
    • marshal

      public static void marshal(XMLOutputter output, String name, String value, int type)
      Helper static method to marshall a component property of any type with a value which is a name property.
      Parameters:
      output - The XML outputter where the output has to go
      name - The name of the property
      value - The value of the property (the property name to which the current property is pointing)
      type - The type of the property
    • translate

      @Deprecated public static String translate(String propertyName)
      Deprecated.
      Parameters:
      propertyName -
    • toProperty

      public Property toProperty() throws IllegalArgumentException
      Convert the ComponentProperty to a Property.
      Returns:
      The Property results from the conversion
      Throws:
      IllegalArgumentException - throws if the type of the ComponentProperty is not TYPE_DATE, TYPE_NUMBER neither TYPE_STRING