CompoundAttribute
Class CompoundDate

java.lang.Object
  extended by com.wrq.vhi.script.api.AttributeEventHandler
      extended by CompoundAttribute.CompoundDate
All Implemented Interfaces:
com.wrq.vhi.script.api.EventHandler

public class CompoundDate
extends com.wrq.vhi.script.api.AttributeEventHandler

This example illustrates how to create one attribute (as viewed by the client application) from three host terminal attributes.

The model defines three attributes on the RecordDisplay entity which correspond to the month, day, and year. The client application wants to view the date as a single attribute. This event handler is attached to a new entity attribute.


Field Summary
static java.lang.String description
           
 
Fields inherited from interface com.wrq.vhi.script.api.EventHandler
DEFAULT_TIMEOUT
 
Constructor Summary
CompoundDate()
           
 
Method Summary
 java.lang.String readAttribute(com.wrq.vhi.script.api.ReadAttributeEvent event)
          Called by the Host Integrator server to read the attribute.
 void writeAttribute(com.wrq.vhi.script.api.WriteAttributeEvent event)
          Called by the Host Integrator server to write the attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

description

public static final java.lang.String description
See Also:
Constant Field Values
Constructor Detail

CompoundDate

public CompoundDate()
Method Detail

readAttribute

public java.lang.String readAttribute(com.wrq.vhi.script.api.ReadAttributeEvent event)
                               throws com.wrq.apptrieve.agent.ApptrieveException
Called by the Host Integrator server to read the attribute.

This attribute is a synthesis of three attributes: month, day, and year. The three underlying attributes are read and reformatted as "DD/MM/YYYY" so that the format matches what appears in the AcctHistory recordset.

Overrides:
readAttribute in class com.wrq.vhi.script.api.AttributeEventHandler
Parameters:
event - the event instance
Returns:
the attribute value
Throws:
com.wrq.apptrieve.agent.ApptrieveException

writeAttribute

public void writeAttribute(com.wrq.vhi.script.api.WriteAttributeEvent event)
                    throws com.wrq.apptrieve.agent.ApptrieveException
Called by the Host Integrator server to write the attribute.

This attribute is received from the client as a string "YYYY/MM/DD" and must be transformed into three separate attribute write operations. The event handler first ensures that the incoming value has the proper format and then does three attribute writes to set the new value.

Overrides:
writeAttribute in class com.wrq.vhi.script.api.AttributeEventHandler
Parameters:
event - the event instance
Throws:
com.wrq.apptrieve.agent.ApptrieveException