com.alarmpoint.servicemanager
Class ServiceManagerIncident

java.lang.Object
  extended by com.alarmpoint.servicemanager.ServiceManagerIncident

public class ServiceManagerIncident
extends java.lang.Object

Represents all the information about a Service Manager incident record and keeps track of changes you want to make to that incident.

Author:
bneate

Constructor Summary
ServiceManagerIncident()
          Create a new empty ServiceManagerIncident object
ServiceManagerIncident(org.dom4j.Node root)
          Create a new ServiceManagerIncident object and initialize it with the values in root
 
Method Summary
 void addDynamicList(java.lang.String field, java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> values)
          Add a dynamic list for the specified field.
 void addFields(java.util.Map<java.lang.String,java.lang.Object> fields)
          Add all the specified fields to this incident if they do not already exist
 void addList(java.lang.String field, java.util.Collection<java.lang.String> list)
          Add a list of possible values for the field
 void addList(java.lang.String field, java.util.Map<java.lang.String,java.lang.String> list)
          Add a list of possible values and the associated display value for the field
 void addUpdate(java.lang.String field, java.lang.String value)
          Add a update value for the specified field
 void constructMap(org.dom4j.Node instance)
          Remove all existing fields and values from this incident then repopulate it with the values in instance
 java.util.Map<java.lang.String,java.lang.Object> constructUpdateInstance()
          Construct a list of fields that have been updated and their new values
 java.util.Collection<java.lang.String> getList(java.lang.String field)
          Return the list of possible values for the field
 java.util.List<java.lang.String> getListValue(java.lang.String field)
          Retrieve the current list of values for a list field
 java.util.List<java.lang.String> getListValue(java.lang.String field, boolean escape)
          Retrieve the current list of values for a list field
 java.util.Map<java.lang.String,java.lang.Object> getOriginalMap()
          Returns the a map of the original values for this incident
 java.util.Collection<java.lang.String> getPossibleValues(java.lang.String field)
          If the field specified has a list of values specified return it
 java.lang.String getTextValue(java.lang.String field)
          Retrieve the current value for a text field
 java.lang.String getTextValue(java.lang.String field, boolean escape)
          Retrieve the current value for a text field
 java.util.Map<java.lang.String,java.lang.String> getUpdateMap()
          Returns the a map of the updated values for this incident
 boolean isListField(java.lang.String field)
          Check if the specified field contains a list of values
 boolean isTextField(java.lang.String field)
          Check if the specified field contains a single of value
 void updateDynamicList(java.lang.String field, java.lang.String dependsOn)
          Update the list of possible values for the field depending on the specified value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceManagerIncident

public ServiceManagerIncident()
Create a new empty ServiceManagerIncident object


ServiceManagerIncident

public ServiceManagerIncident(org.dom4j.Node root)
Create a new ServiceManagerIncident object and initialize it with the values in root

Parameters:
root - A instance element containing the fields of a Service Manager incident
Method Detail

addFields

public void addFields(java.util.Map<java.lang.String,java.lang.Object> fields)
Add all the specified fields to this incident if they do not already exist

Parameters:
fields - The fields to add to this incident if they do not already exist

constructMap

public void constructMap(org.dom4j.Node instance)
Remove all existing fields and values from this incident then repopulate it with the values in instance

Parameters:
instance - A instance element containing the fields of a Service Manager incident

constructUpdateInstance

public java.util.Map<java.lang.String,java.lang.Object> constructUpdateInstance()
Construct a list of fields that have been updated and their new values

Returns:
A Map suitable to pass to the ServiceManagerScriptObject objects methods containing all the updates for this instance

isListField

public boolean isListField(java.lang.String field)
Check if the specified field contains a list of values

Parameters:
field - The field name
Returns:
true if the field is a list, false otherwise

getListValue

public java.util.List<java.lang.String> getListValue(java.lang.String field)
Retrieve the current list of values for a list field

Parameters:
field - The field name
Returns:
A list of values for that field

getListValue

public java.util.List<java.lang.String> getListValue(java.lang.String field,
                                                     boolean escape)
Retrieve the current list of values for a list field

Parameters:
field - The field name
escape - If the value returned should be escaped for xml/html
Returns:
A list of values for that field

isTextField

public boolean isTextField(java.lang.String field)
Check if the specified field contains a single of value

Parameters:
field - The field name
Returns:
true if the field is not a list field, false otherwise

getTextValue

public java.lang.String getTextValue(java.lang.String field)
Retrieve the current value for a text field

Parameters:
field - The field name
Returns:
The value of that field

getTextValue

public java.lang.String getTextValue(java.lang.String field,
                                     boolean escape)
Retrieve the current value for a text field

Parameters:
field - The field name
escape - If the value returned should be escaped for xml/html
Returns:
The value of that field

getPossibleValues

public java.util.Collection<java.lang.String> getPossibleValues(java.lang.String field)
If the field specified has a list of values specified return it

Parameters:
field - The field name
Returns:
A list of possible values for the field if available, null otherwise

addUpdate

public void addUpdate(java.lang.String field,
                      java.lang.String value)
Add a update value for the specified field

Parameters:
field - The field name
value - The updated value for the field

addList

public void addList(java.lang.String field,
                    java.util.Map<java.lang.String,java.lang.String> list)
Add a list of possible values and the associated display value for the field

Parameters:
field - The field name
list - A Map of real values to display values

addList

public void addList(java.lang.String field,
                    java.util.Collection<java.lang.String> list)
Add a list of possible values for the field

Parameters:
field - The field name
list - A Collection of possible values

getList

public java.util.Collection<java.lang.String> getList(java.lang.String field)
Return the list of possible values for the field

Parameters:
field - The field name
Returns:
A Collection of possible values

addDynamicList

public void addDynamicList(java.lang.String field,
                           java.util.Map<java.lang.String,java.util.Collection<java.lang.String>> values)
Add a dynamic list for the specified field. This list is used when calling the updateDynamicList method to generate a new list. The values Map key set should contain the possible values for the field this one depends on and the value should be a list of possible values for that dependant value.

Parameters:
field - The field name
values - A Map of dependant values to possible values

updateDynamicList

public void updateDynamicList(java.lang.String field,
                              java.lang.String dependsOn)
Update the list of possible values for the field depending on the specified value

Parameters:
field - The field name
dependsOn - The value of the field this field depends on

getOriginalMap

public java.util.Map<java.lang.String,java.lang.Object> getOriginalMap()
Returns the a map of the original values for this incident

Returns:
A Map of the original values

getUpdateMap

public java.util.Map<java.lang.String,java.lang.String> getUpdateMap()
Returns the a map of the updated values for this incident

Returns:
A Map of the original values