public Map<String, EntityType> getEntitiesTypesMap(boolean isAttribute) { Map<String, EntityType> entitiesTypes = isAttribute ? attributeTypeMap : elementTypeMap; if (entitiesTypes.isEmpty()) { final Map<XPathFragment, XPathNode> nodeMap = isAttribute ? xPathNode.getAttributeChildrenMap() : xPathNode.getNonAttributeChildrenMap(); if (nodeMap != null) { for(Map.Entry<XPathFragment, XPathNode> entry : nodeMap.entrySet()) { entitiesTypes.put(entry.getKey().getLocalName(), new EntityType(entry.getKey().getXMLField().getType())); } } } return entitiesTypes; }
final DatabaseSession session = xmlContext.getSession(0); final QName defaultRootElementType = ((XMLDescriptor) descriptor.getValue()).getDefaultRootElementType();
/** * INTERNAL: * A DatabaseField is built from the given field name. */ public DatabaseField buildField(String fieldName) { XMLField xmlField = new XMLField(fieldName); xmlField.setNamespaceResolver(this.getNamespaceResolver()); //xmlField.initialize(); return xmlField; }
public XMLBinder(XMLContext context) { this.context = new XMLContext(context.getXMLContextState()); marshaller = this.context.createMarshaller(); unmarshaller = this.context.createUnmarshaller(); initialize(); }
private NamespaceResolver getNamespaceResolverForField(XMLField field){ NamespaceResolver nr = field.getNamespaceResolver(); if(nr == null){ field.setNamespaceResolver(new NamespaceResolver()); } return field.getNamespaceResolver(); } }
public XMLBinder(XMLContext context, XMLMarshaller marshaller, XMLUnmarshaller unmarshaller) { this.context = new XMLContext(context.getXMLContextState()); this.marshaller = marshaller; this.unmarshaller = unmarshaller; initialize(); }
public NamespaceResolver getNonNullNamespaceResolver() { if (namespaceResolver == null) { namespaceResolver = new NamespaceResolver(); } return namespaceResolver; }
/** * INTERNAL: Return the EclipseLink session used to marshal. */ public List getSessions() { return getXMLContextState().getSessions(); }
/** * INTERNAL: */ public boolean shouldAddXsiType(XMLMarshaller xmlMarshaller, XMLDescriptor xmlDescriptor, Object originalObject, boolean wasXMLRoot) { if ((xmlDescriptor.getSchemaReference() != null) && xmlMarshaller.shouldWriteTypeAttribute(originalObject, xmlDescriptor, wasXMLRoot)) { return true; } return false; }
/** * The default root element type string will be stored until * initialization - a QName will be created and stored on the * default root element field during initialize. * * @param type */ public void setDefaultRootElementType(QName type) { if (defaultRootElementField != null) { defaultRootElementField.setLeafElementType(type); } }
/** * Create a new XMLBinder * @return an XMLBinder based on this XMLContext */ public XMLBinder createBinder() { return new XMLBinder(this); }
/** * INTERNAL: * Convert the given object to an XML Document */ public Document objectToXML(Object object, XMLDescriptor descriptor, XMLRecord xmlRow, boolean isXMLRoot, DocumentPreservationPolicy docPresPolicy) { return objectToXML(object, null, descriptor, xmlRow, isXMLRoot, docPresPolicy); }
/** * INTERNAL: Add and initialize a new session to the list of sessions * associated with this XMLContext. */ public void addSession(DatabaseSession sessionToAdd) { getXMLContextState().addSession(sessionToAdd); }
private boolean isNil(Object value) { if (value instanceof XMLRoot) { return ((XMLRoot)value).isNil(); } return false; }
public XMLBinder(XMLContext context) { this.context = new XMLContext(context.getXMLContextState()); marshaller = this.context.createMarshaller(); unmarshaller = this.context.createUnmarshaller(); initialize(); }
/** * INTERNAL: * A DatabaseField is built from the given field name. */ public DatabaseField buildField(String fieldName) { XMLField xmlField = new XMLField(fieldName); xmlField.setNamespaceResolver(this.getNamespaceResolver()); //xmlField.initialize(); return xmlField; }
public XMLBinder(XMLContext context, XMLMarshaller marshaller, XMLUnmarshaller unmarshaller) { this.context = new XMLContext(context.getXMLContextState()); this.marshaller = marshaller; this.unmarshaller = unmarshaller; initialize(); }
/** * INTERNAL: */ public boolean shouldAddXsiType(XMLMarshaller xmlmarshaller, XMLDescriptor xmlDescriptor, Object originalObject, boolean wasXMLRoot) { if ((xmlDescriptor.getSchemaReference() != null) && xmlmarshaller.shouldWriteTypeAttribute(originalObject, xmlDescriptor, wasXMLRoot)) { return true; } return false; }
/** * Create a new XMLBinder with supplied marshaller and unmarshaller instances. * @return an XMLBinder based on this XMLContext, */ public XMLBinder createBinder(XMLMarshaller marshaller, XMLUnmarshaller unmarshaller) { return new XMLBinder(this, marshaller, unmarshaller); }
/** * INTERNAL: * A DatabaseField is built from the given field name. */ public DatabaseField buildField(String fieldName) { XMLField xmlField = new XMLField(fieldName); xmlField.setNamespaceResolver(this.getNamespaceResolver()); //xmlField.initialize(); return xmlField; }