Package org.eclipse.persistence.oxm.record

Examples of org.eclipse.persistence.oxm.record.DOMRecord


                }
               
                if(c_id == null) {
                    element = bytes;
                } else {
                    DOMRecord include = new DOMRecord(field.getLastXPathFragment().getLocalName());
                    include.setSession(session);
                    include.put(includeField, c_id);
                    element = include;

                    // Need to call setAttributeNS on the record, unless the xop prefix
                    // is defined on the descriptor's resolver already
                    NamespaceResolver resolver = ((XMLField) getField()).getNamespaceResolver();
                    if (resolver == null || resolver.resolveNamespaceURI(XMLConstants.XOP_URL) == null) {
                        resolver = new NamespaceResolver();
                        resolver.put(XMLConstants.XOP_PREFIX, XMLConstants.XOP_URL);
                        String xpath = XMLConstants.XOP_PREFIX + XMLConstants.COLON + INCLUDE;
                        XMLField incField = new XMLField(xpath);
                        incField.setNamespaceResolver(resolver);
                        Object obj = include.getIndicatingNoEntry(incField);
                        if (obj != null && obj instanceof DOMRecord) {
                            if (((DOMRecord) obj).getDOM().getNodeType() == Node.ELEMENT_NODE) {
                                ((Element) ((DOMRecord) obj).getDOM()).setAttributeNS(XMLConstants.XMLNS_URL, XMLConstants.XMLNS + XMLConstants.COLON + XMLConstants.XOP_PREFIX, XMLConstants.XOP_URL);
                            }
                        }
View Full Code Here


            return true;
        } else {
            // EMPTY_NODE - Write out empty element - Required
            if (marshalNullRepresentation == XMLNullRepresentationType.EMPTY_NODE) {
                Node element = XPathEngine.getInstance().createUnownedElement(record.getDOM(), field);
                DOMRecord nestedRow = new DOMRecord(element);
                record.put(field, nestedRow);
                return true;
            } else {
                // ABSENT_NODE - Write out nothing - Optional
                return false;
View Full Code Here

      if (node.getNodeType() != Node.ELEMENT_NODE) {
        return;
      }
        AbstractSession session = context.getSession(obj);
        XMLDescriptor xmlDescriptor = (XMLDescriptor)session.getDescriptor(obj);
        DOMRecord row = new DOMRecord((Element)node);
        row.setSession(session);
        Vector pk = xmlDescriptor.getObjectBuilder().extractPrimaryKeyFromRow(row, session);
        if (xmlDescriptor.shouldPreserveDocument() || xmlDescriptor.getPrimaryKeyFieldNames().size() > 0) {
            if ((pk == null) || (pk.size() == 0)) {
                pk = new Vector();
                pk.addElement(new WeakObjectWrapper(obj));
View Full Code Here

     * Build and return a database row that contains a foreign key for the specified reference
     * object.  This will be stored in the nested row(s).
     */
    protected XMLRecord extractKeyRowFromReferenceObject(Object object, AbstractSession session, XMLRecord parentRecord) {
        Element newNode = XPathEngine.getInstance().createUnownedElement(parentRecord.getDOM(), getForeignKeyGroupingElement());
        XMLRecord result = new DOMRecord(newNode);
        result.setSession(session);

        for (int i = 0; i < this.getSourceForeignKeyFields().size(); i++) {
            DatabaseField fkField = (DatabaseField)getSourceForeignKeyFields().get(i);
            if (object == null) {
                result.add(fkField, null);
            } else {
                DatabaseField pkField = (DatabaseField)this.getSourceForeignKeysToTargetKeys().get(fkField);
                Object value = this.getReferenceDescriptor().getObjectBuilder().extractValueFromObjectForField(object, pkField, session);
                result.add(fkField, value);
            }
        }
        return result;
    }
View Full Code Here

                if (values != null) {
                    if (values instanceof Vector) {
                        int valuesSize = ((Vector)values).size();
                        for (int j = 0; j < valuesSize; j++) {
                            XMLRecord newRecord = new DOMRecord("test");
                            newRecord.setSession(((XMLRecord)row).getSession());
                            newRecord.put(this.getSourceForeignKeyFields().get(0), ((Vector)values).get(j));
                            subRows.add(newRecord);
                        }
                    } else {
                        XMLRecord newRecord = new DOMRecord("test");
                        newRecord.setSession(((XMLRecord)row).getSession());
                        newRecord.put(getSourceForeignKeyFields().get(0), values);
                        subRows.add(newRecord);
                    }
                }
            }
        } else {
View Full Code Here

    public Object unmarshal(File file) {
        try {
            Document document = null;
            document = parser.parse(file);
            return xmlToObject(new DOMRecord(document));
        } catch (XMLPlatformException e) {
            throw XMLMarshalException.unmarshalException(e);
        }
    }
View Full Code Here

    public Object unmarshal(File file, Class clazz) {
        try {
            Document document = null;
            document = parser.parse(file);
            return xmlToObject(new DOMRecord(document), clazz);
        } catch (XMLPlatformException e) {
            throw XMLMarshalException.unmarshalException(e);
        }
    }
View Full Code Here

    public Object unmarshal(InputStream inputStream) {
        try {
            Document document = null;
            document = parser.parse(inputStream);
            return xmlToObject(new DOMRecord(document));
        } catch (XMLPlatformException e) {
            throw XMLMarshalException.unmarshalException(e);
        }
    }
View Full Code Here

    public Object unmarshal(InputStream inputStream, Class clazz) {
        try {
            Document document = null;
            document = parser.parse(inputStream);
            return xmlToObject(new DOMRecord(document), clazz);
        } catch (XMLPlatformException e) {
            throw XMLMarshalException.unmarshalException(e);
        }
    }
View Full Code Here

    public Object unmarshal(InputSource inputSource) {
        try {
            Document document = null;
            document = parser.parse(inputSource);
            return xmlToObject(new DOMRecord(document));
        } catch (XMLPlatformException e) {
            throw XMLMarshalException.unmarshalException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.oxm.record.DOMRecord

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.