Examples of ObjectReferenceDescriptor


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

        refs = cdesc.getObjectReferenceDescriptors();
        hasBidirAssc = false;
        REFS_CYCLE:
        for (Iterator it = refs.iterator(); it.hasNext(); )
        {
            ObjectReferenceDescriptor ord;
            ClassDescriptor relCDesc;
            Collection relRefs;

            ord = (ObjectReferenceDescriptor) it.next();
            relCDesc = _pb.getClassDescriptor(ord.getItemClass());
            relRefs = relCDesc.getObjectReferenceDescriptors();
            for (Iterator relIt = relRefs.iterator(); relIt.hasNext(); )
            {
                ObjectReferenceDescriptor relOrd;

                relOrd = (ObjectReferenceDescriptor) relIt.next();
                if (relOrd.getItemClass().equals(clazz))
                {
                    hasBidirAssc = true;
                    break REFS_CYCLE;
                }
            }
View Full Code Here

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

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

        for (Iterator it = refDescs.iterator(); it.hasNext(); count++, countRefs++)
        {
            ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) it.next();
            Identity origOid = (origFields == null ? null : (Identity) origFields[count]);
            Identity newOid = (Identity) newFields[count];

            if (rds.getOtmDependent())
            {
                if ((origOid == null) && (newOid != null))
                {
                    ContextEntry entry = (ContextEntry) _objects.get(newOid);
View Full Code Here

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

        Collection colDescs = mif.getCollectionDescriptors();
        int countCascadeDeleted = 0;

        for (Iterator it = refDescs.iterator(); it.hasNext(); )
        {
            ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) it.next();

            if (rds.getOtmDependent())
            {
                PersistentField f = rds.getPersistentField();
                Object relObj = f.get(obj);

                if (relObj != null)
                {
                    countCascadeDeleted +=
View Full Code Here

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

      // Get references ObjectReferenceDescriptor
      it = cld.getObjectReferenceDescriptors().iterator();
      while (it.hasNext())
      {
        ObjectReferenceDescriptor objRefDesc = (ObjectReferenceDescriptor)it.next();
        newChildren.add(new OjbMetaObjectReferenceDescriptorNode(
          this.getOjbMetaTreeModel().getRepository(),
          this.getOjbMetaTreeModel(),
          this,
          objRefDesc));
View Full Code Here

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

                broker.commitTransaction();
                broker.clearCache();

                // switch to shallow retrieval
                ClassDescriptor cld = broker.getClassDescriptor(Article.class);
                ObjectReferenceDescriptor ord =
                        (ObjectReferenceDescriptor) cld.getObjectReferenceDescriptors().get(0);
                ord.setCascadeRetrieve(false);
                // should work without setting cld
                // broker.setClassDescriptor(cld);

                Article article = (Article) broker.getObjectByIdentity(tmpOID);
                assertNull("now reference should be null", article.getProductGroup());

                // now switch to deep retrieval
                ord.setCascadeRetrieve(true);
                // should work without setting cld
                // broker.setClassDescriptor(cld);
                broker.clearCache();
                article = (Article) broker.getObjectByIdentity(tmpOID);
                assertNotNull("now reference should NOT be null", article.getProductGroup());
View Full Code Here

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

        broker.clearCache();

        // switch to shallow retrieval
        ClassDescriptor cld = broker.getClassDescriptor(Article.class);
        // article only has one ord
        ObjectReferenceDescriptor ord =
                (ObjectReferenceDescriptor) cld.getObjectReferenceDescriptors().get(0);
        ord.setCascadeRetrieve(false);
        // should work without setting cld
        // broker.setClassDescriptor(cld);

        Article article = (Article) broker.getObjectByIdentity(tmpOID);
        assertNull("now reference should be null", article.getProductGroup());

        // now force loading:
        broker.retrieveReference(article, "productGroup");
        assertNotNull("now reference should NOT be null", article.getProductGroup());

        // repair cld
        ord.setCascadeRetrieve(true);
        // should work without setting cld
        // broker.setClassDescriptor(cld);

    }
View Full Code Here

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

        broker.commitTransaction();
        broker.clearCache();

        // switch to shallow retrieval
        ClassDescriptor cld = broker.getClassDescriptor(Article.class);
        ObjectReferenceDescriptor ord =
                (ObjectReferenceDescriptor) cld.getObjectReferenceDescriptors().get(0);
        ord.setCascadeRetrieve(false);
        // should work without setting cld
        // broker.setClassDescriptor(cld);

        Article article = (Article) broker.getObjectByIdentity(tmpOID);
        assertNull("now reference should be null", article.getProductGroup());

        // now force loading:
        broker.retrieveAllReferences(article);
        assertNotNull("now reference should NOT be null", article.getProductGroup());

        // clean up cld
        ord.setCascadeRetrieve(true);
        // should work without setting cld
        // broker.setClassDescriptor(cld);

    }
View Full Code Here

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

    }

    public void testAutoUpdateDeleteSettings()
    {
        changeRepositoryAutoSetting("ref", true, false, false);
        ObjectReferenceDescriptor ord = broker.getClassDescriptor(Repository.class)
                .getObjectReferenceDescriptorByName("ref");
        assertEquals(ObjectReferenceDescriptor.CASCADE_LINK, ord.getCascadingStore());
        assertEquals(ObjectReferenceDescriptor.CASCADE_NONE, ord.getCascadingDelete());
        assertEquals(false, ord.getCascadeStore());
        assertEquals(false, ord.getCascadeDelete());

        changeRepositoryAutoSetting("ref", true, true, true);
        ord = broker.getClassDescriptor(Repository.class).getObjectReferenceDescriptorByName("ref");
        assertEquals(ObjectReferenceDescriptor.CASCADE_OBJECT, ord.getCascadingStore());
        assertEquals(ObjectReferenceDescriptor.CASCADE_OBJECT, ord.getCascadingDelete());
        assertEquals(true, ord.getCascadeStore());
        assertEquals(true, ord.getCascadeDelete());
    }
View Full Code Here

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

    }

    private void changeRepositoryAutoSetting(String attributeName, boolean retrieve, int update, int delete)
    {
        ClassDescriptor cld = broker.getClassDescriptor(Repository.class);
        ObjectReferenceDescriptor ord = cld.getObjectReferenceDescriptorByName(attributeName);
        ord.setCascadeRetrieve(retrieve);
        ord.setCascadingStore(update);
        ord.setCascadingDelete(delete);
    }
View Full Code Here

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

    }

    private void changeRepositoryAutoSetting(String attributeName, boolean retrieve, boolean update, boolean delete)
    {
        ClassDescriptor cld = broker.getClassDescriptor(Repository.class);
        ObjectReferenceDescriptor ord = cld.getObjectReferenceDescriptorByName(attributeName);
        ord.setCascadeRetrieve(retrieve);
        ord.setCascadeStore(update);
        ord.setCascadeDelete(delete);
    }
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.