public boolean marshalAttributes(MarshalRecord marshalRecord, Object object, AbstractSession session) { boolean hasValue = false; NamespaceResolver namespaceResolver = ((XMLDescriptor)this.getDescriptor()).getNamespaceResolver(); List<XPathNode> attributeChildren = rootXPathNode.getAttributeChildren(); if (null != attributeChildren) { for (int x = 0, attributeChildrenSize=attributeChildren.size(); x < attributeChildrenSize; x++) { hasValue = attributeChildren.get(x).marshal(marshalRecord, object, session, namespaceResolver, null, ObjectMarshalContext.getInstance()) || hasValue; } } if (rootXPathNode.getAnyAttributeNode() != null) { hasValue = rootXPathNode.getAnyAttributeNode().marshal(marshalRecord, object, session, namespaceResolver, null, ObjectMarshalContext.getInstance()) || hasValue; } List<XPathNode> selfChildren = rootXPathNode.getSelfChildren(); if (null != selfChildren) { for (int x = 0, selfChildrenSize=selfChildren.size(); x < selfChildrenSize; x++) { selfChildren.get(x).marshalSelfAttributes(marshalRecord, object, session, namespaceResolver, marshalRecord.getMarshaller()); } } return hasValue; }
public boolean startElement(MarshalRecord marshalRecord, XPathFragment anXPathFragment, Object object, AbstractSession session, NamespaceResolver namespaceResolver, TreeObjectBuilder compositeObjectBuilder, Object compositeObject) { if (null == anXPathFragment) { return false; } marshalRecord.openStartElement(anXPathFragment, namespaceResolver); boolean hasValue = false; if (null != attributeChildren) { for (int x = 0, size = attributeChildren.size(); x < size; x++) { XPathNode attributeNode = (XPathNode)attributeChildren.get(x); hasValue = attributeNode.marshal(marshalRecord, object, session, namespaceResolver, null, ObjectMarshalContext.getInstance()) || hasValue; } } if (anyAttributeNode != null) { //marshal the anyAttribute node here before closeStartElement() hasValue = anyAttributeNode.marshal(marshalRecord, object, session, namespaceResolver, null, ObjectMarshalContext.getInstance()) || hasValue; } if (null != compositeObjectBuilder) { hasValue = compositeObjectBuilder.marshalAttributes(marshalRecord, compositeObject, session) || hasValue; } marshalRecord.closeStartElement(); return hasValue; }
public boolean startElement(MarshalRecord marshalRecord, XPathFragment anXPathFragment, Object object, CoreAbstractSession session, NamespaceResolver namespaceResolver, ObjectBuilder compositeObjectBuilder, Object compositeObject) { if (null == anXPathFragment) { return false; } marshalRecord.openStartElement(anXPathFragment, namespaceResolver); boolean hasValue = false; marshalRecord.predicateAttribute(anXPathFragment, namespaceResolver); if (null != attributeChildren) { for (int x = 0, size = attributeChildren.size(); x < size; x++) { XPathNode attributeNode = attributeChildren.get(x); hasValue = attributeNode.marshal(marshalRecord, object, session, namespaceResolver, null, ObjectMarshalContext.getInstance(), null) || hasValue; } } if (anyAttributeNode != null) { //marshal the anyAttribute node here before closeStartElement() hasValue = anyAttributeNode.marshal(marshalRecord, object, session, namespaceResolver, null, ObjectMarshalContext.getInstance(), null) || hasValue; } if (null != compositeObjectBuilder) { hasValue = compositeObjectBuilder.marshalAttributes(marshalRecord, compositeObject, session) || hasValue; } marshalRecord.closeStartElement(); return hasValue; }
ObjectMarshalContext objectMarshalContext = ObjectMarshalContext.getInstance(); for (XPathNode anAttributeChildren : attributeChildren) { hasValue = anAttributeChildren.marshal(marshalRecord, object, session, namespaceResolver, null, objectMarshalContext, null) || hasValue; hasValue = rootXPathNode.getAnyAttributeNode().marshal(marshalRecord, object, session, namespaceResolver, null, ObjectMarshalContext.getInstance(), null) || hasValue;
public boolean startElement(MarshalRecord marshalRecord, XPathFragment anXPathFragment, Object object, CoreAbstractSession session, NamespaceResolver namespaceResolver, ObjectBuilder compositeObjectBuilder, Object compositeObject) { if (null == anXPathFragment) { return false; } marshalRecord.openStartElement(anXPathFragment, namespaceResolver); boolean hasValue = false; marshalRecord.predicateAttribute(anXPathFragment, namespaceResolver); if (null != attributeChildren) { for (int x = 0, size = attributeChildren.size(); x < size; x++) { XPathNode attributeNode = attributeChildren.get(x); hasValue = attributeNode.marshal(marshalRecord, object, session, namespaceResolver, null, ObjectMarshalContext.getInstance(), null) || hasValue; } } if (anyAttributeNode != null) { //marshal the anyAttribute node here before closeStartElement() hasValue = anyAttributeNode.marshal(marshalRecord, object, session, namespaceResolver, null, ObjectMarshalContext.getInstance(), null) || hasValue; } if (null != compositeObjectBuilder) { hasValue = compositeObjectBuilder.marshalAttributes(marshalRecord, compositeObject, session) || hasValue; } marshalRecord.closeStartElement(); return hasValue; }
ObjectMarshalContext objectMarshalContext = ObjectMarshalContext.getInstance(); for (XPathNode anAttributeChildren : attributeChildren) { hasValue = anAttributeChildren.marshal(marshalRecord, object, session, namespaceResolver, null, objectMarshalContext, null) || hasValue; hasValue = rootXPathNode.getAnyAttributeNode().marshal(marshalRecord, object, session, namespaceResolver, null, ObjectMarshalContext.getInstance(), null) || hasValue;
public boolean marshal(MarshalRecord marshalRecord, Object object, AbstractSession session, NamespaceResolver namespaceResolver, XMLMarshaller marshaller, MarshalContext marshalContext) { if ((null == marshalNodeValue) || marshalNodeValue.isMarshalOnlyNodeValue()) { marshalRecord.addGroupingElement(this); boolean hasValue = false; if (null != attributeChildren) { for (int x = 0, size = attributeChildren.size(); x < size; x++) { XPathNode xPathNode = attributeChildren.get(x); hasValue = xPathNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, ObjectMarshalContext.getInstance()) || hasValue; } } if (anyAttributeNode != null) { hasValue = anyAttributeNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, ObjectMarshalContext.getInstance()) || hasValue; } if (null != nonAttributeChildren) { for (int x = 0, size = marshalContext.getNonAttributeChildrenSize(this); x < size; x++) { XPathNode xPathNode = (XPathNode)marshalContext.getNonAttributeChild(x, this); MarshalContext childMarshalContext = marshalContext.getMarshalContext(x); hasValue = xPathNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, childMarshalContext) || hasValue; } } if (hasValue) { marshalRecord.endElement(xPathFragment, namespaceResolver); } else { marshalRecord.removeGroupingElement(this); } return hasValue; } else { return marshalContext.marshal(marshalNodeValue, xPathFragment, marshalRecord, object, session, namespaceResolver); } }
wrapperXPathNode.setXPathFragment(this.getXPathFragment()); wrapperXPathNode.setMarshalNodeValue(childXPathNode.getMarshalNodeValue()); return wrapperXPathNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, marshalContext, rootFragment); for (int x = 0, size = attributeChildren.size(); x < size; x++) { XPathNode xPathNode = attributeChildren.get(x); hasValue = xPathNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, ObjectMarshalContext.getInstance(), this.xPathFragment) || hasValue; hasValue = anyAttributeNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, ObjectMarshalContext.getInstance(), null) || hasValue; hasValue = textNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, ObjectMarshalContext.getInstance(), null) || hasValue; XPathNode xPathNode = (XPathNode)marshalContext.getNonAttributeChild(x, this); MarshalContext childMarshalContext = marshalContext.getMarshalContext(x); hasValue = xPathNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, childMarshalContext, this.xPathFragment) || hasValue;
wrapperXPathNode.setXPathFragment(this.getXPathFragment()); wrapperXPathNode.setMarshalNodeValue(childXPathNode.getMarshalNodeValue()); return wrapperXPathNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, marshalContext, rootFragment); for (int x = 0, size = attributeChildren.size(); x < size; x++) { XPathNode xPathNode = attributeChildren.get(x); hasValue = xPathNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, ObjectMarshalContext.getInstance(), this.xPathFragment) || hasValue; hasValue = anyAttributeNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, ObjectMarshalContext.getInstance(), null) || hasValue; hasValue = textNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, ObjectMarshalContext.getInstance(), null) || hasValue; XPathNode xPathNode = (XPathNode)marshalContext.getNonAttributeChild(x, this); MarshalContext childMarshalContext = marshalContext.getMarshalContext(x); hasValue = xPathNode.marshal(marshalRecord, object, session, namespaceResolver, marshaller, childMarshalContext, this.xPathFragment) || hasValue;
@Override public boolean marshalSingleValue(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, Object value, CoreAbstractSession session, NamespaceResolver namespaceResolver, MarshalContext marshalContext) { if (xmlCollectionReferenceMapping.usesSingleNode()) { XPathFragment groupingFragment = marshalRecord.openStartGroupingElements(namespaceResolver); if (xPathFragment.isAttribute()) { marshalRecord.attribute(xPathFragment, namespaceResolver, (String) value); marshalRecord.closeStartGroupingElements(groupingFragment); } else { marshalRecord.closeStartGroupingElements(groupingFragment); marshalRecord.characters((String) value); } } else { for (int x = 0, size = marshalContext.getNonAttributeChildrenSize(branchNode); x < size; x++) { XPathNode xPathNode = (XPathNode)marshalContext.getNonAttributeChild(x, branchNode); xPathNode.marshal(marshalRecord, value, session, namespaceResolver, marshalRecord.getMarshaller(), marshalContext.getMarshalContext(x), null); } } return true; }
@Override public boolean marshalSingleValue(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, Object value, CoreAbstractSession session, NamespaceResolver namespaceResolver, MarshalContext marshalContext) { if (xmlCollectionReferenceMapping.usesSingleNode()) { XPathFragment groupingFragment = marshalRecord.openStartGroupingElements(namespaceResolver); if (xPathFragment.isAttribute()) { marshalRecord.attribute(xPathFragment, namespaceResolver, (String) value); marshalRecord.closeStartGroupingElements(groupingFragment); } else { marshalRecord.closeStartGroupingElements(groupingFragment); marshalRecord.characters((String) value); } } else { for (int x = 0, size = marshalContext.getNonAttributeChildrenSize(branchNode); x < size; x++) { XPathNode xPathNode = (XPathNode)marshalContext.getNonAttributeChild(x, branchNode); xPathNode.marshal(marshalRecord, value, session, namespaceResolver, marshalRecord.getMarshaller(), marshalContext.getMarshalContext(x), null); } } return true; }
@Override public boolean marshalSingleValue(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, Object value, AbstractSession session, NamespaceResolver namespaceResolver, MarshalContext marshalContext) { if (xmlCollectionReferenceMapping.usesSingleNode()) { XPathFragment groupingFragment = marshalRecord.openStartGroupingElements(namespaceResolver); if (xPathFragment.isAttribute()) { marshalRecord.attribute(xPathFragment, namespaceResolver, (String) value); marshalRecord.closeStartGroupingElements(groupingFragment); } else { marshalRecord.closeStartGroupingElements(groupingFragment); marshalRecord.characters((String) value); } } else { for (int x = 0, size = marshalContext.getNonAttributeChildrenSize(branchNode); x < size; x++) { XPathNode xPathNode = (XPathNode)marshalContext.getNonAttributeChild(x, branchNode); xPathNode.marshal((MarshalRecord)marshalRecord, value, session, namespaceResolver, marshalRecord.getMarshaller(), marshalContext.getMarshalContext(x)); } } return true; }
textNode.marshal((MarshalRecord) record, object, session, namespaceResolver, marshaller, marshalContext, rootFragment); } else { if (node == null) { for (int x = 0, size = marshalContext.getNonAttributeChildrenSize(node); x < size; x++) { XPathNode xPathNode = (XPathNode) marshalContext.getNonAttributeChild(x, node); xPathNode.marshal((MarshalRecord) record, object, session, namespaceResolver, marshaller, marshalContext.getMarshalContext(x), rootFragment);
textNode.marshal((MarshalRecord) record, object, session, namespaceResolver, marshaller, marshalContext, rootFragment); } else { if (node == null) { for (int x = 0, size = marshalContext.getNonAttributeChildrenSize(node); x < size; x++) { XPathNode xPathNode = (XPathNode) marshalContext.getNonAttributeChild(x, node); xPathNode.marshal((MarshalRecord) record, object, session, namespaceResolver, marshaller, marshalContext.getMarshalContext(x), rootFragment);
public AbstractRecord buildRow(AbstractRecord record, Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, XMLMarshaller marshaller) { if (null == getRootXPathNode().getNonAttributeChildren()) { return record; } XMLDescriptor xmlDescriptor = (XMLDescriptor) this.descriptor; NamespaceResolver namespaceResolver = xmlDescriptor.getNamespaceResolver(); MarshalContext marshalContext = null; if(xmlDescriptor.isSequencedObject()) { SequencedObject sequencedObject = (SequencedObject) object; marshalContext = new SequencedMarshalContext(sequencedObject.getSettings()); } else { marshalContext = ObjectMarshalContext.getInstance(); } for (int x = 0, size = marshalContext.getNonAttributeChildrenSize(getRootXPathNode()); x < size; x++) { XPathNode xPathNode = (XPathNode)marshalContext.getNonAttributeChild(x, getRootXPathNode()); xPathNode.marshal((MarshalRecord)record, object, session, namespaceResolver, marshaller, marshalContext.getMarshalContext(x)); } return record; }