protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, AbstractRecord parentRow) { XMLDescriptor referenceDescriptor = (XMLDescriptor) session.getDescriptor(attributeValue.getClass()); if ((referenceDescriptor != null) && (referenceDescriptor.getDefaultRootElement() != null)) { XMLObjectBuilder objectBuilder = (XMLObjectBuilder) referenceDescriptor.getObjectBuilder(); return objectBuilder.buildRow(attributeValue, session, referenceDescriptor.buildField(referenceDescriptor.getDefaultRootElement()), (XMLRecord) parentRow); } return null; }
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, XMLDescriptor referenceDescriptor, AbstractRecord parentRow, DatabaseField field, Object originalObject, boolean wasXMLRoot) { if ((field == null) && (referenceDescriptor != null) && (referenceDescriptor.getDefaultRootElement() != null)) { field = referenceDescriptor.buildField(referenceDescriptor.getDefaultRootElement()); } if ((field != null) && (referenceDescriptor != null)) { ((XMLRecord) parentRow).setLeafElementType(referenceDescriptor.getDefaultRootElementType()); XMLObjectBuilder objectBuilder = (XMLObjectBuilder) referenceDescriptor.getObjectBuilder(); boolean addXsiType = shouldAddXsiType(((XMLRecord) parentRow).getMarshaller(), referenceDescriptor, originalObject, wasXMLRoot); XMLRecord child = (XMLRecord) objectBuilder.createRecordFor(attributeValue, (XMLField) field, (XMLRecord) parentRow, this); child.setNamespaceResolver(((XMLRecord) parentRow).getNamespaceResolver()); objectBuilder.buildIntoNestedRow(child, attributeValue, session, addXsiType); return child; } return null; }
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, XMLDescriptor referenceDescriptor, AbstractRecord parentRow, DatabaseField field, Object originalObject, boolean wasXMLRoot) { if ((field == null) && (referenceDescriptor != null) && (referenceDescriptor.getDefaultRootElement() != null)) { field = referenceDescriptor.buildField(referenceDescriptor.getDefaultRootElement()); } if ((field != null) && (referenceDescriptor != null)) { ((XMLRecord) parentRow).setLeafElementType(referenceDescriptor.getDefaultRootElementType()); XMLObjectBuilder objectBuilder = (XMLObjectBuilder) referenceDescriptor.getObjectBuilder(); boolean addXsiType = shouldAddXsiType(((XMLRecord) parentRow).getMarshaller(), referenceDescriptor, originalObject, wasXMLRoot); XMLRecord child = (XMLRecord) objectBuilder.createRecordFor(attributeValue, (XMLField) field, (XMLRecord) parentRow, this); child.setNamespaceResolver(((XMLRecord) parentRow).getNamespaceResolver()); objectBuilder.buildIntoNestedRow(child, attributeValue, session, addXsiType); return child; } return null; }
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, AbstractRecord parentRow) { XMLDescriptor referenceDescriptor = (XMLDescriptor) session.getDescriptor(attributeValue.getClass()); if ((referenceDescriptor != null) && (referenceDescriptor.getDefaultRootElement() != null)) { XMLObjectBuilder objectBuilder = (XMLObjectBuilder) referenceDescriptor.getObjectBuilder(); return objectBuilder.buildRow(attributeValue, session, referenceDescriptor.buildField(referenceDescriptor.getDefaultRootElement()), (XMLRecord) parentRow); } return null; }
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, XMLDescriptor referenceDescriptor, AbstractRecord parentRow, DatabaseField field, Object originalObject, boolean wasXMLRoot) { String defaultRootElementString = null; if(referenceDescriptor != null){ defaultRootElementString = referenceDescriptor.getDefaultRootElement(); if (!wasXMLRoot && defaultRootElementString == null) { throw XMLMarshalException.defaultRootElementNotSpecified((XMLDescriptor) descriptor); } } if ((field == null) && (referenceDescriptor != null) && (defaultRootElementString != null)) { field = referenceDescriptor.buildField(defaultRootElementString); } if ((field != null) && (referenceDescriptor != null)) { ((XMLRecord) parentRow).setLeafElementType(referenceDescriptor.getDefaultRootElementType()); XMLObjectBuilder objectBuilder = (XMLObjectBuilder) referenceDescriptor.getObjectBuilder(); XMLRecord child = (XMLRecord) objectBuilder.createRecordFor(attributeValue, (XMLField) field, (XMLRecord) parentRow, this); child.setNamespaceResolver(((XMLRecord) parentRow).getNamespaceResolver()); objectBuilder.buildIntoNestedRow(child, originalObject, attributeValue, session, referenceDescriptor, (XMLField) field, wasXMLRoot); return child; } return null; }
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, AbstractRecord parentRow) { XMLDescriptor referenceDescriptor = (XMLDescriptor) session.getDescriptor(attributeValue.getClass()); if ((referenceDescriptor != null) && (referenceDescriptor.getDefaultRootElement() != null)) { XMLObjectBuilder objectBuilder = (XMLObjectBuilder) referenceDescriptor.getObjectBuilder(); return objectBuilder.buildRow(attributeValue, session, referenceDescriptor.buildField(referenceDescriptor.getDefaultRootElement()), (XMLRecord) parentRow); } return null; }
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, XMLDescriptor referenceDescriptor, AbstractRecord parentRow, DatabaseField field, Object originalObject, boolean wasXMLRoot) { String defaultRootElementString = null; if(referenceDescriptor != null){ defaultRootElementString = referenceDescriptor.getDefaultRootElement(); if (!wasXMLRoot && defaultRootElementString == null) { throw XMLMarshalException.defaultRootElementNotSpecified((XMLDescriptor) descriptor); } } if ((field == null) && (referenceDescriptor != null) && (defaultRootElementString != null)) { field = referenceDescriptor.buildField(defaultRootElementString); } if ((field != null) && (referenceDescriptor != null)) { ((XMLRecord) parentRow).setLeafElementType(referenceDescriptor.getDefaultRootElementType()); XMLObjectBuilder objectBuilder = (XMLObjectBuilder) referenceDescriptor.getObjectBuilder(); XMLRecord child = (XMLRecord) objectBuilder.createRecordFor(attributeValue, (XMLField) field, (XMLRecord) parentRow, this); child.setNamespaceResolver(((XMLRecord) parentRow).getNamespaceResolver()); objectBuilder.buildIntoNestedRow(child, originalObject, attributeValue, session, referenceDescriptor, (XMLField) field, wasXMLRoot); return child; } return null; }
private String getQualifiedName(SDODataObject currentObject) { String qualifiedName = null; // check if we are at the root - no containmentProperty if (currentObject.getContainmentProperty() == null) { // get ns (without name) from type/schemaReference/schemaContext = "/ns0:PurchaseOrderType" //qualifiedName = ((SDOType)currentObject.getType()).getXmlDescriptor().getNamespaceResolver().resolveNamespaceURI(uri); // property id's do not match - don't use //qualifiedName += ((SDOXSDHelper)currentObject.getHelperContext().getXSDHelper()).getGlobalProperty(uri, currentObject.getType().getName() , true); // hack: get 2nd table name // get ns:name from the ns=nsr(value==uri) name=, or 2nd entry in xmlDescriptor->table[] qualifiedName = currentObject.getType().getXmlDescriptor().getDefaultRootElement(); } else { qualifiedName = getXPathForProperty(currentObject.getContainmentProperty()); } return qualifiedName; }
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, XMLDescriptor referenceDescriptor, AbstractRecord parentRow, DatabaseField field, Object originalObject, boolean wasXMLRoot) { String defaultRootElementString = null; if(referenceDescriptor != null){ defaultRootElementString = referenceDescriptor.getDefaultRootElement(); if (!wasXMLRoot && defaultRootElementString == null) { throw XMLMarshalException.defaultRootElementNotSpecified((XMLDescriptor) descriptor); } } if ((field == null) && (referenceDescriptor != null) && (defaultRootElementString != null)) { field = referenceDescriptor.buildField(defaultRootElementString); } if ((field != null) && (referenceDescriptor != null)) { ((XMLRecord) parentRow).setLeafElementType(referenceDescriptor.getDefaultRootElementType()); XMLObjectBuilder objectBuilder = (XMLObjectBuilder) referenceDescriptor.getObjectBuilder(); XMLRecord child = (XMLRecord) objectBuilder.createRecordFor(attributeValue, (XMLField) field, (XMLRecord) parentRow, this); child.setNamespaceResolver(((XMLRecord) parentRow).getNamespaceResolver()); objectBuilder.buildIntoNestedRow(child, originalObject, attributeValue, session, referenceDescriptor, (XMLField) field, wasXMLRoot); return child; } return null; }
private String getQualifiedName(SDODataObject currentObject) { String qualifiedName = null; // check if we are at the root - no containmentProperty if (currentObject.getContainmentProperty() == null) { // get ns (without name) from type/schemaReference/schemaContext = "/ns0:PurchaseOrderType" //qualifiedName = ((SDOType)currentObject.getType()).getXmlDescriptor().getNamespaceResolver().resolveNamespaceURI(uri); // property id's do not match - don't use //qualifiedName += ((SDOXSDHelper)currentObject.getHelperContext().getXSDHelper()).getGlobalProperty(uri, currentObject.getType().getName() , true); // hack: get 2nd table name // get ns:name from the ns=nsr(value==uri) name=, or 2nd entry in xmlDescriptor->table[] qualifiedName = currentObject.getType().getXmlDescriptor().getDefaultRootElement(); } else { qualifiedName = getXPathForProperty(currentObject.getContainmentProperty()); } return qualifiedName; }
protected AbstractRecord buildCompositeRow(Object attributeValue, AbstractSession session, XMLDescriptor referenceDescriptor, AbstractRecord parentRow, DatabaseField field, Object originalObject, boolean wasXMLRoot) { String defaultRootElementString = null; if(referenceDescriptor != null){ defaultRootElementString = referenceDescriptor.getDefaultRootElement(); if (!wasXMLRoot && defaultRootElementString == null) { throw XMLMarshalException.defaultRootElementNotSpecified((XMLDescriptor) descriptor); } } if ((field == null) && (referenceDescriptor != null) && (defaultRootElementString != null)) { field = referenceDescriptor.buildField(defaultRootElementString); } if ((field != null) && (referenceDescriptor != null)) { ((XMLRecord) parentRow).setLeafElementType(referenceDescriptor.getDefaultRootElementType()); XMLObjectBuilder objectBuilder = (XMLObjectBuilder) referenceDescriptor.getObjectBuilder(); XMLRecord child = (XMLRecord) objectBuilder.createRecordFor(attributeValue, (XMLField) field, (XMLRecord) parentRow, this); child.setNamespaceResolver(((XMLRecord) parentRow).getNamespaceResolver()); objectBuilder.buildIntoNestedRow(child, originalObject, attributeValue, session, referenceDescriptor, (XMLField) field, wasXMLRoot); return child; } return null; }
String rootName = desc.getDefaultRootElement(); if (rootName == null) { return xmlRoot;
String rootName = desc.getDefaultRootElement(); if (rootName == null) { return xmlRoot;
/** * Validate the given object. * @param object A single object to validate * @return true if this is a valid object, otherwise false */ public boolean validate(Object object) throws XMLMarshalException { if (object == null) { throw XMLMarshalException.nullArgumentException(); } try { // Create a new XML Record using the object's class name (not fully qualified) as the root String name = ((XMLDescriptor)xmlContext.getSession(object).getDescriptor(object)).getDefaultRootElement(); if (name == null) { String qualifiedName = object.getClass().getName(); int idx = qualifiedName.lastIndexOf('.'); name = qualifiedName.substring(idx + 1); } XMLDescriptor descriptor = marshaller.getDescriptor(object); XMLRoot root = new XMLRoot(); root.setObject(object); root.setLocalName(name); XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform(); Document doc = xmlPlatform.createDocument(); marshaller.marshal(root, doc); return xmlPlatform.validate(doc.getDocumentElement(), descriptor, getErrorHandler()); } catch (XMLPlatformException e) { throw XMLMarshalException.validateException(e); } }
/** * Validate the given object. * @param object A single object to validate * @return true if this is a valid object, otherwise false */ public boolean validate(Object object) throws XMLMarshalException { if (object == null) { throw XMLMarshalException.nullArgumentException(); } try { // Create a new XML Record using the object's class name (not fully qualified) as the root String name = ((XMLDescriptor)xmlContext.getSession(object).getDescriptor(object)).getDefaultRootElement(); if (name == null) { String qualifiedName = object.getClass().getName(); int idx = qualifiedName.lastIndexOf('.'); name = qualifiedName.substring(idx + 1); } XMLDescriptor descriptor = marshaller.getDescriptor(object); Root root = new Root(); root.setObject(object); root.setLocalName(name); XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform(); Document doc = xmlPlatform.createDocument(); marshaller.marshal(root, doc); return xmlPlatform.validate(doc.getDocumentElement(), descriptor, getErrorHandler()); } catch (XMLPlatformException e) { throw XMLMarshalException.validateException(e); } }
/** * Validate the given object. * @param object A single object to validate * @return true if this is a valid object, otherwise false */ public boolean validate(Object object) throws XMLMarshalException { if (object == null) { throw XMLMarshalException.nullArgumentException(); } try { // Create a new XML Record using the object's class name (not fully qualified) as the root String name = ((XMLDescriptor)xmlContext.getSession(object).getDescriptor(object)).getDefaultRootElement(); if (name == null) { String qualifiedName = object.getClass().getName(); int idx = qualifiedName.lastIndexOf('.'); name = qualifiedName.substring(idx + 1); } XMLDescriptor descriptor = marshaller.getDescriptor(object); Root root = new Root(); root.setObject(object); root.setLocalName(name); XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform(); Document doc = xmlPlatform.createDocument(); marshaller.marshal(root, doc); return xmlPlatform.validate(doc.getDocumentElement(), descriptor, getErrorHandler()); } catch (XMLPlatformException e) { throw XMLMarshalException.validateException(e); } }
XMLDescriptor xmlDescriptor = (XMLDescriptor) project.getAliasDescriptors().get(descriptorAlias); if (null != xmlDescriptor) { if (null == xmlDescriptor.getDefaultRootElement()) {
XMLDescriptor xmlDescriptor = (XMLDescriptor) project.getAliasDescriptors().get(descriptorAlias); if (null != xmlDescriptor) { if (null == xmlDescriptor.getDefaultRootElement()) {
domRecord = new DOMRecord(desc.getDefaultRootElement(), desc.getNamespaceResolver()); domRecord.setDocPresPolicy(getDocumentPreservationPolicy());
domRecord = new DOMRecord(desc.getDefaultRootElement(), desc.getNamespaceResolver()); domRecord.setDocPresPolicy(getDocumentPreservationPolicy());