Examples of ObjectBuilder


Examples of oracle.toplink.essentials.internal.descriptors.ObjectBuilder

        if ((objectReferenced == null)){
            return ;
        }
        if ( ! visitedObjects.contains(objectReferenced)){
            visitedObjects.put(objectReferenced, objectReferenced);
            ObjectBuilder builder = getReferenceDescriptor(objectReferenced.getClass(), uow).getObjectBuilder();
            builder.cascadePerformRemove(objectReferenced, uow, visitedObjects);
        }
       
    }
View Full Code Here

Examples of oracle.toplink.essentials.internal.descriptors.ObjectBuilder

        if ( (objectReferenced == null) ){
            return ;
        }
        if ( ! visitedObjects.contains(objectReferenced)){
            visitedObjects.put(objectReferenced, objectReferenced);
            ObjectBuilder builder = getReferenceDescriptor(objectReferenced.getClass(), uow).getObjectBuilder();
            builder.cascadeRegisterNewForCreate(objectReferenced, uow, visitedObjects);
        }
    }
View Full Code Here

Examples of oracle.toplink.essentials.internal.descriptors.ObjectBuilder

     * join columns to handle some cases properly.
     */
    public void addPrimaryKeyJoinField(DatabaseField primaryKeyField, DatabaseField secondaryField) {
        // now it doesn't need to manage this as a separate table here,
        // it's enough just to add the mapping to ObjectBuilder.mappingsByField
        ObjectBuilder builder = getReferenceDescriptor().getObjectBuilder();
        DatabaseMapping mapping = builder.getMappingForField(primaryKeyField);
        if (mapping != null) {
            builder.getMappingsByField().put(secondaryField, mapping);
        }
    }
View Full Code Here

Examples of oracle.toplink.essentials.internal.descriptors.ObjectBuilder

     * INTERNAL:
     * This method collects the Joined Mappings from the descriptor and initializes
     * them
     */
    public void processJoinedMappings(){
        ObjectBuilder objectBuilder = getDescriptor().getObjectBuilder();
        if (objectBuilder.hasJoinedAttributes()) {
            Vector mappingJoinedAttributes = objectBuilder.getJoinedAttributes();
            if (!hasJoinedExpressions()) {
                for (int i = 0; i < mappingJoinedAttributes.size(); i++) {
                    addJoinedMapping((String)mappingJoinedAttributes.get(i));
                }
            } else {
View Full Code Here

Examples of oracle.toplink.essentials.internal.descriptors.ObjectBuilder

                //fetch group does not work with partial attribute reading
                throw QueryException.fetchGroupNotSupportOnPartialAttributeReading();
            }
        }
        Set attributes = query.getFetchGroup().getAttributes();
        ObjectBuilder builder = query.getDescriptor().getObjectBuilder();

        //First add all primary key attributes into the fetch group
        Iterator pkMappingIter = builder.getPrimaryKeyMappings().iterator();

        while (pkMappingIter.hasNext()) {
            DatabaseMapping pkMapping = (DatabaseMapping)pkMappingIter.next();
            DatabaseField pkField = pkMapping.getField();

            // Add pk attribute to the fetch group attributes list
            attributes.add(pkMapping.getAttributeName());
        }

        //second, add version/optimistic locking object attributes into the fetch group if applied.
        OptimisticLockingPolicy lockingPolicy = getDescriptor().getOptimisticLockingPolicy();
        if (query.shouldMaintainCache() && (lockingPolicy != null)) {
            lockingPolicy.prepareFetchGroupForReadQuery(query.getFetchGroup(), query);
        }

        //thrid, prepare all fetch group attributes
        Iterator attrIter = attributes.iterator();
        while (attrIter.hasNext()) {
            String attrName = (String)attrIter.next();
            DatabaseMapping mapping = builder.getMappingForAttributeName(attrName);
            if (mapping == null) {
                //the attribute name defined in the fetch group is not mapped
                throw QueryException.fetchGroupAttributeNotMapped(attrName);
            }
View Full Code Here

Examples of oracle.toplink.essentials.internal.descriptors.ObjectBuilder

            return rmiClone;
        }

        boolean changeTracked = false;
        try {
            ObjectBuilder builder = descriptor.getObjectBuilder();
           
            if (registeredObject != rmiClone && descriptor.usesVersionLocking() && ! mergedNewObjects.containsKey(registeredObject)) {
                VersionLockingPolicy policy = (VersionLockingPolicy) descriptor.getOptimisticLockingPolicy();
                if (policy.isStoredInObject()) {
                    Object currentValue = builder.extractValueFromObjectForField(registeredObject, policy.getWriteLockField(), session);
               
                    if (policy.isNewerVersion(currentValue, rmiClone, session.keyFromObject(rmiClone), session)) {
                        throw OptimisticLockException.objectChangedSinceLastMerge(rmiClone);
                    }
                }
            }
           
            // Toggle change tracking during the merge.
            descriptor.getObjectChangePolicy().dissableEventProcessing(registeredObject);
           
            boolean cascadeOnly = false;
            if(registeredObject == rmiClone){
                // GF#1139 Cascade merge operations to relationship mappings even if already registered
                cascadeOnly = true;
            }
            // Merge into the clone from the original, use clone as backup as anything different should be merged.
            builder.mergeIntoObject(registeredObject, false, rmiClone, this, cascadeOnly);
        } finally {
            descriptor.getObjectChangePolicy().enableEventProcessing(registeredObject);
        }

        return registeredObject;
View Full Code Here

Examples of oracle.toplink.essentials.internal.descriptors.ObjectBuilder

     * INTERNAL:
     * Create an instance of the composite primary key class for the key object.
     */
    public Object createPrimaryKeyInstance(Object key, AbstractSession session) {
        Object keyInstance = getPKClassInstance();
        ObjectBuilder builder = getDescriptor().getObjectBuilder();
        KeyElementAccessor[] pkElementArray = this.getKeyClassFields(getPKClass());
               
        for (int index = 0; index < pkElementArray.length; index++) {
            KeyElementAccessor accessor = pkElementArray[index];
            DatabaseMapping mapping = builder.getMappingForAttributeName(accessor.getAttributeName());
            // With session validation, the mapping shouldn't be null at this
            // point, don't bother checking.
           
            while (mapping.isAggregateObjectMapping()) {
                mapping = mapping.getReferenceDescriptor().getObjectBuilder().getMappingForAttributeName(pkElementArray[index].getAttributeName());
           
                if (mapping == null) { // must be aggregate
                    mapping = builder.getMappingForField(accessor.getDatabaseField());
                }
            }
           
            Object fieldValue = mapping.getRealAttributeValueFromObject(key, (oracle.toplink.essentials.internal.sessions.AbstractSession) session);
            accessor.setValue(keyInstance, fieldValue);
View Full Code Here

Examples of oracle.toplink.essentials.internal.descriptors.ObjectBuilder

                if (mapping.isForeignReferenceMapping()) {
                    // In EJB3 this should be a direct to field mapping (either
                    // on the entity directly or on an embeddable (aggregate).
                    continue;
                } else if (mapping.isAggregateMapping()) { // in the case of aggregates drill down.
                    ObjectBuilder builder = mapping.getReferenceDescriptor().getObjectBuilder();
                   
                    Vector aggregateMappings = builder.getReadOnlyMappingsForField(field);
                    if ((aggregateMappings != null) && (!aggregateMappings.isEmpty())) {
                        // Add all the mappings from the aggregate to be
                        // processed.
                        allMappings.addAll(aggregateMappings);
                    }
                                       
                    DatabaseMapping writableMapping = builder.getMappingForField(field);
                   
                    if (writableMapping != null) {
                        // Since it may be another aggregate mapping, add it to
                        // the allMappings list so we can drill down on it as
                        // well.
View Full Code Here

Examples of oracle.toplink.essentials.internal.descriptors.ObjectBuilder

     * Create a new instance, unless a workingCopyClone method is specified, then build a new instance and clone it.
     */
    public Object buildWorkingCopyCloneFromRow(Record row, ObjectBuildingQuery query) throws DescriptorException {
        // For now must preserve CMP code which builds heavy clones with a context.
        // Also preserve for clients who use the copy policy.
        ObjectBuilder builder = getDescriptor().getObjectBuilder();
        if (getWorkingCopyMethodName() != null) {
            Object original = builder.buildNewInstance();
            builder.buildAttributesIntoShallowObject(original, (AbstractRecord)row, query);
            return buildWorkingCopyClone(original, query.getSession());
        } else {
            return builder.buildNewInstance();
        }
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.descriptors.ObjectBuilder

     * INTERNAL:
     * Create an instance of the composite primary key class for the key object.
     */
    public Object createPrimaryKeyInstance(Object key, AbstractSession session) {
        KeyElementAccessor[] pkElementArray = this.getKeyClassFields(getPKClass());
        ObjectBuilder builder = getDescriptor().getObjectBuilder();
        if (pkElementArray.length == 1 && pkElementArray[0] instanceof KeyIsElementAccessor){
            DatabaseMapping mapping = builder.getMappingForAttributeName(pkElementArray[0].getAttributeName());
            return mapping.getRealAttributeValueFromObject(key, session);
        }
       
        Object keyInstance = getPKClassInstance();
        for (int index = 0; index < pkElementArray.length; index++) {
            KeyElementAccessor accessor = pkElementArray[index];
            DatabaseMapping mapping = builder.getMappingForAttributeName(accessor.getAttributeName());
            // With session validation, the mapping shouldn't be null at this
            // point, don't bother checking.
           
            while (mapping.isAggregateObjectMapping()) {
                mapping = mapping.getReferenceDescriptor().getObjectBuilder().getMappingForAttributeName(pkElementArray[index].getAttributeName());
           
                if (mapping == null) { // must be aggregate
                    mapping = builder.getMappingForField(accessor.getDatabaseField());
                }
            }
           
            Object fieldValue = mapping.getRealAttributeValueFromObject(key, session);
            accessor.setValue(keyInstance, fieldValue);
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.