com.ca.commons.datamodel.standard
Class DataModelEditorImpl

java.lang.Object
  extended by com.ca.commons.datamodel.standard.DataModelBuilderImpl
      extended by com.ca.commons.datamodel.standard.DataModelEditorImpl
All Implemented Interfaces:
DataModelBuilder, DataModelEditor

public final class DataModelEditorImpl
extends DataModelBuilderImpl
implements DataModelEditor

Extends DataModelBuilder to support saving of edited values by splitting them back out into separate fragments. The style of output supported is structured in the natural nested manner, rather then a number of definitions occurring under a namespace and referencing nested elements using "target" references.


Field Summary
 
Fields inherited from class com.ca.commons.datamodel.standard.DataModelBuilderImpl
dataModel, debugProp, editor, logger, sources
 
Fields inherited from interface com.ca.commons.datamodel.DataModelBuilder
metadataMismatchLogger
 
Constructor Summary
DataModelEditorImpl()
           
 
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 DataModelEditor.save() is called.
 DataModelValue newEnumValue(String parentEnum, String[] values, String defaultValue)
          Returns value initialized to entry matching defaultValue in parent enum def containing provided values.
 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.
protected  void notifyPropertyValueChange(com.ca.commons.datamodel.standard.DataModelPropertyImpl prop)
          Mark all containers above prop as "dirty" for saving.
 void save()
          Called to save any changes made to one or more fragments read in using DataModelEditor.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 class com.ca.commons.datamodel.standard.DataModelBuilderImpl
convertValueFromXML, getCurrentSource, getDataModel, getSources, isEditor, mergeFragment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ca.commons.datamodel.DataModelBuilder
getDataModel, mergeFragment
 

Constructor Detail

DataModelEditorImpl

public DataModelEditorImpl()
Method Detail

mergeEditableFragment

public void mergeEditableFragment(DataModelSource readSource,
                                  DataModelWritableSource writeSource)
                           throws IOException,
                                  javax.xml.bind.JAXBException
Description copied from interface: DataModelEditor
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 DataModelEditor.save() is called.

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

save

public void save()
          throws IOException,
                 javax.xml.bind.JAXBException
Description copied from interface: DataModelEditor
Called to save any changes made to one or more fragments read in using DataModelEditor.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.

Specified by:
save in interface DataModelEditor
Throws:
IOException
javax.xml.bind.JAXBException

save

public void save(DataModelWritableSource writeSource)
          throws IOException,
                 javax.xml.bind.JAXBException
Description copied from interface: DataModelEditor
Write merged results to provided source, instead of splitting into multiple output fragments.

Specified by:
save in interface DataModelEditor
Throws:
IOException
javax.xml.bind.JAXBException

newValue

@NotNull
public 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.

Specified by:
newValue in interface DataModelEditor
Throws:
ParseException - When provided args are illegal.

newEnumValue

@NotNull
public DataModelValue newEnumValue(String parentEnum,
                                           String[] values,
                                           String defaultValue)
                            throws ParseException
Returns value initialized to entry matching defaultValue in parent enum def containing provided values.

Specified by:
newEnumValue in interface DataModelEditor
Throws:
ParseException

notifyPropertyValueChange

protected void notifyPropertyValueChange(com.ca.commons.datamodel.standard.DataModelPropertyImpl prop)
                                  throws DataModelMismatchException
Mark all containers above prop as "dirty" for saving.

Overrides:
notifyPropertyValueChange in class DataModelBuilderImpl
Throws:
DataModelMismatchException


Created 2011-07-14 13:27 EST