Examples of AggregateObjectMapping


Examples of org.eclipse.persistence.mappings.AggregateObjectMapping

     * It assumes the aggregate object mapping is available and fully processed.
     * This will method will check for an attribute override field that was
     * used, otherwise returns the field name provided.
     */
    public DatabaseField getField(String fieldName) {
        AggregateObjectMapping mapping = (AggregateObjectMapping) getMapping();
       
        if (mapping.getAggregateToSourceFieldNames().containsKey(fieldName)) {
            return new DatabaseField(mapping.getAggregateToSourceFieldNames().get(fieldName));
        } else {
            return new DatabaseField(fieldName);
        }
    }
View Full Code Here

Examples of org.eclipse.persistence.mappings.AggregateObjectMapping

     * INTERNAL:
     * Process an embedded.
     */   
    public void process() {
        // Build and aggregate object mapping and add it to the descriptor.
        AggregateObjectMapping mapping = new AggregateObjectMapping();
        setMapping(mapping);
       
        mapping.setIsReadOnly(false);
        mapping.setIsNullAllowed(true);
        mapping.setReferenceClassName(getReferenceClassName());
        mapping.setAttributeName(getAttributeName());   
       
        // Will check for PROPERTY access
        setAccessorMethods(mapping);
       
        // Process attribute overrides.
View Full Code Here

Examples of org.eclipse.persistence.mappings.AggregateObjectMapping

        XMLCompositeCollectionMapping aggregateToSourceFieldNameAssociationsMapping = new XMLCompositeCollectionMapping();
        aggregateToSourceFieldNameAssociationsMapping.setReferenceClass(FieldTranslation.class);
        // Handle translation of fields associations string to field.
        aggregateToSourceFieldNameAssociationsMapping.setAttributeAccessor(new AttributeAccessor() {
            public Object getAttributeValueFromObject(Object object) {
                AggregateObjectMapping mapping = (AggregateObjectMapping)object;
                Vector associations = mapping.getAggregateToSourceFieldNameAssociations();
                Vector translations = new Vector(associations.size());
                for (int index = 0; index < associations.size(); index++) {
                    Association association = (Association)associations.get(index);
                    FieldTranslation translation = new FieldTranslation();
                    translation.setKey(new DatabaseField((String)association.getKey()));
                    translation.setValue(new DatabaseField((String)association.getValue()));
                    translations.add(translation);
                }
                return translations;
            }

            public void setAttributeValueInObject(Object object, Object value) {
                AggregateObjectMapping mapping = (AggregateObjectMapping)object;
                Vector associations = (Vector)value;
                for (int index = 0; index < associations.size(); index++) {
                    Association association = (Association)associations.get(index);
                    association.setKey(((DatabaseField)association.getKey()).getQualifiedName());
                    association.setValue(((DatabaseField)association.getValue()).getQualifiedName());
                }
                mapping.setAggregateToSourceFieldNameAssociations(associations);
            }
        });
        aggregateToSourceFieldNameAssociationsMapping.setAttributeName("aggregateToSourceFieldNameAssociationsMapping");
        aggregateToSourceFieldNameAssociationsMapping.setXPath(getPrimaryNamespaceXPath() + "field-translations/" + getPrimaryNamespaceXPath() + "field-translation");
        descriptor.addMapping(aggregateToSourceFieldNameAssociationsMapping);
View Full Code Here

Examples of org.eclipse.persistence.mappings.AggregateObjectMapping

   
    /**
     * INTERNAL:
     */
    protected AggregateObjectMapping processEmbeddableMapKeyClass(MappedKeyMapAccessor mappedKeyMapAccessor) {
        AggregateObjectMapping keyMapping = new AggregateObjectMapping();
        MetadataClass mapKeyClass = mappedKeyMapAccessor.getMapKeyClass();
        keyMapping.setReferenceClassName(mapKeyClass.getName());
       
        // The embeddable accessor must be processed by now. If it is not then
        // we are in trouble since by the time we get here, we are too late in
        // the cycle to process embeddable classes and their accessors. See
        // MetadataProject processStage3(), processEmbeddableMappingAccessors.
        // At this stage all class accessors (embeddable, entity and mapped
        // superclass) have to have been processed to gather all their
        // relational and embedded mappings.
        EmbeddableAccessor mapKeyAccessor = getProject().getEmbeddableAccessor(mapKeyClass);
       
        // Ensure the reference descriptor is marked as an embeddable collection.
        mapKeyAccessor.getDescriptor().setIsEmbeddable();
       
        // Process the attribute overrides for this may key embeddable.
        processAttributeOverrides(mappedKeyMapAccessor.getMapKeyAttributeOverrides(), keyMapping, mapKeyAccessor.getDescriptor());
       
        // Process the association overrides for this may key embeddable.
        processAssociationOverrides(mappedKeyMapAccessor.getMapKeyAssociationOverrides(), keyMapping, mapKeyAccessor.getDescriptor());
       
        // Process a convert key or jpa converter for the map key if specified.
        processConverts(getMapKeyConverts(mappedKeyMapAccessor.getMapKeyConverts()), keyMapping, mappedKeyMapAccessor.getMapKeyClass(), true);
       
        keyMapping.setDescriptor(getDescriptor().getClassDescriptor());
       
        return keyMapping;
    }
View Full Code Here

Examples of org.eclipse.persistence.mappings.AggregateObjectMapping

   
    /**
     * INTERNAL:
     */
    protected AggregateObjectMapping processEmbeddableMapKeyClass(MappedKeyMapAccessor mappedKeyMapAccessor) {
        AggregateObjectMapping keyMapping = new AggregateObjectMapping();
        MetadataClass mapKeyClass = mappedKeyMapAccessor.getMapKeyClass();
        keyMapping.setReferenceClassName(mapKeyClass.getName());
       
        // The embeddable accessor must be processed by now. If it is not then
        // we are in trouble since by the time we get here, we are too late in
        // the cycle to process embeddable classes and their accessors. See
        // MetadataProject processStage3(), processEmbeddableMappingAccessors.
        // At this stage all class accessors (embeddable, entity and mapped
        // superclass) have to have been processed to gather all their
        // relational and embedded mappings.
        EmbeddableAccessor mapKeyAccessor = getProject().getEmbeddableAccessor(mapKeyClass);
       
        // Ensure the reference descriptor is marked as an embeddable collection.
        mapKeyAccessor.getDescriptor().setIsEmbeddable();
       
        // Process the attribute overrides for this may key embeddable.
        processAttributeOverrides(mappedKeyMapAccessor.getMapKeyAttributeOverrides(), keyMapping, mapKeyAccessor.getDescriptor());
       
        // Process the association overrides for this may key embeddable.
        processAssociationOverrides(mappedKeyMapAccessor.getMapKeyAssociationOverrides(), keyMapping, mapKeyAccessor.getDescriptor());
       
        // Process a convert key or jpa converter for the map key if specified.
        processConverts(getMapKeyConverts(mappedKeyMapAccessor.getMapKeyConverts()), keyMapping, mappedKeyMapAccessor.getMapKeyClass(), true);
       
        keyMapping.setDescriptor(getDescriptor().getClassDescriptor());
       
        return keyMapping;
    }
View Full Code Here

Examples of org.eclipse.persistence.mappings.AggregateObjectMapping

     *            are null.
     * @return the new mapping configured and initialized (if the descriptor has
     *         been initialized).
     */
    public AggregateObjectMapping addAggregateObjectMapping(String name, DynamicType refType, boolean allowsNull) {
        AggregateObjectMapping mapping = new AggregateObjectMapping();
        mapping.setAttributeName(name);
        mapping.setReferenceClass(refType.getJavaClass());
        mapping.setIsNullAllowed(allowsNull);

        return (AggregateObjectMapping) addMapping(mapping);
    }
View Full Code Here

Examples of org.eclipse.persistence.mappings.AggregateObjectMapping

        aggregateToSourceFieldNameAssociationsMapping.setAttributeAccessor(new AttributeAccessor() {
            public Object getAttributeValueFromObject(Object object) {
                /*bug 322233: AttributeOverrides and AssociationOverride 
                 * changed getAggregateToSourceFieldAssociations to hold String->DatabaseField associations
                 */
                AggregateObjectMapping mapping = (AggregateObjectMapping)object;
                Vector associations = mapping.getAggregateToSourceFieldAssociations();
                Vector translations = new Vector(associations.size());
                for (int index = 0; index < associations.size(); index++) {
                    Association association = (Association)associations.get(index);
                    FieldTranslation translation = new FieldTranslation();
                    translation.setKey(new DatabaseField((String)association.getKey()));
                    translation.setValue(association.getValue());
                    translations.add(translation);
                }
                return translations;
            }

            public void setAttributeValueInObject(Object object, Object value) {
                AggregateObjectMapping mapping = (AggregateObjectMapping)object;
                Vector associations = (Vector)value;
                for (int index = 0; index < associations.size(); index++) {
                    Association association = (Association)associations.get(index);
                    association.setKey(((DatabaseField)association.getKey()).getQualifiedName());
                }

                mapping.setAggregateToSourceFieldAssociations(associations);
            }
        });
        aggregateToSourceFieldNameAssociationsMapping.setAttributeName("aggregateToSourceFieldNameAssociationsMapping");
        aggregateToSourceFieldNameAssociationsMapping.setXPath(getPrimaryNamespaceXPath() + "field-translations/" + getPrimaryNamespaceXPath() + "field-translation");
        descriptor.addMapping(aggregateToSourceFieldNameAssociationsMapping);
View Full Code Here

Examples of org.eclipse.persistence.mappings.AggregateObjectMapping

   
    /**
     * INTERNAL:
     */
    protected AggregateObjectMapping processEmbeddableMapKeyClass(MappedKeyMapAccessor mappedKeyMapAccessor) {
        AggregateObjectMapping keyMapping = new AggregateObjectMapping();
        MetadataClass mapKeyClass = mappedKeyMapAccessor.getMapKeyClass();
        keyMapping.setReferenceClassName(mapKeyClass.getName());
       
        // Tell the embeddable accessor to process itself it is hasn't already.
        EmbeddableAccessor mapKeyAccessor = getProject().getEmbeddableAccessor(mapKeyClass);
        if (! mapKeyAccessor.isProcessed()) {
            mapKeyAccessor.process();
        }
       
        // Ensure the reference descriptor is marked as an embeddable collection.
        mapKeyAccessor.getDescriptor().setIsEmbeddableCollection();
       
        // Process the attribute overrides for this may key embeddable.
        processAttributeOverrides(mappedKeyMapAccessor.getMapKeyAttributeOverrides(), keyMapping, mapKeyAccessor.getDescriptor());
       
        // Process the association overrides for this may key embeddable.
        processAssociationOverrides(mappedKeyMapAccessor.getMapKeyAssociationOverrides(), keyMapping, mapKeyAccessor.getDescriptor());
       
        keyMapping.setDescriptor(getDescriptor().getClassDescriptor());
       
        return keyMapping;
    }
View Full Code Here

Examples of org.eclipse.persistence.mappings.AggregateObjectMapping

     * It assumes the aggregate object mapping is available and fully processed.
     * This will method will check for an attribute override field that was
     * used, otherwise returns the field name provided.
     */
    public DatabaseField getField(String fieldName) {
        AggregateObjectMapping mapping = (AggregateObjectMapping) getMapping();
       
        if (mapping.getAggregateToSourceFieldNames().containsKey(fieldName)) {
            return new DatabaseField(mapping.getAggregateToSourceFieldNames().get(fieldName));
        } else {
            return new DatabaseField(fieldName);
        }
    }
View Full Code Here

Examples of org.eclipse.persistence.mappings.AggregateObjectMapping

     * INTERNAL:
     * Process an embedded.
     */   
    public void process() {
        // Build and aggregate object mapping and add it to the descriptor.
        AggregateObjectMapping mapping = new AggregateObjectMapping();
        setMapping(mapping);
       
        mapping.setIsReadOnly(false);
        mapping.setIsNullAllowed(true);
        mapping.setReferenceClassName(getReferenceClassName());
        mapping.setAttributeName(getAttributeName());   
       
        // Will check for PROPERTY access
        setAccessorMethods(mapping);
       
        // Process attribute overrides.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.