com.partnersoft.modules.inspection.data
Class InspectionScriptData

java.lang.Object
  extended by com.partnersoft.modules.inspection.data.InspectionScriptData
All Implemented Interfaces:
com.partnersoft.cog.Coggable

public class InspectionScriptData
extends java.lang.Object
implements com.partnersoft.cog.Coggable

Storage for Inspection module scripts. Stores relationships between map data types and the subtypes they should create.

Stores relationships between datatype fields and the inspection fields they should populate. This relies on the basis that a single datatype creates a single subtype. Therefore, a map of datatype names to a map of inspection field names to data type labels is all thats needed.

Author:
Rich Stepanski

Constructor Summary
InspectionScriptData()
           
InspectionScriptData(com.partnersoft.cog.CogNode node)
           
 
Method Summary
 void addDatatypeToSubtype(java.lang.String datatype, java.lang.String subtype)
          Sets up a subtype to be set when a given data type is selected.
 com.partnersoft.data.Naming<java.lang.String> getDatatypesToSubtypes()
           
 com.partnersoft.data.Naming<java.lang.String> getLabelsToFieldsForDatatype(java.lang.String datatype)
          Returns a map of inspection field names -> data item labels.
 boolean isDatatypeUsed(java.lang.String datatype)
           
 void removeDatatypeToSubtype(java.lang.String datatype)
           
 void removeLabelToFieldForDatatype(java.lang.String datatype, java.lang.String inspectionField)
          Removes a given inspection field from the copy script data.
 void setLabelToFieldForDatatype(java.lang.String datatype, java.lang.String inspectionField, java.lang.String dataLabel)
          Determines what inspection field should be populated with the data from a given dataLabel when the given data type is selected during an inspection creation.
 com.partnersoft.cog.CogNode toCogNode()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InspectionScriptData

public InspectionScriptData()

InspectionScriptData

public InspectionScriptData(com.partnersoft.cog.CogNode node)
Method Detail

addDatatypeToSubtype

public void addDatatypeToSubtype(java.lang.String datatype,
                                 java.lang.String subtype)
Sets up a subtype to be set when a given data type is selected. Note the relationship, a single datatype can only generate one kind of subtype. Where a single subtype could be generated from multiple datatypes.

Parameters:
datatype -
subtype -

isDatatypeUsed

public boolean isDatatypeUsed(java.lang.String datatype)

removeDatatypeToSubtype

public void removeDatatypeToSubtype(java.lang.String datatype)

getDatatypesToSubtypes

public com.partnersoft.data.Naming<java.lang.String> getDatatypesToSubtypes()

getLabelsToFieldsForDatatype

public com.partnersoft.data.Naming<java.lang.String> getLabelsToFieldsForDatatype(java.lang.String datatype)
Returns a map of inspection field names -> data item labels. Intention being the given label values should be copied into the given inspection fields on creation when datatype is selected.

Note the relationship - field names need to be maped to labels. This allows the same label to be copied into multiple fields, it would not make sense to copy multiple labels into a single field.

Parameters:
datatype - - data type for label->field mapping.
Returns:

setLabelToFieldForDatatype

public void setLabelToFieldForDatatype(java.lang.String datatype,
                                       java.lang.String inspectionField,
                                       java.lang.String dataLabel)
Determines what inspection field should be populated with the data from a given dataLabel when the given data type is selected during an inspection creation.

Parameters:
datatype -
dataLabel -
inspectionField -

removeLabelToFieldForDatatype

public void removeLabelToFieldForDatatype(java.lang.String datatype,
                                          java.lang.String inspectionField)
Removes a given inspection field from the copy script data. Resulting in it not being populated for a given datatype.

Parameters:
datatype -
inspectionField -

toCogNode

public com.partnersoft.cog.CogNode toCogNode()
Specified by:
toCogNode in interface com.partnersoft.cog.Coggable