com.highdeal.pnr.hci
Class PropertyDescriptionModel

java.lang.Object
  extended by com.highdeal.pnr.hci.PropertyDescriptionModel
All Implemented Interfaces:
XMLMarshallable

public class PropertyDescriptionModel
extends java.lang.Object
implements XMLMarshallable

This class represents the description of a property as seen by a client application. Each property description specifies a type, a name and a description for the property.

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="prop">
   <xs:complexType>
     <xs:sequence>
       <xs:element ref="additionalInformation" minOccurs="0" maxOccurs="unbounded"/>
     </xs:sequence>
     <xs:attribute name="name" type="xs:string" use="required"/>
     <xs:attribute name="type" type="PropertyDescType" default="string"/>
     <xs:attribute name="description" type="xs:string"/>
   </xs:complexType>
 </xs:element>

 <xs:simpleType name="PropertyDescType">
   <xs:restriction base="xs:string">
      <xs:enumeration value="number"/>
      <xs:enumeration value="string"/>
      <xs:enumeration value="date"/>
   </xs:restriction>
 </xs:simpleType>


Constructor Summary
PropertyDescriptionModel()
          Builds an empty PropertyDescriptionModel.
PropertyDescriptionModel(java.lang.String name, java.lang.String description, int type)
          Builds a PropertyDescriptionModel.
 
Method Summary
 void addCharacterData(java.lang.String cData)
          Adds character data to the content element.
 void addChild(java.lang.String name, XMLMarshallable child)
          Adds a child to the object, the child representing the marshallable object which must be added to the element.
 boolean checkValidity()
          Returns true if the property is valid.
 PropertyDescriptionModel duplicate()
          Duplicates the property.
 AdditionalInfoModel getAdditionalInfo(java.lang.String name)
          Returns an additional info depending on its name.
<T> T
getAdditionalInfo(java.lang.String name, java.lang.Class<T> clazz, T defaultValue)
          Returns an additional info value depending on its name and type.
 java.util.List<AdditionalInfoModel> getAdditionalInfos()
          Returns the additional info list.
 java.lang.String getDescription()
          Returns the textual description of the property.
 java.lang.String getName()
          Returns the name of the property.
 int getType()
          Returns the property type of the property description.
 void marshal(XMLOutputter output)
          Gives an XML representation of this object, including its children.
 void setAttributes(XMLAttributes atts)
          Sets the attributes of the XML representation of the element being processed.
 void setDescription(java.lang.String description)
          Sets the textual description for the property.
 void setName(java.lang.String name)
          Sets the name of the property.
 void setType(int t)
          Sets the property description type.
static boolean validatePropertyDescriptionModel(PropertyDescriptionModel pdm)
           
static boolean validatePropertyDescriptionModelType(PropertyDescriptionModel pdm)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyDescriptionModel

public PropertyDescriptionModel()
Builds an empty PropertyDescriptionModel.


PropertyDescriptionModel

public PropertyDescriptionModel(java.lang.String name,
                                java.lang.String description,
                                int type)
Builds a PropertyDescriptionModel.

Parameters:
name - the name of the property
description - a textual description for the property
type - the type of the property (see setType(int) for allowed values)
Method Detail

getName

public java.lang.String getName()
Returns the name of the property.

Returns:
the property name.

setName

public void setName(java.lang.String name)
Sets the name of the property.

Parameters:
name - the name of the property

getDescription

public java.lang.String getDescription()
Returns the textual description of the property.

Returns:
the description of the property.

setDescription

public void setDescription(java.lang.String description)
Sets the textual description for the property.

Parameters:
description - the associated textual description.

getType

public int getType()
Returns the property type of the property description. The returned types are:

Returns:
the property type.

setType

public void setType(int t)
Sets the property description type. The allowed types are:

Parameters:
t - the property type.

getAdditionalInfos

public java.util.List<AdditionalInfoModel> getAdditionalInfos()
Returns the additional info list.

Returns:
the additional info list.

getAdditionalInfo

public AdditionalInfoModel getAdditionalInfo(java.lang.String name)
Returns an additional info depending on its name.

Parameters:
name - The additional info name.
Returns:
The additional info or null if not found.

getAdditionalInfo

public <T> T getAdditionalInfo(java.lang.String name,
                               java.lang.Class<T> clazz,
                               T defaultValue)
Returns an additional info value depending on its name and type.

Parameters:
name - The additional info name.
clazz - The additional info type.
defaultValue - The default value if there is no matching additional info.
Returns:
the additional info value or the default value if not found.

duplicate

public PropertyDescriptionModel duplicate()
Duplicates the property.

Returns:
a clone of the property.

checkValidity

public boolean checkValidity()
Returns true if the property is valid. Property is valid if its name is not null or empty.

Returns:
true if the property is valid, false otherwise.

validatePropertyDescriptionModel

public static boolean validatePropertyDescriptionModel(PropertyDescriptionModel pdm)

validatePropertyDescriptionModelType

public static boolean validatePropertyDescriptionModelType(PropertyDescriptionModel pdm)

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

addChild

public void addChild(java.lang.String name,
                     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:
name - The name of tag for the child
child - The child to be added

addCharacterData

public void addCharacterData(java.lang.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

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

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)