// if parent is null we are back to the root object
// the last object that will hit the afterUnmarshal method
if (parent == null) {
SDOChangeSummary nextCS = null;
XMLUnmarshaller unmarshaller = ((SDOXMLHelper)aHelperContext.getXMLHelper()).getXmlContext().createUnmarshaller();
for (int i = 0; i < changeSummaries.size(); i++) {
nextCS = (SDOChangeSummary)changeSummaries.get(i);
// Set logging to true until finished building modified list.
boolean loggingValue = nextCS.isLoggingMapping();
nextCS.setLogging(true);
// CREATES
// For each xpath in the create attribute convert it to an sdo path and execute it against the root
// dataobject to get the dataobject being pointed to and set that dataobject to be created
List xpaths = nextCS.getCreatedXPaths();
String nextXPath = null;
SDODataObject nextCreatedDO = null;
for (int j = 0; j < xpaths.size(); j++) {
nextXPath = (String)xpaths.get(j);
String sdoPath = convertXPathToSDOPath(nextXPath);
nextCreatedDO = (SDODataObject)targetDataObject.getDataObject(sdoPath);
if(nextCreatedDO == null) {
int nextSlash = sdoPath.indexOf('/');
if(nextSlash != -1) {
sdoPath = sdoPath.substring(nextSlash + 1);
} else {
sdoPath = "/";
}
nextCreatedDO = (SDODataObject)targetDataObject.getDataObject(sdoPath);
}
if (nextCreatedDO != null) {
nextCreatedDO._setCreated(true);
nextCS.getOldContainers().remove(nextCreatedDO);
} else {
throw SDOException.errorProcessingXPath(nextXPath);
}
}
//clear the createxpaths list that was read in from XML
nextCS.setCreatedXPaths(null);
//MODIFIED
List modifiedDoms = nextCS.getModifiedDoms();
Element nextNode = null;
String refValue = null;
SDODataObject nextModifiedDO = null;
for (int j = 0; j < modifiedDoms.size(); j++) {
nextNode = (Element)modifiedDoms.get(j);
refValue = nextNode.getAttributeNS(SDOConstants.SDO_URL, SDOConstants.CHANGESUMMARY_REF);
if ((refValue == null) || (refValue.length() == 0)) {
throw SDOException.missingRefAttribute();
}
//nextModifiedDO is the real modified current data object
String sdoPath = convertXPathToSDOPath(refValue);
nextModifiedDO = (SDODataObject)targetDataObject.getDataObject(sdoPath);
//if it failed, try peeling off the first fragment (may be the root
if(nextModifiedDO == null) {
int nextSlash = sdoPath.indexOf('/');
if(nextSlash != -1) {
sdoPath = sdoPath.substring(nextSlash + 1);
} else {
sdoPath = "/";
}
nextModifiedDO = (SDODataObject)targetDataObject.getDataObject(sdoPath);
}
String unsetValue = nextNode.getAttributeNS(SDOConstants.SDO_URL, SDOConstants.CHANGESUMMARY_UNSET);
List unsetValueList = new ArrayList();
if ((unsetValue != null) && (unsetValue.length() > 0)) {
XMLConversionManager xmlConversionManager = ((SDOXMLHelper) aHelperContext.getXMLHelper()).getXmlConversionManager();
unsetValueList = (List)xmlConversionManager.convertObject(unsetValue, List.class);
}
if (nextModifiedDO != null) {
nextModifiedDO._setModified(true);
SDOCSUnmarshalListener listener = new SDOCSUnmarshalListener(((SDOType)nextModifiedDO.getType()).getHelperContext(), true);
unmarshaller.setUnmarshalListener(listener);
unmarshaller.getProperties().put("sdoHelperContext", aHelperContext);
unmarshaller.setUnmappedContentHandlerClass(SDOUnmappedContentHandler.class);
Object unmarshalledNode = unmarshaller.unmarshal(nextNode, ((SDOType)nextModifiedDO.getType()).getXmlDescriptor().getJavaClass());
//unmarshalledDO is the modified dataobject from the changesummary xml
DataObject unmarshalledDO = null;
// Assumption: unmarshalledNode should always be either an instance of XMLRoot or DataObject
if (unmarshalledNode instanceof XMLRoot) {
unmarshalledDO = (DataObject)((XMLRoot)unmarshalledNode).getObject();