Package org.eclipse.persistence.oxm

Examples of org.eclipse.persistence.oxm.XMLRoot


        // a text node as a first child, we'll try converting null
        String val = null;
        if (characters != null) {
            val = characters.toString();
        }
        XMLRoot xmlRoot = new XMLRoot();
        xmlRoot.setObject(((XMLConversionManager) session.getDatasourcePlatform().getConversionManager()).convertObject(val, targetClass));
        xmlRoot.setLocalName(getRootElementName());
        xmlRoot.setNamespaceURI(getRootElementNamespaceUri());
        return xmlRoot;
    }
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

                                }
                                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

                            localName = qualifiedName;
                        }
                        property = dataObject.getInstanceProperty(localName);
                    }
                } else {
                    XMLRoot xmlRoot = (XMLRoot) value;
                    if (null != xmlRoot) {
                        property = dataObject.getInstanceProperty(xmlRoot.getLocalName());
                    }
                }
            } else {
                property = dataObject.getInstanceProperty(mapping.getAttributeName());
            }
View Full Code Here

    private void remove(Setting setting) {
        DatabaseMapping mapping = setting.getMapping();
        if (null != mapping) {
            Property property = null;
            if (null == setting.getName()) {
                XMLRoot xmlRoot = (XMLRoot) setting.getValue();
                if (null != xmlRoot) {
                    property = dataObject.getInstanceProperty(xmlRoot.getLocalName());
                    valuesToSettings.remove(new Key(property, setting.getValue()));
                }
            } else {
                property = dataObject.getInstanceProperty(mapping.getAttributeName());
                valuesToSettings.remove(new Key(property, setting.getValue()));
View Full Code Here

        if (null == mapping) {
            setting.setObject(dataObject);

            mapping = xmlDescriptor.getMappingForAttributeName("openContentProperties");
            setting.setMapping(mapping);
            XMLRoot xmlRoot = new XMLRoot();
            if (value instanceof XMLRoot) {
                xmlRoot.setLocalName(((XMLRoot) value).getLocalName());
                xmlRoot.setNamespaceURI(((XMLRoot) value).getNamespaceURI());
                xmlRoot.setObject(((XMLRoot) value).getObject());
            } else {
                xmlRoot.setLocalName(sdoProperty.getName());
                xmlRoot.setNamespaceURI(sdoProperty.getUri());
                xmlRoot.setObject(value);
                // do not set schema type for global properties
                SDOTypeHelper hlpr = (SDOTypeHelper) ((SDOType) dataObject.getType()).getHelperContext().getTypeHelper();
                if (hlpr.getOpenContentProperty(sdoProperty.getUri(), sdoProperty.getName()) == null) {
                    QName schemaTypeQName = hlpr.getXSDTypeFromSDOType(property.getType());
                    if (schemaTypeQName != null && schemaTypeQName != XMLConstants.STRING_QNAME) {
                        xmlRoot.setSchemaType(schemaTypeQName);
                    }
                }
            }
            setting.setValue(xmlRoot, false);
        } else {
View Full Code Here

            }

            if (!xmlAnyObjectMapping.usesXMLRoot()) {
                unmarshalRecord.setAttributeValue(value, xmlAnyObjectMapping);
            } else {
                XMLRoot xmlRoot = new XMLRoot();
                xmlRoot.setNamespaceURI(xPathFragment.getNamespaceURI());
                xmlRoot.setSchemaType(qname);
                xmlRoot.setLocalName(xPathFragment.getLocalName());
                xmlRoot.setObject(value);
                unmarshalRecord.setAttributeValue(xmlRoot, xmlAnyObjectMapping);
            }
        }
    }
View Full Code Here

            String propertyName = null;
            String propertyUri = null;
            Object value = null;
            Type theType = null;
            if (next instanceof XMLRoot) {
                XMLRoot nextXMLRoot = (XMLRoot)next;
                value = nextXMLRoot.getObject();
                propertyName = nextXMLRoot.getLocalName();
                propertyUri = nextXMLRoot.getNamespaceURI();
                if (value instanceof DataObject) {
                    theType = ((DataObject)value).getType();
                } else {
                    theType = ((SDOTypeHelper)aHelperContext.getTypeHelper()).getTypeForSimpleJavaType(value.getClass());
                }
View Full Code Here

    public List _getOpenContentPropertiesWithXMLRoots() {
        List returnList = new ArrayList();
        for (int i = 0, size = openContentProperties.size(); i < size; i++) {
            Property next = (Property)openContentProperties.get(i);

            XMLRoot root = new XMLRoot();
            String localName = ((SDOProperty)next).getXPath();
            if (next.getType() != null) {
                if (!next.getType().isDataType()) {
                    String uri = ((SDOProperty)next).getUri();
                    root.setNamespaceURI(uri);
                } else {
                    String uri = ((SDOProperty)next).getUri();
                    root.setNamespaceURI(uri);
                }
            }

            root.setLocalName(localName);

            Object value = get(next);
            if (next.isMany()) {
                for (int j = 0, sizel = ((List)value).size(); j < sizel; j++) {
                    XMLRoot nextRoot = new XMLRoot();
                    nextRoot.setNamespaceURI(root.getNamespaceURI());
                    nextRoot.setLocalName(root.getLocalName());
                    Object nextItem = ((List)value).get(j);
                    if ((next.getType() != null) && (((SDOType)next.getType()).getXmlDescriptor() == null)) {
                        nextItem = XMLConversionManager.getDefaultXMLManager().convertObject(nextItem, String.class);
                    }
                    nextRoot.setObject(nextItem);
                    returnList.add(nextRoot);
                }
            } else {
                if ((next.getType() != null) && (((SDOType)next.getType()).getXmlDescriptor() == null)) {
                    value = XMLConversionManager.getDefaultXMLManager().convertObject(value, String.class);
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.