Examples of ManageableCollection


Examples of org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection

        continue;
      }

      CollectionConverter collectionConverter = this.getCollectionConverter(session, collectionDescriptor);
      Object collection = ReflectionUtils.getNestedProperty(object, collectionDescriptor.getFieldName());
      ManageableCollection manageableCollection = ManageableCollectionUtil.getManageableCollection(collection);

      collectionConverter.updateCollection(session, objectNode, collectionDescriptor, manageableCollection);
    }
  }
View Full Code Here

Examples of org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection

    protected ManageableCollection doGetCollection(Session session,
                                                   Node parentNode,
                                                   CollectionDescriptor collectionDescriptor,
                                                   Class collectionFieldClass) throws RepositoryException {
      ClassDescriptor elementClassDescriptor = mapper.getClassDescriptorByClass( ReflectionUtils.forName(collectionDescriptor.getElementClassName()));
        ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);

        NodeIterator nodes = this.getCollectionNodes(session, parentNode, elementClassDescriptor.getJcrType());
       
        if (nodes == null || nodes.getSize() == 0)
        {
          return null;
        }
               
        while (nodes.hasNext()) {
            Node itemNode = (Node) nodes.next();
            log.debug("Collection node found : " + itemNode.getPath());
            Object item = objectConverter.getObject(session,  itemNode.getPath());
            collection.addObject(item);
        }

        return collection;
    }
View Full Code Here

Examples of org.apache.ojb.broker.ManageableCollection

        //obtain current ODMG transaction
        TransactionImpl tx = odmg.getTxManager().getTransaction();
        // create PBCapsule
        PBCapsule capsule = null;
        ManageableCollection result = null;

        try
        {
            capsule = new PBCapsule(odmg.getCurrentPBKey(), tx);
            PersistenceBroker broker = capsule.getBroker();

            // ask the broker to perfom the query.
            // the concrete result type is configurable

            if (!(query instanceof ReportQuery))
            {
                result = broker.getCollectionByQuery(this.getCollectionClass(), query);
                performLockingIfRequired(tx, broker, result);
            }
            else
            {
                Iterator iter = null;
                result = new ManageableArrayList();
                iter = broker.getReportQueryIteratorByQuery(query);
                try
                {
                    while (iter.hasNext())
                    {
                        Object[] res = (Object[]) iter.next();

                        if (res.length == 1)
                        {
                            if (res[0] != null) // skip null values
                            {
                                result.ojbAdd(res[0]);
                            }
                        }
                        else
                        {
                            // skip null tuples
                            for (int i = 0; i < res.length; i++)
                            {
                                if (res[i] != null)
                                {
                                    result.ojbAdd(res);
                                    break;
                                }
                            }
                        }
                    }
View Full Code Here

Examples of org.apache.ojb.broker.ManageableCollection

                    Array.set(result, j, list.get(j));
                }
            }
            else
            {
                ManageableCollection col = createCollection(cds, collectionClass);
                for (Iterator it2 = list.iterator(); it2.hasNext();)
                {
                    col.ojbAdd(it2.next());
                }
                result = col;
            }

            Object value = field.get(owner);
View Full Code Here

Examples of org.apache.ojb.broker.ManageableCollection

     * @return The collection object
     */
    protected ManageableCollection createCollection(CollectionDescriptor desc, Class collectionClass)
    {
        Class                fieldType = desc.getPersistentField().getType();
        ManageableCollection col;

        if (collectionClass == null)
        {
            if (ManageableCollection.class.isAssignableFrom(fieldType))
            {
View Full Code Here

Examples of org.apache.ojb.broker.ManageableCollection

        OQLQuery query = odmg.newOQLQuery();
        String sql = "select allArticles from " + PerformanceArticle.class.getName()
                + " where articleId between " + new Integer(offsetId) + " and "
                + new Integer(offsetId + articleCount);
        query.create(sql);
        ManageableCollection collection = (ManageableCollection) query.execute();
        Iterator iter = collection.ojbIterator();
        int fetchCount = 0;
        while(iter.hasNext())
        {
            fetchCount++;
            iter.next();
View Full Code Here

Examples of org.apache.ojb.broker.ManageableCollection

        query.bind(new Timestamp(System.currentTimeMillis() - 5000)); // a while ago (effValue3 > $3)
        query.bind(new Integer(20)); // effValue2 <= $4
        query.bind(new Timestamp(System.currentTimeMillis() + 5000)); // a while from now (effValue3<$5)
        query.bind(new Integer(5)); // version.contract.relatedToContract.relatedValue2=$6

        ManageableCollection all = (ManageableCollection) query.execute();
        java.util.Iterator it = all.ojbIterator();
        /**
         * make sure we got
         */
        int i = 0;
        while (it.hasNext())
View Full Code Here

Examples of org.apache.ojb.broker.ManageableCollection

        query.bind("effValue1.testComplexOQL"); // effValue1 = $2
        query.bind(new Timestamp(System.currentTimeMillis() - 5000)); // a while ago (effValue3 > $3)
        query.bind(new Integer(20)); // effValue2 <= $4
        query.bind(new Timestamp(System.currentTimeMillis() + 5000)); // a while from now (effValue3<$5)

        ManageableCollection all = (ManageableCollection) query.execute();
        java.util.Iterator it = all.ojbIterator();
        /**
         * make sure we got
         */
        int i = 0;
        while (it.hasNext())
View Full Code Here

Examples of org.apache.ojb.broker.ManageableCollection

        createData(database, odmg);
        OQLQuery query = odmg.newOQLQuery();
        int i = 0;
        query.create("select effectiveness from " + Effectiveness.class.getName() + " where version.versionValue1=$1");
        query.bind("versionvalue1");
        ManageableCollection all = (ManageableCollection) query.execute();
        java.util.Iterator it = all.ojbIterator();
        Effectiveness temp = null;
        while (it.hasNext())
        {
            temp = (Effectiveness) it.next();
            if (!temp.getVersion().getVersionValue1().equals("versionvalue1"))
View Full Code Here

Examples of org.apache.ojb.broker.ManageableCollection

  public void testGetEmbeddedObject() throws Exception
    {
        createData(database, odmg);
        OQLQuery query = odmg.newOQLQuery();
        query.create("select effectiveness.version from " + Effectiveness.class.getName() + " where is_defined(effectiveness.version.versionValue1)");
        ManageableCollection all = (ManageableCollection) query.execute();
        java.util.Iterator it = all.ojbIterator();
        while (it.hasNext())
        {
            assertTrue("Selected item is Version", (it.next() instanceof Version));
        }

        query.create("select effectiveness.version.contract from " + Effectiveness.class.getName() + " where is_defined(effectiveness.version.versionValue1)");
        all = (ManageableCollection) query.execute();
        it = all.ojbIterator();
        while (it.hasNext())
        {
            assertTrue("Selected item is Contract", (it.next() instanceof Contract));
        }
    }
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.