com.ca.commons.datamodel
Interface DataModelEditor

All Superinterfaces:
DataModelBuilder
All Known Implementing Classes:
DataModelEditorImpl

public interface DataModelEditor
extends DataModelBuilder

This class handles the composition of any number of model fragments into a single non-JAXB merged image of the model, and also handles writing out changes by splitting them back out into separate fragments.


Field Summary
 
Fields inherited from interface com.ca.commons.datamodel.DataModelBuilder
metadataMismatchLogger
 
Method Summary
 void mergeEditableFragment(DataModelSource readSource, DataModelWritableSource writeSource)
          Used to read in a fragment containing values which may be edited, in which case edits to values contained in the fragment will output to the provided writeSource when save() is called.
 DataModelValue newEnumValue(String dataTypeStr, String[] values, String defaultValue)
          Returns value initialized to parent enum def containing provided values, where dataTypeStr has a value of the form "ENUM:PARENT".
 DataModelValue newValue(String dataTypeStr, String defaultValue)
          Factory method that returns a value matching symbolic name like "STR", "FLEXI_STR:DN", "ENUM:DAYS_OF_WEEK", with optional defaultValue.
 void save()
          Called to save any changes made to one or more fragments read in using mergeEditableFragment(com.ca.commons.datamodel.DataModelSource, com.ca.commons.datamodel.DataModelWritableSource), where the changes are split back into the output fragments specified from the DataModelWritableSource matching the ones from which they were merged.
 void save(DataModelWritableSource writeSource)
          Write merged results to provided source, instead of splitting into multiple output fragments.
 
Methods inherited from interface com.ca.commons.datamodel.DataModelBuilder
getDataModel, mergeFragment
 

Method Detail

mergeEditableFragment

void mergeEditableFragment(DataModelSource readSource,
                           DataModelWritableSource writeSource)
                           throws IOException,
                                  javax.xml.bind.JAXBException
Used to read in a fragment containing values which may be edited, in which case edits to values contained in the fragment will output to the provided writeSource when save() is called.

Parameters:
readSource - Read-only source from which datamodel fragment should be read.
writeSource - Writable source which edits will be saved to by save().
Throws:
IOException - Problem getting, or processing, fragment.
javax.xml.bind.JAXBException

save

void save()
          throws IOException,
                 javax.xml.bind.JAXBException
Called to save any changes made to one or more fragments read in using mergeEditableFragment(com.ca.commons.datamodel.DataModelSource, com.ca.commons.datamodel.DataModelWritableSource), where the changes are split back into the output fragments specified from the DataModelWritableSource matching the ones from which they were merged.

Throws:
IOException
javax.xml.bind.JAXBException

save

void save(DataModelWritableSource writeSource)
          throws IOException,
                 javax.xml.bind.JAXBException
Write merged results to provided source, instead of splitting into multiple output fragments.

Throws:
IOException
javax.xml.bind.JAXBException

newValue

@NotNull
DataModelValue newValue(String dataTypeStr,
                                String defaultValue)
                        throws ParseException
Factory method that returns a value matching symbolic name like "STR", "FLEXI_STR:DN", "ENUM:DAYS_OF_WEEK", with optional defaultValue. Note that enum values will only be dummy stubs as no definition exists for the allowed values, use newEnumValue(String, String[], String) if values are known.

Throws:
ParseException - When provided args are illegal.

newEnumValue

@NotNull
DataModelValue newEnumValue(String dataTypeStr,
                                    String[] values,
                                    String defaultValue)
                            throws ParseException
Returns value initialized to parent enum def containing provided values, where dataTypeStr has a value of the form "ENUM:PARENT".

Throws:
ParseException


Created 2011-07-14 13:27 EST