public void setAttributeValue(UnmarshalRecord unmarshalRecord, Object value, DatabaseMapping mapping) { mapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), value); }
public void unmappedContent(UnmarshalRecord unmarshalRecord) { Setting parentSetting = currentSetting.getParent(); if(null == parentSetting) { ((SequencedObject)unmarshalRecord.getCurrentObject()).getSettings().remove(currentSetting); } currentSetting = parentSetting; }
public void setAttributeValue(UnmarshalRecord unmarshalRecord, Object value, DatabaseMapping mapping) { currentSetting.setMapping(mapping); currentSetting.setObject(unmarshalRecord.getCurrentObject()); currentSetting.setValue(value); }
public void characters(UnmarshalRecord unmarshalRecord) { if(null == currentSetting || null == currentSetting.getName()) { currentSetting = new Setting(null, XMLConstants.TEXT); ((SequencedObject) unmarshalRecord.getCurrentObject()).getSettings().add(currentSetting); }else if(!XMLConstants.TEXT.equals(currentSetting.getName())) { Setting parentSetting = currentSetting; currentSetting = new Setting(null, XMLConstants.TEXT); if(null != parentSetting) { parentSetting.addChild(currentSetting); } } }
public void addAttributeValue(UnmarshalRecord unmarshalRecord, ContainerValue containerValue, Object value, Object collection) { currentSetting.setMapping(containerValue.getMapping()); currentSetting.setObject(unmarshalRecord.getCurrentObject()); currentSetting.addValue(value, true, collection); }
public void attribute(UnmarshalRecord unmarshalRecord, String namespaceURI, String localName, String value) { unmarshalRecord.removeNullCapableValue(this); if(namespaceURI == null) { namespaceURI = XMLConstants.EMPTY_STRING; } SAXFragmentBuilder builder = unmarshalRecord.getFragmentBuilder(); Object attributeValue = builder.buildAttributeNode(namespaceURI, localName, value); xmlFragmentMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), attributeValue); }
public Object getObject() { if(object == null) { if(this.descriptor != null) { object = this.descriptor.wrapObjectInXMLRoot(this.rootRecord, this.unmarshaller.isResultAlwaysXMLRoot()); } else if(documentBuilder != null) { Node node = (Node)documentBuilder.getDocument().getDocumentElement(); XMLRoot root = new XMLRoot(); root.setLocalName(node.getLocalName()); root.setNamespaceURI(node.getNamespaceURI()); root.setObject(node); object = root; } else { if(rootRecord != null) { object = this.rootRecord.getCurrentObject(); } } } return this.object; }
@Override protected void processEmptyElement() throws SAXException { // Remove original startElement event as it has been precluded by the nodeValue call below getEvents().remove(0); // Prerequisite: We know that (nullPolicy.isNullRepresentedByEmptyNode() || nullPolicy.isNullRepresentedByXsiNil()) is true // Null: Set the object to null on the node value if we are empty with inrben=true nodeValue.setNullValue(getParent().getCurrentObject(), getParent().getSession()); executeEvents(getParent()); }
if (forceWrap || shouldWrapObject(unmarshalRecord.getCurrentObject(), elementNamespaceUri, elementLocalName, elementPrefix)) { XMLRoot xmlRoot = new XMLRoot(); xmlRoot.setLocalName(elementLocalName); xmlRoot.setNamespaceURI(elementNamespaceUri); xmlRoot.setObject(unmarshalRecord.getCurrentObject()); xmlRoot.setEncoding(unmarshalRecord.getEncoding()); xmlRoot.setVersion(unmarshalRecord.getVersion()); return xmlRoot; return unmarshalRecord.getCurrentObject();
Object srcObject = record.getCurrentObject(); Reference reference = resolver.getReference(this, srcObject);
public void startElement(UnmarshalRecord unmarshalRecord) { Setting parentSetting; if(null == currentSetting) { parentSetting = null; } else if(XMLConstants.TEXT.equals(currentSetting.getName())) { parentSetting = null; } else { parentSetting = currentSetting; } XPathFragment xPathFragment = unmarshalRecord.getXPathNode().getXPathFragment(); if(null != xPathFragment) { currentSetting = new Setting(xPathFragment.getNamespaceURI(), xPathFragment.getLocalName()); } else { currentSetting = new Setting(); } int levelIndex = unmarshalRecord.getLevelIndex(); if(0 == levelIndex) { } else if(1 == levelIndex) { ((SequencedObject) unmarshalRecord.getCurrentObject()).getSettings().add(currentSetting); } else { parentSetting.addChild(currentSetting); } }
public void endElement(XPathFragment xPathFragment, UnmarshalRecord unmarshalRecord) { unmarshalRecord.removeNullCapableValue(this); XPathFragment lastFrag = ((XMLField)xmlFragmentMapping.getField()).getLastXPathFragment(); SAXFragmentBuilder builder = unmarshalRecord.getFragmentBuilder(); if (lastFrag.nameIsText()) { Object attributeValue = builder.buildTextNode(unmarshalRecord.getStringBuffer().toString()); unmarshalRecord.resetStringBuffer(); xmlFragmentMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), attributeValue); } else if (!lastFrag.isAttribute()) { Object value = builder.getNodes().remove(builder.getNodes().size() -1); unmarshalRecord.setAttributeValue(value, xmlFragmentMapping); } }
Object srcObject = record.getCurrentObject();
public void attribute(UnmarshalRecord unmarshalRecord, String namespaceURI, String localName, String value) { unmarshalRecord.removeNullCapableValue(this); XMLField xmlField = (XMLField) xmlDirectMapping.getField(); Object realValue = xmlField.convertValueBasedOnSchemaType(value, (XMLConversionManager) unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager(), unmarshalRecord); // Perform operations on the object based on the null policy Object convertedValue = xmlDirectMapping.getAttributeValue(realValue, unmarshalRecord.getSession(), unmarshalRecord); xmlDirectMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), convertedValue); }
/** * Handle swaRef and inline attribute cases. */ public void attribute(UnmarshalRecord unmarshalRecord, String URI, String localName, String value) { unmarshalRecord.removeNullCapableValue(this); XMLField xmlField = (XMLField) xmlBinaryDataMapping.getField(); XPathFragment lastFragment = xmlField.getLastXPathFragment(); Object fieldValue = null; if (xmlBinaryDataMapping.isSwaRef()) { if (unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller() != null) { if (xmlBinaryDataMapping.getAttributeClassification() == XMLBinaryDataHelper.getXMLBinaryDataHelper().DATA_HANDLER) { fieldValue = unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsDataHandler(value); } else { fieldValue = unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsByteArray(value); } xmlBinaryDataMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(fieldValue, xmlBinaryDataMapping.getAttributeClassification(), unmarshalRecord.getSession())); } } else { // value should be base64 binary string fieldValue = ((XMLConversionManager) unmarshalRecord.getSession().getDatasourcePlatform().getConversionManager()).convertSchemaBase64ToByteArray(value); xmlBinaryDataMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(fieldValue, xmlBinaryDataMapping.getAttributeClassification(), unmarshalRecord.getSession())); } }
Object objectValue = unmarshalRecord.getChildRecord().getCurrentObject(); if (xmlCompositeCollectionMapping.hasConverter()) { Converter converter = xmlCompositeCollectionMapping.getConverter(); xmlCompositeCollectionMapping.getInverseReferenceMapping().getAttributeAccessor().setAttributeValueInObject(objectValue, unmarshalRecord.getCurrentObject()); } else { Object backpointerContainer = xmlCompositeCollectionMapping.getInverseReferenceMapping().getAttributeAccessor().getAttributeValueFromObject(objectValue); xmlCompositeCollectionMapping.getInverseReferenceMapping().getAttributeAccessor().setAttributeValueInObject(objectValue, backpointerContainer); xmlCompositeCollectionMapping.getInverseReferenceMapping().getContainerPolicy().addInto(unmarshalRecord.getCurrentObject(), backpointerContainer, unmarshalRecord.getSession());
currentDataObjects.push(unmarshalRecord.getCurrentObject()); depth++;
Object objectValue = unmarshalRecord.getChildRecord().getCurrentObject(); if(xmlAnyCollectionMapping.getConverter() != null) { objectValue = xmlAnyCollectionMapping.getConverter().convertDataValueToObjectValue(objectValue, unmarshalRecord.getSession(), unmarshalRecord.getUnmarshaller()); Object childObject = unmarshalRecord.getChildRecord().getCurrentObject();
UnmarshalRecord childRecord = unmarshalRecord.getChildRecord(); if (null != childRecord) { Object childObject = childRecord.getCurrentObject();
fieldValue = unmarshalRecord.getUnmarshaller().getAttachmentUnmarshaller().getAttachmentAsByteArray(value); xmlBinaryDataCollectionMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(fieldValue, xmlBinaryDataCollectionMapping.getAttributeClassification(), unmarshalRecord.getSession())); xmlBinaryDataCollectionMapping.setAttributeValueInObject(unmarshalRecord.getCurrentObject(), XMLBinaryDataHelper.getXMLBinaryDataHelper().convertObject(fieldValue, xmlBinaryDataCollectionMapping.getAttributeClassification(), unmarshalRecord.getSession()));