Package org.eclipse.persistence.oxm

Examples of org.eclipse.persistence.oxm.XMLRoot


            String pathToNode = getPathFromAncestor(((SDODataObject)original), modifiedObject, cs);
            String containerPath = null;
            containerPath = getQualifiedName(modifiedObject);
            deletedXPaths.add(xpathToCS + containerPath + SDOConstants.SDO_XPATH_SEPARATOR_FRAGMENT + pathToNode);

            XMLRoot xmlroot = new XMLRoot();
            xmlroot.setObject(value);//set the object to the deep copy           
            xmlroot.setNamespaceURI(uri);
            xmlroot.setLocalName(qualifiedName);
            xmlMarshaller.marshal(xmlroot, csNode);
        } else {
            //need sdoref
            Element modifiedElement = null;
            if (uri == null) {
View Full Code Here


    private JAXBElement buildJAXBElementFromObject(Object obj) {
      // if an XMLRoot was returned, the root element != the default root
      // element of the object being marshalled to - need to create a
      // JAXBElement from the returned XMLRoot object
      if (obj instanceof XMLRoot) {
        XMLRoot xmlRoot = ((XMLRoot)obj);
        QName qname = new QName(xmlRoot.getNamespaceURI(), xmlRoot.getLocalName());
        return new JAXBElement(qname, xmlRoot.getObject().getClass(), xmlRoot.getObject());
      }
     
      // at this point, the default root element of the object being marshalled
      // to == the root element - here we need to create a JAXBElement
      // instance using information from the returned object
View Full Code Here

   * @param elt
   * @return
   */
  private XMLRoot createXMLRootFromJAXBElement(JAXBElement elt) {
    // create an XMLRoot to hand into the marshaller
    XMLRoot xmlroot = new XMLRoot();
    xmlroot.setObject(elt.getValue());
    QName qname = elt.getName();
    xmlroot.setLocalName(qname.getLocalPart());
    xmlroot.setNamespaceURI(qname.getNamespaceURI());
    if(elt.getDeclaredType() == ClassConstants.ABYTE || elt.getDeclaredType() == ClassConstants.APBYTE) {
      xmlroot.setSchemaType(XMLConstants.BASE_64_BINARY_QNAME);
    } else {
      xmlroot.setSchemaType((QName)org.eclipse.persistence.internal.oxm.XMLConversionManager.getDefaultJavaTypes().get(elt.getDeclaredType()));
    }
   
    return xmlroot;
  }
View Full Code Here

   
    public JAXBElement unmarshal(Object obj, Class javaClass) {
        if(!(obj instanceof Node)) {
            return null;
        }
        XMLRoot xmlRoot = (XMLRoot)xmlBinder.unmarshal((Node)obj, javaClass);
        return new JAXBElement(new QName(xmlRoot.getNamespaceURI(), xmlRoot.getLocalName()), javaClass, xmlRoot.getObject());
    }
View Full Code Here

                                }
                                if(getConverter() != null) {
                                  value = getConverter().convertDataValueToObjectValue(value, session, record.getUnmarshaller());
                                }                     

                                XMLRoot rootValue = new XMLRoot();
                                rootValue.setLocalName(next.getLocalName());
                                rootValue.setSchemaType(schemaTypeQName);
                                rootValue.setNamespaceURI(next.getNamespaceURI());
                                rootValue.setObject(value);
                                cp.addInto(rootValue, container, session);
                            }
                        }
                    }
                }
View Full Code Here

                            }
                          if(getConverter() != null) {
                            value = getConverter().convertDataValueToObjectValue(value, session, record.getUnmarshaller());
                          }

                            XMLRoot rootValue = new XMLRoot();
                            rootValue.setLocalName(next.getLocalName());
                            rootValue.setSchemaType(schemaTypeQName);
                            rootValue.setNamespaceURI(next.getNamespaceURI());
                            rootValue.setObject(value);
                            return rootValue;
                        }
                    }
                }
            }
View Full Code Here

    return convertObjectValueToDataValue(objectValue, session);
  }

  public Object convertDataValueToObjectValue(Object dataValue,
      Session session) {
    XMLRoot root = new XMLRoot();
    root.setLocalName(this.rootFragment.getLocalName());
    root.setNamespaceURI(this.rootFragment.getNamespaceURI());
    root.setObject(dataValue);
   
    return root;
  }
View Full Code Here

    protected void setOrAddAttributeValue(UnmarshalRecord unmarshalRecord, Object value, XPathFragment xPathFragment, Object collection){
        if (!xmlAnyObjectMapping.usesXMLRoot()) {
            unmarshalRecord.setAttributeValue(value, xmlAnyObjectMapping);
        } else {
            XMLRoot xmlRoot = new XMLRoot();
            xmlRoot.setNamespaceURI(xPathFragment.getNamespaceURI());
            xmlRoot.setSchemaType(unmarshalRecord.getTypeQName());
            xmlRoot.setLocalName(xPathFragment.getLocalName());
            xmlRoot.setObject(value);
            unmarshalRecord.setAttributeValue(xmlRoot, xmlAnyObjectMapping);
        }
    }
View Full Code Here

    public boolean addXsiTypeAndClassIndicatorIfRequired(XMLRecord record, XMLDescriptor xmlDescriptor, XMLDescriptor referenceDescriptor, XMLField xmlField, Object originalObject, Object obj, boolean wasXMLRoot, boolean addToNamespaceResolver){
        if(wasXMLRoot){
            XMLSchemaReference xmlRef = xmlDescriptor.getSchemaReference();

            if(descriptor != null){
                XMLRoot xr = (XMLRoot) originalObject;

                if (xmlDescriptor.getSchemaReference() == null) {
                    return false;
                }

                QName qName = new QName(xr.getNamespaceURI(),xr.getLocalName());

                XMLDescriptor xdesc = record.getMarshaller().getXMLContext().getDescriptor(qName);
                if (xdesc != null) {
                    boolean writeTypeAttribute = xdesc.getJavaClass() != descriptor.getJavaClass();
                    if(writeTypeAttribute && xmlRef != null){
                        String typeValue = xmlRef.getSchemaContext().substring(1);
                        writeXsiTypeAttribute(xmlDescriptor, record, typeValue, addToNamespaceResolver);
                        return true;
                    }
                    return false;

                }
              
              if(xr.getDeclaredType() != null && xr.getDeclaredType() == xr.getObject().getClass()){
                   return false;
              }

                String xmlRootLocalName = xr.getLocalName();
                String xmlRootUri = xr.getNamespaceURI();
                boolean writeTypeAttribute = true;
                for (int i = 0; i < descriptor.getTableNames().size(); i++) {
                    if (!writeTypeAttribute) {
                        return false;
                    }
View Full Code Here

        }
      NodeValue associatedNodeValue = null;
      XMLField associatedField = null;
      Object fieldValue = value;
      if(value instanceof XMLRoot) {
        XMLRoot rootValue = (XMLRoot)value;
        String localName = rootValue.getLocalName();
        String namespaceUri = rootValue.getNamespaceURI();
        fieldValue = rootValue.getObject();
        associatedField = getFieldForName(localName, namespaceUri);
        if(associatedField == null) {
          associatedField = xmlChoiceCollectionMapping.getClassToFieldMappings().get(fieldValue.getClass());
        }
      } else {
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.oxm.XMLRoot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.