public class DataTemplate extends DataRecord implements Xmlizable
Constructor and Description |
---|
DataTemplate(org.w3c.dom.Element elem)
Instantiates a new data template from an XML element
|
DataTemplate(java.util.Set<FieldDesc<?>> fieldDescriptions)
Instantiates a new DataTemplate from a set of Field Description objects
|
DataTemplate(java.lang.String name,
java.util.Set<DataRecord> records)
Instantiates a new data template from a name and set of DataRecord
objects.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addFieldDesc(java.lang.String fieldName,
FieldDesc<?> desc)
Adds the field description to the internal tables.
|
void |
addNameKey(java.lang.String nameKey)
Add a name key for this template
|
DataRecord |
createDataRecord(org.w3c.dom.Element elem)
Creates a data record from the XML element.
|
FieldDesc<?> |
getFieldDescription(java.lang.String fieldName)
Gets the field description for a particular field name.
|
java.util.HashMap<java.lang.String,FieldDesc<?>> |
getFieldDescriptions()
Returns a defensive copy of the field descriptions.
|
java.lang.String |
getNameKey()
Get the name key.
|
java.util.List<java.lang.String> |
getNameKeyList()
Get the name key list.
|
java.lang.String |
getQuery()
Get the query string associated with this template
|
java.lang.String |
getRecordIdentifier()
Get the record identifier, which is used by some accessors to determine
what the records are.
|
void |
loadFromXml(org.w3c.dom.Element elem)
Load info from a DataTemplate element.
|
boolean |
matchesTemplate(DataRecord node)
Determines if a DataRecord matches this DataTemplate.
|
void |
mergeData(DataTemplate otherNode)
Merges the data from another DataRecord with this one.
|
void |
setEnumField(java.lang.String fieldName,
java.lang.String fieldValue)
Sets the value for a particular enumerated value field.
|
void |
setFloatField(java.lang.String fieldName,
double fieldValue)
Sets the value for a particular data field.
|
void |
setIntField(java.lang.String fieldName,
java.lang.Integer fieldValue)
Sets the value for a particular integer field.
|
void |
setLocationField(java.lang.String fieldName,
Location fieldValue)
Sets the value for a particular location field.
|
void |
setMeasureField(java.lang.String fieldName,
Measure fieldValue)
Sets the value for a particular measure field.
|
void |
setRecordIdentifier(java.lang.String recordIdentifier)
Set the record identifier, which is used by some accessors to determine
what the records are.
|
void |
setTextField(java.lang.String fieldName,
java.lang.String fieldValue)
Sets the value for a particular text field.
|
void |
setTimeField(java.lang.String fieldName,
TimeSpan fieldValue)
Sets the value for a particular time field.
|
org.w3c.dom.Element |
toXml(org.w3c.dom.Document doc)
Converts this DataRecordTemplate to an XML Element.
|
boolean |
validateFields(DataRecord record)
Validate fields against the specifications for this Data Template.
|
addEnumFieldValue, addIntFieldValue, addLocationFieldValue, addMeasureFieldValue, addTextFieldValue, addTimeFieldValue, getAllFieldNames, getEnumField, getEnumFieldNames, getEnumValues, getFieldAsString, getFieldType, getFloatField, getIntField, getIntFieldNames, getIntValues, getLink, getLocationField, getLocationFieldNames, getLocationValues, getMeasureField, getMeasureFieldNames, getMeasureValues, getName, getTextField, getTextFieldNames, getTextValues, getTimeField, getTimeFieldNames, getTimeValues, isMultiValued, mergeData, parseDataField, removeEnumFieldValue, removeField, removeIntFieldValue, removeLocationFieldValue, removeMeasureFieldValue, removeTextFieldValue, removeTimeFieldValue, setLink, setName, toString, writeFieldsToMap, writeFieldsToString
public DataTemplate(org.w3c.dom.Element elem)
elem
- the XML elementpublic DataTemplate(java.util.Set<FieldDesc<?>> fieldDescriptions)
fieldDescriptions
- the set of field descriptionspublic DataTemplate(java.lang.String name, java.util.Set<DataRecord> records)
name
- the template namerecords
- the set of recordsprotected void addFieldDesc(java.lang.String fieldName, FieldDesc<?> desc)
fieldName
- the field namedesc
- the field description objectpublic void addNameKey(java.lang.String nameKey)
nameKey
- the new name keypublic DataRecord createDataRecord(org.w3c.dom.Element elem)
elem
- the XML elementpublic FieldDesc<?> getFieldDescription(java.lang.String fieldName)
fieldName
- the field namepublic java.util.HashMap<java.lang.String,FieldDesc<?>> getFieldDescriptions()
public java.lang.String getNameKey()
public java.util.List<java.lang.String> getNameKeyList()
public java.lang.String getQuery()
public java.lang.String getRecordIdentifier()
public void loadFromXml(org.w3c.dom.Element elem)
loadFromXml
in interface Xmlizable
elem
- the elementpublic boolean matchesTemplate(DataRecord node)
node
- the DataRecord to checkpublic void mergeData(DataTemplate otherNode)
otherNode
- The other node to merge with this node.public void setEnumField(java.lang.String fieldName, java.lang.String fieldValue)
setEnumField
in class DataRecord
fieldName
- the name of the enumerated value fieldfieldValue
- the value of the enumerated value fieldpublic void setFloatField(java.lang.String fieldName, double fieldValue)
setFloatField
in class DataRecord
fieldName
- the name of the text fieldfieldValue
- the value of the text fieldpublic void setIntField(java.lang.String fieldName, java.lang.Integer fieldValue)
setIntField
in class DataRecord
fieldName
- the name of the integer fieldfieldValue
- the value of the integer fieldpublic void setLocationField(java.lang.String fieldName, Location fieldValue)
setLocationField
in class DataRecord
fieldName
- the name of the location fieldfieldValue
- the value of the location fieldpublic void setMeasureField(java.lang.String fieldName, Measure fieldValue)
setMeasureField
in class DataRecord
fieldName
- the name of the measure fieldfieldValue
- the value of the measure fieldpublic void setRecordIdentifier(java.lang.String recordIdentifier)
recordIdentifier
- the record identifierpublic void setTextField(java.lang.String fieldName, java.lang.String fieldValue)
setTextField
in class DataRecord
fieldName
- the name of the text fieldfieldValue
- the value of the text fieldpublic void setTimeField(java.lang.String fieldName, TimeSpan fieldValue)
setTimeField
in class DataRecord
fieldName
- the name of the time fieldfieldValue
- the value of the time fieldpublic org.w3c.dom.Element toXml(org.w3c.dom.Document doc)
public boolean validateFields(DataRecord record)
record
- the record to validate