Search in sources :

Example 1 with CollectionReferenceMapping

use of org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping in project eclipselink by eclipse-ee4j.

the class JsonSchemaGenerator method generateProperty.

private Property generateProperty(Mapping next, XMLDescriptor descriptor, Map<String, Property> properties) {
    Property prop = null;
    if (next.isCollectionMapping()) {
        if (next instanceof CollectionReferenceMapping) {
            CollectionReferenceMapping mapping = (CollectionReferenceMapping) next;
            Set<XMLField> sourceFields = mapping.getSourceToTargetKeyFieldAssociations().keySet();
            XMLDescriptor reference = (XMLDescriptor) mapping.getReferenceDescriptor();
            for (XMLField nextField : sourceFields) {
                XPathFragment frag = nextField.getXPathFragment();
                String propertyName = getNameForFragment(frag);
                XMLField targetField = (XMLField) mapping.getSourceToTargetKeyFieldAssociations().get(nextField);
                Class<?> type = CoreClassConstants.STRING;
                if (reference != null) {
                    type = getTypeForTargetField(targetField, reference);
                }
                prop = properties.get(propertyName);
                if (prop == null) {
                    prop = new Property();
                    prop.setName(propertyName);
                }
                Property nestedProperty = getNestedPropertyForFragment(frag, prop);
                nestedProperty.setType(JsonType.ARRAY);
                nestedProperty.setItem(new Property());
                nestedProperty.getItem().setType(getJsonTypeForJavaType(type));
                if (!properties.containsKey(prop.getName())) {
                    properties.put(prop.getName(), prop);
                }
            }
            return prop;
        } else if (next.isAbstractCompositeCollectionMapping()) {
            CompositeCollectionMapping mapping = (CompositeCollectionMapping) next;
            XMLField field = (XMLField) mapping.getField();
            XPathFragment frag = field.getXPathFragment();
            String propName = getNameForFragment(frag);
            // for paths, there may already be an existing property
            prop = properties.get(propName);
            if (prop == null) {
                prop = new Property();
                prop.setName(propName);
            }
            Property nestedProperty = getNestedPropertyForFragment(frag, prop);
            nestedProperty.setType(JsonType.ARRAY);
            nestedProperty.setItem(new Property());
            XMLDescriptor referenceDescriptor = (XMLDescriptor) mapping.getReferenceDescriptor();
            if (referenceDescriptor != null && referenceDescriptor.hasInheritance()) {
                // handle inheritence
                // schema.setAnyOf(new Property[descriptor.getInheritancePolicy().getAllChildDescriptors().size()]);
                List<ClassDescriptor> descriptors = getAllDescriptorsForInheritance(referenceDescriptor);
                Property[] props = new Property[descriptors.size()];
                for (int i = 0; i < props.length; i++) {
                    XMLDescriptor nextDescriptor = null;
                    nextDescriptor = (XMLDescriptor) descriptors.get(i);
                    Property ref = new Property();
                    ref.setRef(getReferenceForDescriptor(nextDescriptor, true));
                    props[i] = ref;
                }
                nestedProperty.getItem().setAnyOf(props);
            } else {
                nestedProperty.getItem().setRef(getReferenceForDescriptor(referenceDescriptor, false));
            // populateProperties(nestedProperty.getItem().getProperties(), (XMLDescriptor)mapping.getReferenceDescriptor());
            }
        } else if (next.isAbstractCompositeDirectCollectionMapping()) {
            DirectCollectionMapping mapping = (DirectCollectionMapping) next;
            XMLField field = (XMLField) mapping.getField();
            XPathFragment frag = field.getXPathFragment();
            List<String> enumeration = null;
            if (mapping.getValueConverter() instanceof JAXBEnumTypeConverter) {
                enumeration = getEnumeration((DatabaseMapping) next);
            }
            String propertyName = getNameForFragment(frag);
            if (frag.nameIsText()) {
                propertyName = (String) this.contextProperties.get(MarshallerProperties.JSON_VALUE_WRAPPER);
            }
            if (frag.isAttribute() && this.attributePrefix != null) {
                propertyName = attributePrefix + propertyName;
            }
            prop = properties.get(propertyName);
            if (prop == null) {
                prop = new Property();
                prop.setName(propertyName);
            }
            Property nestedProperty = getNestedPropertyForFragment(frag, prop);
            nestedProperty.setType(JsonType.ARRAY);
            nestedProperty.setItem(new Property());
            if (enumeration != null) {
                nestedProperty.getItem().setEnumeration(enumeration);
            }
            Class<?> type = mapping.getAttributeElementClass();
            if (type == null) {
                type = CoreClassConstants.STRING;
            }
            nestedProperty.getItem().setType(getJsonTypeForJavaType(type));
            return prop;
        } else if (next instanceof BinaryDataCollectionMapping) {
            BinaryDataCollectionMapping mapping = (BinaryDataCollectionMapping) next;
            XMLField field = (XMLField) mapping.getField();
            XPathFragment frag = field.getXPathFragment();
            String propertyName = getNameForFragment(frag);
            if (frag.isSelfFragment()) {
                propertyName = Constants.VALUE_WRAPPER;
                if (this.contextProperties != null) {
                    String valueWrapper = (String) this.contextProperties.get(JAXBContextProperties.JSON_VALUE_WRAPPER);
                    if (valueWrapper != null) {
                        propertyName = valueWrapper;
                    }
                }
            }
            if (frag.isAttribute() && this.attributePrefix != null) {
                propertyName = attributePrefix + propertyName;
            }
            prop = properties.get(propertyName);
            if (prop == null) {
                prop = new Property();
                prop.setName(propertyName);
            }
            Property nestedProperty = getNestedPropertyForFragment(frag, prop);
            nestedProperty.setType(JsonType.ARRAY);
            nestedProperty.setItem(new Property());
            if (mapping.shouldInlineBinaryData()) {
                nestedProperty.getItem().setType(JsonType.STRING);
            } else {
                nestedProperty.getItem().setAnyOf(getXopIncludeProperties());
            }
            return prop;
        }
    } else {
        if (next.isAbstractDirectMapping()) {
            // handle direct mapping
            DirectMapping directMapping = (DirectMapping) next;
            XMLField field = (XMLField) directMapping.getField();
            XPathFragment frag = field.getXPathFragment();
            List<String> enumeration = null;
            if (directMapping.getConverter() instanceof JAXBEnumTypeConverter) {
                enumeration = getEnumeration((DatabaseMapping) directMapping);
            }
            String propertyName = getNameForFragment(frag);
            if (frag.nameIsText()) {
                propertyName = Constants.VALUE_WRAPPER;
                if (this.contextProperties != null) {
                    String valueWrapper = (String) this.contextProperties.get(JAXBContextProperties.JSON_VALUE_WRAPPER);
                    if (valueWrapper != null) {
                        propertyName = valueWrapper;
                    }
                }
            }
            if (frag.isAttribute() && this.attributePrefix != null) {
                propertyName = attributePrefix + propertyName;
            }
            prop = properties.get(propertyName);
            if (prop == null) {
                prop = new Property();
                prop.setName(propertyName);
            }
            Property nestedProperty = getNestedPropertyForFragment(frag, prop);
            if (enumeration != null) {
                nestedProperty.setEnumeration(enumeration);
            }
            if (directMapping instanceof BinaryDataMapping) {
                BinaryDataMapping binaryMapping = (BinaryDataMapping) directMapping;
                if (binaryMapping.shouldInlineBinaryData() || binaryMapping.isSwaRef()) {
                    nestedProperty.setType(JsonType.STRING);
                } else {
                    if (this.xopIncludeProp == null) {
                        initXopIncludeProp();
                    }
                    nestedProperty.setAnyOf(this.xopIncludeProp);
                }
            } else {
                nestedProperty.setType(getJsonTypeForJavaType(directMapping.getAttributeClassification()));
            }
            return prop;
        } else if (next instanceof ObjectReferenceMapping) {
            ObjectReferenceMapping mapping = (ObjectReferenceMapping) next;
            Set<XMLField> sourceFields = mapping.getSourceToTargetKeyFieldAssociations().keySet();
            XMLDescriptor reference = (XMLDescriptor) mapping.getReferenceDescriptor();
            for (XMLField nextField : sourceFields) {
                XPathFragment frag = nextField.getXPathFragment();
                String propName = getNameForFragment(frag);
                XMLField targetField = (XMLField) mapping.getSourceToTargetKeyFieldAssociations().get(nextField);
                Class<?> type = CoreClassConstants.STRING;
                if (reference != null) {
                    type = getTypeForTargetField(targetField, reference);
                }
                prop = properties.get(propName);
                if (prop == null) {
                    prop = new Property();
                    prop.setName(propName);
                }
                Property nestedProperty = getNestedPropertyForFragment(frag, prop);
                // nestedProperty.setType(JsonType.ARRAY);
                // nestedProperty.setItem(new Property());
                nestedProperty.setType(getJsonTypeForJavaType(type));
                if (!properties.containsKey(prop.getName())) {
                    properties.put(prop.getName(), prop);
                }
            }
            return prop;
        } else if (next.isAbstractCompositeObjectMapping()) {
            CompositeObjectMapping mapping = (CompositeObjectMapping) next;
            XMLDescriptor nextDescriptor = (XMLDescriptor) mapping.getReferenceDescriptor();
            XMLField field = (XMLField) mapping.getField();
            XPathFragment firstFragment = field.getXPathFragment();
            if (firstFragment.isSelfFragment() || firstFragment.nameIsText()) {
                if (nextDescriptor != null) {
                    populateProperties(properties, nextDescriptor);
                }
            } else {
                String propName = getNameForFragment(firstFragment);
                prop = properties.get(propName);
                if (prop == null) {
                    prop = new Property();
                    prop.setName(propName);
                }
                // prop.setType(JsonType.OBJECT);
                prop.setName(propName);
                Property nestedProperty = getNestedPropertyForFragment(firstFragment, prop);
                XMLDescriptor referenceDescriptor = (XMLDescriptor) mapping.getReferenceDescriptor();
                if (referenceDescriptor != null && referenceDescriptor.hasInheritance()) {
                    // handle inheritence
                    // schema.setAnyOf(new Property[descriptor.getInheritancePolicy().getAllChildDescriptors().size()]);
                    List<ClassDescriptor> descriptors = getAllDescriptorsForInheritance(referenceDescriptor);
                    Property[] props = new Property[descriptors.size()];
                    for (int i = 0; i < props.length; i++) {
                        XMLDescriptor nextDesc = (XMLDescriptor) descriptors.get(i);
                        Property ref = new Property();
                        ref.setRef(getReferenceForDescriptor(nextDesc, true));
                        props[i] = ref;
                    }
                    nestedProperty.setAnyOf(props);
                } else {
                    nestedProperty.setRef(getReferenceForDescriptor(referenceDescriptor, false));
                // populateProperties(nestedProperty.getItem().getProperties(), (XMLDescriptor)mapping.getReferenceDescriptor());
                }
            // populateProperties(nestedProperty.getProperties(), nextDescriptor);
            }
        } else if (next instanceof BinaryDataMapping) {
            BinaryDataMapping binaryMapping = (BinaryDataMapping) next;
            XMLField field = (XMLField) binaryMapping.getField();
            XPathFragment frag = field.getXPathFragment();
            String propertyName = getNameForFragment(frag);
            if (frag.isSelfFragment()) {
                propertyName = Constants.VALUE_WRAPPER;
                if (this.contextProperties != null) {
                    String valueWrapper = (String) this.contextProperties.get(MarshallerProperties.JSON_VALUE_WRAPPER);
                    if (valueWrapper != null) {
                        propertyName = valueWrapper;
                    }
                }
            }
            if (frag.isAttribute() && this.attributePrefix != null) {
                propertyName = attributePrefix + propertyName;
            }
            prop = properties.get(propertyName);
            if (prop == null) {
                prop = new Property();
                prop.setName(propertyName);
            }
            Property nestedProperty = getNestedPropertyForFragment(frag, prop);
            if (binaryMapping.shouldInlineBinaryData() || binaryMapping.isSwaRef()) {
                nestedProperty.setType(JsonType.STRING);
            } else {
                if (this.xopIncludeProp == null) {
                    initXopIncludeProp();
                }
                nestedProperty.setAnyOf(this.xopIncludeProp);
            }
            return prop;
        }
    }
    return prop;
}
Also used : Set(java.util.Set) ClassDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor) XPathFragment(org.eclipse.persistence.internal.oxm.XPathFragment) BinaryDataCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping) DirectCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping) XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) CollectionReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping) ArrayList(java.util.ArrayList) List(java.util.List) DirectMapping(org.eclipse.persistence.internal.oxm.mappings.DirectMapping) JAXBEnumTypeConverter(org.eclipse.persistence.jaxb.JAXBEnumTypeConverter) Property(org.eclipse.persistence.internal.jaxb.json.schema.model.Property) XMLField(org.eclipse.persistence.oxm.XMLField) ObjectReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.ObjectReferenceMapping) DatabaseMapping(org.eclipse.persistence.mappings.DatabaseMapping) BinaryDataMapping(org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping) CompositeCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.CompositeCollectionMapping) CompositeObjectMapping(org.eclipse.persistence.internal.oxm.mappings.CompositeObjectMapping)

Example 2 with CollectionReferenceMapping

use of org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping in project eclipselink by eclipse-ee4j.

the class SchemaModelGenerator method processMapping.

/**
 * Process a given mapping.
 */
protected void processMapping(CoreMapping mapping, Sequence seq, ComplexType ct, HashMap<String, Schema> schemaForNamespace, Schema workingSchema, SchemaModelGeneratorProperties properties, List<Descriptor> descriptors) {
    if (mapping instanceof BinaryDataMapping) {
        processXMLBinaryDataMapping((BinaryDataMapping) mapping, seq, ct, schemaForNamespace, workingSchema, properties);
    } else if (mapping instanceof BinaryDataCollectionMapping) {
        processXMLBinaryDataCollectionMapping((BinaryDataCollectionMapping) mapping, seq, ct, schemaForNamespace, workingSchema, properties);
    } else if (mapping instanceof DirectMapping) {
        processXMLDirectMapping((DirectMapping) mapping, seq, ct, schemaForNamespace, workingSchema, properties);
    } else if (mapping instanceof DirectCollectionMapping) {
        processXMLCompositeDirectCollectionMapping((DirectCollectionMapping) mapping, seq, ct, schemaForNamespace, workingSchema, properties);
    } else if (mapping instanceof CompositeCollectionMapping) {
        processXMLCompositeMapping((CompositeCollectionMapping) mapping, seq, ct, schemaForNamespace, workingSchema, properties, descriptors, true);
    } else if (mapping instanceof CompositeObjectMapping) {
        processXMLCompositeMapping((CompositeObjectMapping) mapping, seq, ct, schemaForNamespace, workingSchema, properties, descriptors, false);
    } else if (mapping instanceof AnyAttributeMapping) {
        AnyAttribute anyAttribute = new AnyAttribute();
        anyAttribute.setProcessContents(AnyAttribute.LAX);
        ct.setAnyAttribute(anyAttribute);
    } else if (mapping instanceof AnyObjectMapping) {
        processAnyMapping(seq, false);
    } else if (mapping instanceof AnyCollectionMapping) {
        processAnyMapping(seq, true);
    } else if (mapping instanceof ChoiceObjectMapping) {
        processXMLChoiceObjectMapping((ChoiceObjectMapping) mapping, seq, ct, schemaForNamespace, workingSchema, properties, descriptors);
    } else if (mapping instanceof ChoiceCollectionMapping) {
        processXMLChoiceCollectionMapping((ChoiceCollectionMapping) mapping, seq, ct, schemaForNamespace, workingSchema, properties, descriptors);
    } else if (mapping instanceof CollectionReferenceMapping) {
        processXMLObjectReferenceMapping((CollectionReferenceMapping) mapping, seq, ct, schemaForNamespace, workingSchema, properties, descriptors, true);
    } else if (mapping instanceof ObjectReferenceMapping) {
        processXMLObjectReferenceMapping((ObjectReferenceMapping) mapping, seq, ct, schemaForNamespace, workingSchema, properties, descriptors, false);
    }
}
Also used : AnyAttribute(org.eclipse.persistence.internal.oxm.schema.model.AnyAttribute) ObjectReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.ObjectReferenceMapping) AnyObjectMapping(org.eclipse.persistence.internal.oxm.mappings.AnyObjectMapping) AnyCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.AnyCollectionMapping) BinaryDataCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping) ChoiceCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.ChoiceCollectionMapping) BinaryDataMapping(org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping) DirectCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping) CollectionReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping) CompositeCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.CompositeCollectionMapping) DirectMapping(org.eclipse.persistence.internal.oxm.mappings.DirectMapping) CompositeObjectMapping(org.eclipse.persistence.internal.oxm.mappings.CompositeObjectMapping) AnyAttributeMapping(org.eclipse.persistence.internal.oxm.mappings.AnyAttributeMapping) ChoiceObjectMapping(org.eclipse.persistence.internal.oxm.mappings.ChoiceObjectMapping)

Example 3 with CollectionReferenceMapping

use of org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping in project eclipselink by eclipse-ee4j.

the class XMLChoiceCollectionMappingUnmarshalNodeValue method initializeNodeValue.

private void initializeNodeValue() {
    if (nestedMapping == null && isAny) {
        nestedMapping = xmlChoiceCollectionMapping.getAnyMapping();
    }
    Mapping xmlMapping = this.nestedMapping;
    if (xmlMapping instanceof BinaryDataCollectionMapping) {
        choiceElementNodeValue = new XMLBinaryDataCollectionMappingNodeValue((BinaryDataCollectionMapping) xmlMapping);
        choiceElementMarshalNodeValue = choiceElementNodeValue;
    } else if (xmlMapping instanceof DirectCollectionMapping) {
        choiceElementNodeValue = new XMLCompositeDirectCollectionMappingNodeValue((DirectCollectionMapping) xmlMapping);
        choiceElementMarshalNodeValue = choiceElementNodeValue;
    } else if (xmlMapping instanceof CompositeCollectionMapping) {
        choiceElementNodeValue = new XMLCompositeCollectionMappingNodeValue((CompositeCollectionMapping) xmlMapping);
        choiceElementMarshalNodeValue = choiceElementNodeValue;
    } else if (xmlMapping instanceof AnyCollectionMapping) {
        choiceElementNodeValue = new XMLAnyCollectionMappingNodeValue((AnyCollectionMapping) xmlMapping);
        choiceElementMarshalNodeValue = choiceElementNodeValue;
    } else {
        choiceElementNodeValue = new XMLCollectionReferenceMappingNodeValue((CollectionReferenceMapping) xmlMapping, xmlField);
        CollectionReferenceMapping refMapping = ((CollectionReferenceMapping) xmlMapping);
        if (refMapping.usesSingleNode() || refMapping.getFields().size() == 1) {
            choiceElementMarshalNodeValue = new XMLCollectionReferenceMappingNodeValue(refMapping, xmlField);
        } else {
            choiceElementMarshalNodeValue = new XMLCollectionReferenceMappingMarshalNodeValue((CollectionReferenceMapping) xmlMapping);
        }
    }
}
Also used : CollectionReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping) CompositeCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.CompositeCollectionMapping) BinaryDataCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping) CompositeCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.CompositeCollectionMapping) Mapping(org.eclipse.persistence.internal.oxm.mappings.Mapping) AnyCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.AnyCollectionMapping) CollectionReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping) DirectCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping) ChoiceCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.ChoiceCollectionMapping) AnyCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.AnyCollectionMapping) BinaryDataCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping) DirectCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping)

Example 4 with CollectionReferenceMapping

use of org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping in project eclipselink by eclipse-ee4j.

the class ReferenceResolver method perform.

/**
 * Add java doc if you understand this code.
 */
private void perform(final CoreAbstractSession session, final IDResolver userSpecifiedResolver, final ErrorHandler handler, final Reference reference) {
    final Object referenceSourceObject = reference.getSourceObject();
    if (reference.getMapping() instanceof CollectionReferenceMapping) {
        final CollectionReferenceMapping mapping = (CollectionReferenceMapping) reference.getMapping();
        final CoreContainerPolicy cPolicy = mapping.getContainerPolicy();
        // container should never be null
        final Object container = reference.getContainer();
        // create vectors of primary key values - one vector per reference instance
        createPKVectorsFromMap(reference, mapping);
        // if the we could not generate the primary key for the reference, it will not resolve - skip it
        if (reference.getPrimaryKey() == null) {
            return;
        }
        // loop over each pk vector and get object from cache - then add to collection and set on object
        Object value = null;
        if (!mapping.isWriteOnly()) {
            for (Object o : ((Vector) reference.getPrimaryKey())) {
                final CacheId primaryKey = (CacheId) o;
                if (userSpecifiedResolver != null) {
                    final Callable c;
                    try {
                        if (primaryKey.getPrimaryKey().length > 1) {
                            final Map<String, Object> idWrapper = new HashMap<>();
                            for (int y = 0; y < primaryKey.getPrimaryKey().length; y++) {
                                final ObjectReferenceMapping refMapping = (ObjectReferenceMapping) reference.getMapping();
                                final String idName = (String) refMapping.getReferenceDescriptor().getPrimaryKeyFieldNames().get(y);
                                final Object idValue = primaryKey.getPrimaryKey()[y];
                                idWrapper.put(idName, idValue);
                            }
                            c = userSpecifiedResolver.resolve(idWrapper, reference.getTargetClass());
                        } else {
                            c = userSpecifiedResolver.resolve(primaryKey.getPrimaryKey()[0], reference.getTargetClass());
                        }
                        if (c != null) {
                            value = c.call();
                        }
                    } catch (Exception e) {
                        throw XMLMarshalException.unmarshalException(e);
                    }
                } else {
                    value = getValue(session, reference, primaryKey, handler);
                }
                if (value != null) {
                    cPolicy.addInto(value, container, session);
                }
            }
        }
        // for each reference, get the source object and add it to the container policy
        // when finished, set the policy on the mapping
        mapping.setAttributeValueInObject(referenceSourceObject, container);
        final InverseReferenceMapping inverseReferenceMapping = mapping.getInverseReferenceMapping();
        if (inverseReferenceMapping != null && value != null) {
            final CoreAttributeAccessor backpointerAccessor = inverseReferenceMapping.getAttributeAccessor();
            final CoreContainerPolicy backpointerContainerPolicy = inverseReferenceMapping.getContainerPolicy();
            if (backpointerContainerPolicy == null) {
                backpointerAccessor.setAttributeValueInObject(value, referenceSourceObject);
            } else {
                Object backpointerContainer = backpointerAccessor.getAttributeValueFromObject(value);
                if (backpointerContainer == null) {
                    backpointerContainer = backpointerContainerPolicy.containerInstance();
                    backpointerAccessor.setAttributeValueInObject(value, backpointerContainer);
                }
                backpointerContainerPolicy.addInto(referenceSourceObject, backpointerContainer, session);
            }
        }
    } else if (reference.getMapping() instanceof ObjectReferenceMapping) {
        final CacheId primaryKey = (CacheId) reference.getPrimaryKey();
        Object value = null;
        if (userSpecifiedResolver != null) {
            final Callable c;
            try {
                if (primaryKey.getPrimaryKey().length > 1) {
                    final Map<String, Object> idWrapper = new HashMap<>();
                    for (int y = 0; y < primaryKey.getPrimaryKey().length; y++) {
                        final ObjectReferenceMapping refMapping = (ObjectReferenceMapping) reference.getMapping();
                        final String idName = (String) refMapping.getReferenceDescriptor().getPrimaryKeyFieldNames().get(y);
                        final Object idValue = primaryKey.getPrimaryKey()[y];
                        idWrapper.put(idName, idValue);
                    }
                    c = userSpecifiedResolver.resolve(idWrapper, reference.getTargetClass());
                } else {
                    c = userSpecifiedResolver.resolve(primaryKey.getPrimaryKey()[0], reference.getTargetClass());
                }
                if (c != null) {
                    value = c.call();
                }
            } catch (Exception e) {
                throw XMLMarshalException.unmarshalException(e);
            }
        } else {
            value = getValue(session, reference, primaryKey, handler);
        }
        ObjectReferenceMapping mapping = (ObjectReferenceMapping) reference.getMapping();
        if (value != null) {
            mapping.setAttributeValueInObject(reference.getSourceObject(), value);
        }
        if (null != reference.getSetting()) {
            reference.getSetting().setValue(value);
        }
        InverseReferenceMapping inverseReferenceMapping = mapping.getInverseReferenceMapping();
        if (inverseReferenceMapping != null) {
            CoreAttributeAccessor backpointerAccessor = inverseReferenceMapping.getAttributeAccessor();
            CoreContainerPolicy backpointerContainerPolicy = inverseReferenceMapping.getContainerPolicy();
            if (backpointerContainerPolicy == null) {
                backpointerAccessor.setAttributeValueInObject(value, referenceSourceObject);
            } else {
                Object backpointerContainer = backpointerAccessor.getAttributeValueFromObject(value);
                if (backpointerContainer == null) {
                    backpointerContainer = backpointerContainerPolicy.containerInstance();
                    backpointerAccessor.setAttributeValueInObject(value, backpointerContainer);
                }
                backpointerContainerPolicy.addInto(reference.getSourceObject(), backpointerContainer, session);
            }
        }
    }
}
Also used : InverseReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.InverseReferenceMapping) ObjectReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.ObjectReferenceMapping) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CoreAttributeAccessor(org.eclipse.persistence.core.mappings.CoreAttributeAccessor) Callable(java.util.concurrent.Callable) XMLMarshalException(org.eclipse.persistence.exceptions.XMLMarshalException) SAXParseException(org.xml.sax.SAXParseException) SAXException(org.xml.sax.SAXException) ConversionException(org.eclipse.persistence.exceptions.ConversionException) CollectionReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping) CacheId(org.eclipse.persistence.internal.identitymaps.CacheId) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) CoreContainerPolicy(org.eclipse.persistence.internal.core.queries.CoreContainerPolicy)

Example 5 with CollectionReferenceMapping

use of org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping in project eclipselink by eclipse-ee4j.

the class XPathObjectBuilder method lazyInitialize.

void lazyInitialize() {
    if (initialized) {
        return;
    }
    synchronized (this) {
        if (initialized) {
            return;
        }
        Descriptor xmlDescriptor = (Descriptor) descriptor;
        // MAPPINGS
        Iterator mappingIterator = xmlDescriptor.getMappings().iterator();
        Iterator fieldTransformerIterator;
        Mapping xmlMapping;
        // Transformation Mapping
        TransformationMapping transformationMapping;
        FieldTransformerNodeValue fieldTransformerNodeValue;
        Object[] nextFieldToTransformer;
        // Simple Type Translator
        TypeNodeValue typeNodeValue;
        NodeValue mappingNodeValue = null;
        Field xmlField;
        while (mappingIterator.hasNext()) {
            xmlMapping = (Mapping) mappingIterator.next();
            xmlField = (Field) xmlMapping.getField();
            if (xmlMapping.isTransformationMapping()) {
                transformationMapping = (TransformationMapping) xmlMapping;
                addTransformationMapping(transformationMapping);
                fieldTransformerIterator = transformationMapping.getFieldToTransformers().iterator();
                while (fieldTransformerIterator.hasNext()) {
                    fieldTransformerNodeValue = new FieldTransformerNodeValue(transformationMapping);
                    nextFieldToTransformer = (Object[]) fieldTransformerIterator.next();
                    xmlField = (Field) nextFieldToTransformer[0];
                    fieldTransformerNodeValue.setXMLField(xmlField);
                    fieldTransformerNodeValue.setFieldTransformer((CoreFieldTransformer) nextFieldToTransformer[1]);
                    addChild(xmlField.getXPathFragment(), fieldTransformerNodeValue, xmlDescriptor.getNamespaceResolver());
                }
            } else {
                if (xmlMapping.isAbstractDirectMapping()) {
                    mappingNodeValue = new XMLDirectMappingNodeValue((DirectMapping) xmlMapping);
                } else if (xmlMapping.isAbstractCompositeObjectMapping()) {
                    mappingNodeValue = new XMLCompositeObjectMappingNodeValue((CompositeObjectMapping) xmlMapping);
                } else if (xmlMapping.isAbstractCompositeCollectionMapping()) {
                    CompositeCollectionMapping collectionMapping = (CompositeCollectionMapping) xmlMapping;
                    mappingNodeValue = new XMLCompositeCollectionMappingNodeValue(collectionMapping);
                    if (collectionMapping.getWrapperNullPolicy() != null) {
                        addChild(xmlField.getXPathFragment(), new CollectionGroupingElementNodeValue((ContainerValue) mappingNodeValue), xmlDescriptor.getNamespaceResolver());
                    }
                } else if (xmlMapping.isAbstractCompositeDirectCollectionMapping()) {
                    DirectCollectionMapping collectionMapping = (DirectCollectionMapping) xmlMapping;
                    mappingNodeValue = new XMLCompositeDirectCollectionMappingNodeValue(collectionMapping);
                    if (collectionMapping.getWrapperNullPolicy() != null) {
                        addChild(xmlField.getXPathFragment(), new CollectionGroupingElementNodeValue((ContainerValue) mappingNodeValue), xmlDescriptor.getNamespaceResolver());
                    }
                } else if (xmlMapping instanceof InverseReferenceMapping) {
                    xmlMapping = (Mapping) ((InverseReferenceMapping) xmlMapping).getInlineMapping();
                    if (xmlMapping == null) {
                        continue;
                    }
                    xmlField = (Field) xmlMapping.getField();
                    if (xmlMapping.isAbstractCompositeCollectionMapping()) {
                        mappingNodeValue = new XMLCompositeCollectionMappingNodeValue((CompositeCollectionMapping) xmlMapping, true);
                    }
                    if (xmlMapping.isAbstractCompositeObjectMapping()) {
                        mappingNodeValue = new XMLCompositeObjectMappingNodeValue((CompositeObjectMapping) xmlMapping, true);
                    }
                } else if (xmlMapping instanceof VariableXPathCollectionMapping) {
                    mappingNodeValue = new XMLVariableXPathCollectionMappingNodeValue((VariableXPathCollectionMapping) xmlMapping);
                } else if (xmlMapping instanceof VariableXPathObjectMapping) {
                    mappingNodeValue = new XMLVariableXPathObjectMappingNodeValue((VariableXPathObjectMapping) xmlMapping);
                } else if (xmlMapping instanceof AnyObjectMapping) {
                    mappingNodeValue = new XMLAnyObjectMappingNodeValue((AnyObjectMapping) xmlMapping);
                } else if (xmlMapping instanceof AnyCollectionMapping) {
                    mappingNodeValue = new XMLAnyCollectionMappingNodeValue((AnyCollectionMapping) xmlMapping);
                } else if (xmlMapping instanceof AnyAttributeMapping) {
                    mappingNodeValue = new XMLAnyAttributeMappingNodeValue((AnyAttributeMapping) xmlMapping);
                } else if (xmlMapping instanceof BinaryDataMapping) {
                    mappingNodeValue = new XMLBinaryDataMappingNodeValue((BinaryDataMapping) xmlMapping);
                } else if (xmlMapping instanceof BinaryDataCollectionMapping) {
                    mappingNodeValue = new XMLBinaryDataCollectionMappingNodeValue((BinaryDataCollectionMapping) xmlMapping);
                } else if (xmlMapping instanceof FragmentMapping) {
                    mappingNodeValue = new XMLFragmentMappingNodeValue((FragmentMapping) xmlMapping);
                } else if (xmlMapping instanceof FragmentCollectionMapping) {
                    mappingNodeValue = new XMLFragmentCollectionMappingNodeValue((FragmentCollectionMapping) xmlMapping);
                } else if (xmlMapping instanceof CollectionReferenceMapping) {
                    CollectionReferenceMapping xmlColMapping = (CollectionReferenceMapping) xmlMapping;
                    List fields = xmlColMapping.getFields();
                    Field xmlColMappingField = (Field) xmlColMapping.getField();
                    XPathNode branchNode;
                    if (null == xmlColMappingField) {
                        if (fields.size() > 1 && !xmlColMapping.usesSingleNode()) {
                            addChild(XPathFragment.SELF_FRAGMENT, new XMLCollectionReferenceMappingMarshalNodeValue(xmlColMapping), xmlDescriptor.getNamespaceResolver());
                        }
                        branchNode = rootXPathNode;
                    } else {
                        branchNode = addChild(((Field) xmlColMapping.getField()).getXPathFragment(), new XMLCollectionReferenceMappingMarshalNodeValue(xmlColMapping), xmlDescriptor.getNamespaceResolver());
                    }
                    int containerIndex = -1;
                    for (int i = 0, size = fields.size(); i < size; i++) {
                        Field xmlFld = (Field) fields.get(i);
                        mappingNodeValue = new XMLCollectionReferenceMappingNodeValue(xmlColMapping, xmlFld);
                        if (i == 0) {
                            addContainerValue((ContainerValue) mappingNodeValue);
                            containerIndex = ((ContainerValue) mappingNodeValue).getIndex();
                        } else {
                            ((ContainerValue) mappingNodeValue).setIndex(containerIndex);
                        }
                        branchNode.addChild(xmlFld.getXPathFragment(), mappingNodeValue, xmlDescriptor.getNamespaceResolver());
                    }
                    continue;
                } else if (xmlMapping instanceof ObjectReferenceMapping) {
                    ObjectReferenceMapping xmlORMapping = (ObjectReferenceMapping) xmlMapping;
                    Iterator fieldIt = xmlORMapping.getFields().iterator();
                    while (fieldIt.hasNext()) {
                        Field xmlFld = (Field) fieldIt.next();
                        mappingNodeValue = new XMLObjectReferenceMappingNodeValue(xmlORMapping, xmlFld);
                        addChild(xmlFld.getXPathFragment(), mappingNodeValue, xmlDescriptor.getNamespaceResolver());
                    }
                    continue;
                } else if (xmlMapping instanceof ChoiceObjectMapping) {
                    ChoiceObjectMapping xmlChoiceMapping = (ChoiceObjectMapping) xmlMapping;
                    Iterator fields = xmlChoiceMapping.getChoiceElementMappings().keySet().iterator();
                    Field firstField = (Field) fields.next();
                    XMLChoiceObjectMappingNodeValue firstNodeValue = new XMLChoiceObjectMappingNodeValue(xmlChoiceMapping, firstField);
                    firstNodeValue.setNullCapableNodeValue(firstNodeValue);
                    addChild(firstField.getXPathFragment(), firstNodeValue, xmlDescriptor.getNamespaceResolver());
                    while (fields.hasNext()) {
                        Field next = (Field) fields.next();
                        XMLChoiceObjectMappingNodeValue nodeValue = new XMLChoiceObjectMappingNodeValue(xmlChoiceMapping, next);
                        nodeValue.setNullCapableNodeValue(firstNodeValue);
                        addChild(next.getXPathFragment(), nodeValue, xmlDescriptor.getNamespaceResolver());
                    }
                    continue;
                } else if (xmlMapping instanceof ChoiceCollectionMapping) {
                    ChoiceCollectionMapping xmlChoiceMapping = (ChoiceCollectionMapping) xmlMapping;
                    Iterator<Entry<Field, Mapping>> fields = xmlChoiceMapping.getChoiceElementMappings().entrySet().iterator();
                    Entry<Field, Mapping> firstEntry = fields.next();
                    Field firstField = firstEntry.getKey();
                    XMLChoiceCollectionMappingUnmarshalNodeValue unmarshalValue = new XMLChoiceCollectionMappingUnmarshalNodeValue(xmlChoiceMapping, firstField);
                    XMLChoiceCollectionMappingMarshalNodeValue marshalValue = new XMLChoiceCollectionMappingMarshalNodeValue(xmlChoiceMapping, firstField);
                    // The reason behind LinkedHashMap is the order of items when for-cycling HashMap.getEntrySet() or HashMap.getKeySet().
                    // This change fixes non-determinism (implementation in JDK8 has changed so the order is different (sometimes) than in JDK6 and JDK7).
                    HashMap<Field, NodeValue> fieldToNodeValues = new LinkedHashMap<>();
                    unmarshalValue.setContainerNodeValue(unmarshalValue);
                    unmarshalValue.setFieldToNodeValues(fieldToNodeValues);
                    if (xmlChoiceMapping.isMixedContent() && (xmlChoiceMapping.getMixedContentMapping() == firstEntry.getValue())) {
                        unmarshalValue.setIsMixedNodeValue(true);
                        marshalValue.setIsMixedNodeValue(true);
                    }
                    this.addContainerValue(unmarshalValue);
                    ((ContainerValue) unmarshalValue.getChoiceElementNodeValue()).setIndex(unmarshalValue.getIndex());
                    fieldToNodeValues.put(firstField, unmarshalValue);
                    addChild(firstField.getXPathFragment(), unmarshalValue, xmlDescriptor.getNamespaceResolver());
                    addChild(firstField.getXPathFragment(), marshalValue, xmlDescriptor.getNamespaceResolver());
                    while (fields.hasNext()) {
                        Entry<Field, Mapping> nextEntry = fields.next();
                        Field nextField = nextEntry.getKey();
                        XMLChoiceCollectionMappingUnmarshalNodeValue nodeValue = new XMLChoiceCollectionMappingUnmarshalNodeValue(xmlChoiceMapping, nextField);
                        nodeValue.setContainerNodeValue(unmarshalValue);
                        nodeValue.setIndex(unmarshalValue.getIndex());
                        ((ContainerValue) nodeValue.getChoiceElementNodeValue()).setIndex(unmarshalValue.getIndex());
                        addChild(nextField.getXPathFragment(), nodeValue, xmlDescriptor.getNamespaceResolver());
                        fieldToNodeValues.put(nextField, nodeValue);
                        if (xmlChoiceMapping.isMixedContent() && (xmlChoiceMapping.getMixedContentMapping() == nextEntry.getValue())) {
                            nodeValue.setIsMixedNodeValue(true);
                        }
                    }
                    if (xmlChoiceMapping.isAny()) {
                        XMLChoiceCollectionMappingUnmarshalNodeValue nodeValue = new XMLChoiceCollectionMappingUnmarshalNodeValue(xmlChoiceMapping, null, xmlChoiceMapping.getAnyMapping());
                        nodeValue.setContainerNodeValue(unmarshalValue);
                        nodeValue.setIndex(unmarshalValue.getIndex());
                        ((ContainerValue) nodeValue.getChoiceElementNodeValue()).setIndex(unmarshalValue.getIndex());
                        addChild(null, nodeValue, xmlDescriptor.getNamespaceResolver());
                        fieldToNodeValues.put(null, nodeValue);
                        if (xmlChoiceMapping.isMixedContent()) {
                            nodeValue.setIsMixedNodeValue(true);
                        }
                    }
                    marshalValue.setFieldToNodeValues(fieldToNodeValues);
                    continue;
                }
                if (mappingNodeValue.isContainerValue()) {
                    addContainerValue((ContainerValue) mappingNodeValue);
                }
                if (mappingNodeValue.isNullCapableValue()) {
                    addNullCapableValue((NullCapableValue) mappingNodeValue);
                }
                if (xmlField != null) {
                    addChild(xmlField.getXPathFragment(), mappingNodeValue, xmlDescriptor.getNamespaceResolver());
                } else {
                    addChild(null, mappingNodeValue, xmlDescriptor.getNamespaceResolver());
                }
            }
        }
        if (descriptor.hasInheritance()) {
            Field indicatorField = (Field) descriptor.getInheritancePolicy().getClassIndicatorField();
            if (indicatorField != null) {
                if (indicatorField.getLastXPathFragment().getNamespaceURI() != null && indicatorField.getLastXPathFragment().getNamespaceURI().equals(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI) && indicatorField.getLastXPathFragment().getLocalName().equals(Constants.SCHEMA_TYPE_ATTRIBUTE)) {
                    xsiTypeIndicatorField = true;
                }
            }
        }
        initialized = true;
    }
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) VariableXPathCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.VariableXPathCollectionMapping) TransformationMapping(org.eclipse.persistence.internal.oxm.mappings.TransformationMapping) ObjectReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.ObjectReferenceMapping) AnyObjectMapping(org.eclipse.persistence.internal.oxm.mappings.AnyObjectMapping) XMLCompositeObjectMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping) InverseReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.InverseReferenceMapping) VariableXPathCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.VariableXPathCollectionMapping) CoreMapping(org.eclipse.persistence.core.mappings.CoreMapping) AnyCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.AnyCollectionMapping) DirectCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping) ChoiceCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.ChoiceCollectionMapping) FragmentMapping(org.eclipse.persistence.internal.oxm.mappings.FragmentMapping) ChoiceObjectMapping(org.eclipse.persistence.internal.oxm.mappings.ChoiceObjectMapping) FragmentCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.FragmentCollectionMapping) Mapping(org.eclipse.persistence.internal.oxm.mappings.Mapping) AnyAttributeMapping(org.eclipse.persistence.internal.oxm.mappings.AnyAttributeMapping) BinaryDataMapping(org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping) CompositeCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.CompositeCollectionMapping) VariableXPathObjectMapping(org.eclipse.persistence.internal.oxm.mappings.VariableXPathObjectMapping) DirectMapping(org.eclipse.persistence.internal.oxm.mappings.DirectMapping) BinaryDataCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping) CollectionReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping) CompositeObjectMapping(org.eclipse.persistence.internal.oxm.mappings.CompositeObjectMapping) BinaryDataCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping) ChoiceCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.ChoiceCollectionMapping) CollectionReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping) FragmentCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.FragmentCollectionMapping) DirectMapping(org.eclipse.persistence.internal.oxm.mappings.DirectMapping) List(java.util.List) ArrayList(java.util.ArrayList) InverseReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.InverseReferenceMapping) ObjectReferenceMapping(org.eclipse.persistence.internal.oxm.mappings.ObjectReferenceMapping) TransformationMapping(org.eclipse.persistence.internal.oxm.mappings.TransformationMapping) AnyCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.AnyCollectionMapping) BinaryDataMapping(org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping) CompositeCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.CompositeCollectionMapping) Descriptor(org.eclipse.persistence.internal.oxm.mappings.Descriptor) CoreDescriptor(org.eclipse.persistence.core.descriptors.CoreDescriptor) ClassDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor) SequencedObject(org.eclipse.persistence.oxm.sequenced.SequencedObject) XMLCompositeObjectMapping(org.eclipse.persistence.oxm.mappings.XMLCompositeObjectMapping) CompositeObjectMapping(org.eclipse.persistence.internal.oxm.mappings.CompositeObjectMapping) ChoiceObjectMapping(org.eclipse.persistence.internal.oxm.mappings.ChoiceObjectMapping) AnyObjectMapping(org.eclipse.persistence.internal.oxm.mappings.AnyObjectMapping) DirectCollectionMapping(org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping) Field(org.eclipse.persistence.internal.oxm.mappings.Field) CoreField(org.eclipse.persistence.internal.core.helper.CoreField) DatabaseField(org.eclipse.persistence.internal.helper.DatabaseField) Entry(java.util.Map.Entry) Iterator(java.util.Iterator) VariableXPathObjectMapping(org.eclipse.persistence.internal.oxm.mappings.VariableXPathObjectMapping) FragmentMapping(org.eclipse.persistence.internal.oxm.mappings.FragmentMapping) AnyAttributeMapping(org.eclipse.persistence.internal.oxm.mappings.AnyAttributeMapping)

Aggregations

CollectionReferenceMapping (org.eclipse.persistence.internal.oxm.mappings.CollectionReferenceMapping)5 BinaryDataCollectionMapping (org.eclipse.persistence.internal.oxm.mappings.BinaryDataCollectionMapping)4 CompositeCollectionMapping (org.eclipse.persistence.internal.oxm.mappings.CompositeCollectionMapping)4 DirectCollectionMapping (org.eclipse.persistence.internal.oxm.mappings.DirectCollectionMapping)4 ObjectReferenceMapping (org.eclipse.persistence.internal.oxm.mappings.ObjectReferenceMapping)4 AnyCollectionMapping (org.eclipse.persistence.internal.oxm.mappings.AnyCollectionMapping)3 BinaryDataMapping (org.eclipse.persistence.internal.oxm.mappings.BinaryDataMapping)3 ChoiceCollectionMapping (org.eclipse.persistence.internal.oxm.mappings.ChoiceCollectionMapping)3 CompositeObjectMapping (org.eclipse.persistence.internal.oxm.mappings.CompositeObjectMapping)3 DirectMapping (org.eclipse.persistence.internal.oxm.mappings.DirectMapping)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 ClassDescriptor (org.eclipse.persistence.descriptors.ClassDescriptor)2 AnyAttributeMapping (org.eclipse.persistence.internal.oxm.mappings.AnyAttributeMapping)2 AnyObjectMapping (org.eclipse.persistence.internal.oxm.mappings.AnyObjectMapping)2 ChoiceObjectMapping (org.eclipse.persistence.internal.oxm.mappings.ChoiceObjectMapping)2 InverseReferenceMapping (org.eclipse.persistence.internal.oxm.mappings.InverseReferenceMapping)2 Mapping (org.eclipse.persistence.internal.oxm.mappings.Mapping)2