com.highdeal.pnr.hci
Class CounterDescriptionModel

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

public class CounterDescriptionModel
extends java.lang.Object
implements XMLMarshallable

This class represents a counter description. A counter description has a name, an initial value and a mapping.

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="counterDescription">
   <xs:complexType>
     <xs:attribute name="name" type="xs:string" use="required"/>
     <xs:attribute name="description" type="xs:string"/>
     <xs:attribute name="initialValue" type="xs:decimal"/>
     <xs:attribute name="counterName" type="xs:string"/>
     <xs:attribute name="isTransient" type="xs:boolean" use="optional" default="false"/>
   </xs:complexType>
 </xs:element>


Field Summary
static java.lang.String TAG_NAME
          The value of that constant is the XML tag name of the counter description.
 
Constructor Summary
CounterDescriptionModel()
          Constructs an empty counter model.
CounterDescriptionModel(java.lang.String name, java.lang.String description, java.math.BigDecimal initialValue)
          Constructs a counter without the mapped counter name.
CounterDescriptionModel(java.lang.String name, java.lang.String description, java.math.BigDecimal initialValue, boolean isTransient)
          Constructs a counter without the mapped counter name.
CounterDescriptionModel(java.lang.String name, java.lang.String description, java.math.BigDecimal initialValue, java.lang.String counterName)
          Constructs a full counter.
CounterDescriptionModel(java.lang.String name, java.lang.String description, java.math.BigDecimal initialValue, java.lang.String counterName, boolean isTransient)
          Constructs a full counter.
 
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 counter is valid.
 java.lang.String getCounterName()
          Returns the mapped counter name.
 java.lang.String getDescription()
          Returns the description of the counter.
 java.math.BigDecimal getInitialValue()
          Returns the initial value of the counter.
 java.lang.String getName()
          Returns the name of the counter.
 boolean isTransient()
          Checks if counter is transient.
 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 setCounterName(java.lang.String counterName)
          Sets the mapped counter name.
 void setDescription(java.lang.String description)
          Sets the description of the counter.
 void setInitialValue(java.math.BigDecimal initialValue)
          Sets the initial value of the counter.
 void setName(java.lang.String name)
          Sets the name of the counter.
 void setTransient()
          Sets counter transient.
 java.lang.String validate(java.util.Vector<CounterDescriptionModel> sharedCounters, boolean link)
          Checks if this counter description is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG_NAME

public static final java.lang.String TAG_NAME
The value of that constant is the XML tag name of the counter description.

See Also:
Constant Field Values
Constructor Detail

CounterDescriptionModel

public CounterDescriptionModel()
Constructs an empty counter model.


CounterDescriptionModel

public CounterDescriptionModel(java.lang.String name,
                               java.lang.String description,
                               java.math.BigDecimal initialValue)
Constructs a counter without the mapped counter name.

Parameters:
name - the name of the counter.
description - the description of the counter.
initialValue - the initial value of the counter.

CounterDescriptionModel

public CounterDescriptionModel(java.lang.String name,
                               java.lang.String description,
                               java.math.BigDecimal initialValue,
                               boolean isTransient)
Constructs a counter without the mapped counter name.

Parameters:
name - the name of the counter.
description - the description of the counter.
initialValue - the initial value of the counter.
isTransient - counter is transient if true, persistent otherwise

CounterDescriptionModel

public CounterDescriptionModel(java.lang.String name,
                               java.lang.String description,
                               java.math.BigDecimal initialValue,
                               java.lang.String counterName)
Constructs a full counter.

Parameters:
name - the name of the counter.
description - the description of the counter.
initialValue - the initial value of the counter.
counterName - the name of the mapped counter.

CounterDescriptionModel

public CounterDescriptionModel(java.lang.String name,
                               java.lang.String description,
                               java.math.BigDecimal initialValue,
                               java.lang.String counterName,
                               boolean isTransient)
Constructs a full counter.

Parameters:
name - the name of the counter.
description - the description of the counter.
initialValue - the initial value of the counter.
counterName - the name of the mapped counter.
isTransient - counter is transient if true, persistent otherwise
Method Detail

getName

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

Returns:
the name of the counter.

setName

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

Parameters:
name - the name of the counter.

setDescription

public void setDescription(java.lang.String description)
Sets the description of the counter.

Parameters:
description - the description of the counter.
See Also:
getDescription()

getDescription

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

Returns:
the counter description.
See Also:
setDescription(String)

getInitialValue

public java.math.BigDecimal getInitialValue()
Returns the initial value of the counter.

Returns:
the initial value of the counter.

setInitialValue

public void setInitialValue(java.math.BigDecimal initialValue)
Sets the initial value of the counter.

Parameters:
initialValue - the initial value of the counter.

getCounterName

public java.lang.String getCounterName()
Returns the mapped counter name.

Returns:
the name of the mapped counter.

setCounterName

public void setCounterName(java.lang.String counterName)
Sets the mapped counter name.

Parameters:
counterName - the name of the mapped counter.

isTransient

public boolean isTransient()
Checks if counter is transient.

Returns:
true if counter is transient, false if counter is persistent

setTransient

public void setTransient()
Sets counter transient.


checkValidity

public boolean checkValidity()
Returns true if the counter is valid. Counter is valid if its name is not null or empty and if its current value is set to a non null value.

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

validate

public java.lang.String validate(java.util.Vector<CounterDescriptionModel> sharedCounters,
                                 boolean link)
Checks if this counter description is valid. A counter description that describes a counter is valid if: A counter description that describes a mapped counter is valid if:

Parameters:
sharedCounters - a list of CounterDescriptionModel that represents the available shared counters.
link - true if the counter described by this counter description maps a shared counters, false otherwise.
Returns:
null if the counter is valid, the string explanation otherwise.

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)