Examples of CollectionDescriptor


Examples of org.apache.ojb.broker.metadata.CollectionDescriptor

    private void cascadeDeleteCollectionReferences(ObjectEnvelope source, List descriptor, List alreadyPrepared)
    {
        PersistenceBroker pb = getTransaction().getBroker();
        for(int i = 0; i < descriptor.size(); i++)
        {
            CollectionDescriptor col = (CollectionDescriptor) descriptor.get(i);
            boolean cascadeDelete = getTransaction().cascadeDeleteFor(col);
            Object collOrArray = col.getPersistentField().get(source.getObject());
            // TODO: remove cast
            CollectionProxyDefaultImpl proxy = (CollectionProxyDefaultImpl) ProxyHelper.getCollectionProxy(collOrArray);
            // on delete we have to materialize dependent objects
            if(proxy != null)
            {
                collOrArray = proxy.getData();
            }
            if(collOrArray != null)
            {
                Iterator it = BrokerHelper.getCollectionIterator(collOrArray);
                while(it.hasNext())
                {
                    Object colObj = ProxyHelper.getRealObject(it.next());
                    Identity oid = pb.serviceIdentity().buildIdentity(colObj);
                    ObjectEnvelope colMod = get(oid, colObj, false);
                    if(cascadeDelete)
                    {
                        colMod.setModificationState(colMod.getModificationState().markDelete());
                        cascadeDeleteFor(colMod, alreadyPrepared);
                    }
                    else
                    {
                        if(!col.isMtoNRelation())
                        {
                            colMod.addLinkOneToN(col, source.getObject(), true);
                            colMod.setModificationState(colMod.getModificationState().markDirty());
                        }
                    }
                    if(col.isMtoNRelation())
                    {
                        addM2NUnlinkEntry(col, source.getObject(), colObj);
                    }
                }
            }
View Full Code Here

Examples of org.apache.ojb.broker.metadata.CollectionDescriptor

            addObjectReferenceEdges(vertex, rds);
        }
        Iterator cdsIter = cld.getCollectionDescriptors(true).iterator();
        while (cdsIter.hasNext())
        {
            CollectionDescriptor cds = (CollectionDescriptor) cdsIter.next();
            addCollectionEdges(vertex, cds);
        }
    }
View Full Code Here

Examples of org.apache.ojb.broker.metadata.CollectionDescriptor

            }
        }

        // 1:N relations
        Iterator collections = mif.getCollectionDescriptors().iterator();
        CollectionDescriptor cds;
        Object userCol;
        Iterator userColIterator;
        Class type;
        ArrayList newUserCol = null;
        ArrayList newCacheCol = null;

        while (collections.hasNext())
        {
            cds = (CollectionDescriptor) collections.next();
            f = cds.getPersistentField();
            type = f.getType();
            isDependent = cds.getOtmDependent();
            if (onlyDependants && !isDependent)
            {
                continue;
            }
            userCol = f.get(userObject);
View Full Code Here

Examples of org.apache.ojb.broker.metadata.CollectionDescriptor

        }

        count = 0;
        for (Iterator it = colDescs.iterator(); it.hasNext(); count++)
        {
            CollectionDescriptor cds = (CollectionDescriptor) it.next();
            PersistentField f = cds.getPersistentField();
            Class type = f.getType();
            Object col = f.get(obj);

            if ((col != null) && (col instanceof CollectionProxyDefaultImpl)
                    && !((CollectionProxyDefaultImpl) col).isLoaded())
View Full Code Here

Examples of org.apache.ojb.broker.metadata.CollectionDescriptor

        }

        count = 0;
        for (Iterator it = colDescs.iterator(); it.hasNext(); count++)
        {
            CollectionDescriptor cds = (CollectionDescriptor) it.next();
            PersistentField f = cds.getPersistentField();
            ArrayList list = collections[count];
            ArrayList newCol;

            if (list == null)
            {
View Full Code Here

Examples of org.apache.ojb.broker.metadata.CollectionDescriptor

        ArrayList newObjects = new ArrayList();
        int count = 0;

        for (Iterator it = colDescs.iterator(); it.hasNext(); count++)
        {
            CollectionDescriptor cds = (CollectionDescriptor) it.next();

            if (cds.getOtmDependent())
            {
                ArrayList origList = (origCollections == null ? null
                                        : (ArrayList) origCollections[count]);
                ArrayList newList = (ArrayList) newCollections[count];
View Full Code Here

Examples of org.apache.ojb.broker.metadata.CollectionDescriptor

            }
        }

        for (Iterator it = colDescs.iterator(); it.hasNext(); )
        {
            CollectionDescriptor cds = (CollectionDescriptor) it.next();

            if (cds.getOtmDependent())
            {
                PersistentField f = cds.getPersistentField();
                Class type = f.getType();
                Object col = f.get(obj);

                if (col != null)
                {
View Full Code Here

Examples of org.apache.ojb.broker.metadata.CollectionDescriptor

//
      // Add collection descriptors
      java.util.Iterator it = cld.getCollectionDescriptors().iterator();
      while (it.hasNext())
      {
        CollectionDescriptor collDesc = (CollectionDescriptor)it.next();
        newChildren.add(new OjbMetaCollectionDescriptorNode(
          this.getOjbMetaTreeModel().getRepository(),
          this.getOjbMetaTreeModel(),
          this,
          collDesc));
View Full Code Here

Examples of org.apache.ojb.broker.metadata.CollectionDescriptor

    }

    void changeRelationMetadata(String field, boolean autoRetrieve, int autoUpdate, int autoDelete, boolean proxy)
    {
        ClassDescriptor cld = broker.getClassDescriptor(Node.class);
        CollectionDescriptor cod = (CollectionDescriptor) cld.getCollectionDescriptorByName(field);
        cod.setLazy(proxy);
        cod.setCascadeRetrieve(autoRetrieve);
        cod.setCascadingStore(autoUpdate);
        cod.setCascadingDelete(autoDelete);
    }
View Full Code Here

Examples of org.apache.ojb.broker.metadata.CollectionDescriptor

    void changeActorCollectionDescriptorTo(boolean autoRetrieve, int autoUpdate, int autoDelete, boolean proxy)
    {
        PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        ClassDescriptor cld = broker.getClassDescriptor(Actor.class);
        CollectionDescriptor cod = (CollectionDescriptor) cld.getCollectionDescriptors().get(0);
        cod.setLazy(proxy);
        cod.setCascadeRetrieve(autoRetrieve);
        cod.setCascadingStore(autoUpdate);
        cod.setCascadingDelete(autoDelete);
        broker.close();
    }
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.