Package org.apache.chemistry.opencmis.commons.data

Examples of org.apache.chemistry.opencmis.commons.data.ObjectList


            BigInteger maxItems, BigInteger skipCount) {
        TypeManager tm = getTypeManager(repositoryId);
        ObjectStore objectStore = getObjectStore(repositoryId);

        InMemoryQueryProcessor queryProcessor = new InMemoryQueryProcessor();
        ObjectList objList = queryProcessor.query(tm, objectStore, user, repositoryId, statement, searchAllVersions,
                includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount);

   //     LOG.debug("Query result, number of matching objects: " + objList.getNumItems());
        return objList;
    }
View Full Code Here


        for (String objectId : ((ObjectStoreImpl) objectStore).getIds()) {
            StoredObject so = objectStore.getObjectById(objectId);
            match(so, user, searchAllVersions == null ? true : searchAllVersions.booleanValue());
        }

        ObjectList objList = buildResultList(tm, user, includeAllowableActions, includeRelationships, renditionFilter,
                maxItems, skipCount);
        LOG.debug("Query result, number of matching objects: " + objList.getNumItems());
        return objList;
    }
View Full Code Here

        } else {
            throw new CmisRuntimeException("Invalid HTTP method!");
        }

        // execute
        ObjectList results = service.query(repositoryId, statement, searchAllVersions, includeAllowableActions,
                includeRelationships, renditionFilter, maxItems, skipCount, null);

        if (results == null) {
            throw new CmisRuntimeException("Results are null!");
        }

        // set headers
        UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);

        UrlBuilder pagingUrl = compileUrlBuilder(baseUrl, RESOURCE_QUERY, null);
        pagingUrl.addParameter(Constants.PARAM_Q, statement);
        pagingUrl.addParameter(Constants.PARAM_SEARCH_ALL_VERSIONS, searchAllVersions);
        pagingUrl.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
        pagingUrl.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);

        UrlBuilder location = new UrlBuilder(pagingUrl);
        location.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
        location.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);

        response.setStatus(statusCode);
        response.setContentType(Constants.MEDIATYPE_FEED);

        // The Content-Location header is optional (CMIS specification 3.7.2.1).
        // Since it can cause problems with long query statements it is
        // deactivated.
        // response.setHeader("Content-Location", location.toString());

        // The Location header is not optional (CMIS specification 3.7.2.1).
        response.setHeader("Location", location.toString());

        // write XML
        AtomFeed feed = new AtomFeed();
        feed.startDocument(response.getOutputStream());
        feed.startFeed(true);

        // write basic Atom feed elements
        GregorianCalendar now = new GregorianCalendar();
        feed.writeFeedElements("query", "", "Query", now, null, results.getNumItems());

        // write links
        feed.writeServiceLink(baseUrl.toString(), repositoryId);

        feed.writePagingLinks(pagingUrl, maxItems, skipCount, results.getNumItems(), results.hasMoreItems(),
                AtomPubUtils.PAGE_SIZE);

        if (results.getObjects() != null) {
            AtomEntry entry = new AtomEntry(feed.getWriter());
            int idCounter = 0;
            for (ObjectData result : results.getObjects()) {
                if (result == null) {
                    continue;
                }
                idCounter++;
                writeQueryResultEntry(entry, result, "id-" + idCounter, now);
View Full Code Here

        Boolean includeAcl = getBooleanParameter(request, Constants.PARAM_ACL);
        BigInteger maxItems = getBigIntegerParameter(request, Constants.PARAM_MAX_ITEMS);

        // execute
        Holder<String> changeLogTokenHolder = new Holder<String>(changeLogToken);
        ObjectList changes = service.getContentChanges(repositoryId, changeLogTokenHolder, includeProperties, filter,
                includePolicyIds, includeAcl, maxItems, null);

        if (changes == null) {
            throw new CmisRuntimeException("Changes are null!");
        }

        // set headers
        response.setStatus(HttpServletResponse.SC_OK);
        response.setContentType(Constants.MEDIATYPE_FEED);

        // write XML
        AtomFeed feed = new AtomFeed();
        feed.startDocument(response.getOutputStream());
        feed.startFeed(true);

        // write basic Atom feed elements
        GregorianCalendar now = new GregorianCalendar();
        feed.writeFeedElements("contentChanges", "", "Content Change", now, null, changes.getNumItems());

        // write links
        UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);

        feed.writeServiceLink(baseUrl.toString(), repositoryId);

        if (changeLogTokenHolder.getValue() != null) {
            UrlBuilder nextLink = compileUrlBuilder(baseUrl, RESOURCE_CHANGES, null);
            nextLink.addParameter(Constants.PARAM_CHANGE_LOG_TOKEN, changeLogTokenHolder.getValue());
            nextLink.addParameter(Constants.PARAM_PROPERTIES, includeProperties);
            nextLink.addParameter(Constants.PARAM_FILTER, filter);
            nextLink.addParameter(Constants.PARAM_POLICY_IDS, includePolicyIds);
            nextLink.addParameter(Constants.PARAM_ACL, includeAcl);
            nextLink.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
            feed.writeNextLink(nextLink.toString());
        }

        // write entries
        if (changes.getObjects() != null) {
            AtomEntry entry = new AtomEntry(feed.getWriter());
            for (ObjectData object : changes.getObjects()) {
                if (object == null) {
                    continue;
                }
                writeContentChangesObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false);
            }
View Full Code Here

        try {
            service = getService(wsContext, repositoryId);

            org.apache.chemistry.opencmis.commons.spi.Holder<String> changeLogTokenHolder = convertHolder(changeLogToken);

            ObjectList changesList = service.getContentChanges(repositoryId, changeLogTokenHolder, includeProperties,
                    filter, includePolicyIds, includeAcl, maxItems, convert(extension));

            if (objects != null) {
                objects.value = convert(changesList);
            }
View Full Code Here

        String renditionFilter = null;
        BigInteger maxItems = getBigIntegerParameter(request, Constants.PARAM_MAX_ITEMS);
        BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);

        // execute
        ObjectList results = service.query(repositoryId, statement, searchAllVersions, includeAllowableActions,
                includeRelationships, renditionFilter, maxItems, skipCount, null);

        if (results == null) {
            throw new CmisRuntimeException("Results are null!");
        }
View Full Code Here

        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);
        idHolder = new Holder<String>(verSeriesIds[2]);
        fVerSvc.checkOut(fRepositoryId, idHolder, null, contentCopied);

        // must be one in first folder
        ObjectList checkedOutDocuments = fNavSvc.getCheckedOutDocs(fRepositoryId, folderIds[0], "*", null, false,
                IncludeRelationships.NONE, null, BigInteger.valueOf(-1), BigInteger.valueOf(-1), null);
        assertEquals(1, checkedOutDocuments.getNumItems().longValue());
        assertEquals(1, checkedOutDocuments.getObjects().size());

        // must be one in second folder
        checkedOutDocuments = fNavSvc.getCheckedOutDocs(fRepositoryId, folderIds[1], "*", null, false,
                IncludeRelationships.NONE, null, BigInteger.valueOf(-1), BigInteger.valueOf(-1), null);
        assertEquals(1, checkedOutDocuments.getNumItems().longValue());
        assertEquals(1, checkedOutDocuments.getObjects().size());

        // must be two in repository
        checkedOutDocuments = fNavSvc.getCheckedOutDocs(fRepositoryId, null, "*", null, false,
                IncludeRelationships.NONE, null, BigInteger.valueOf(-1), BigInteger.valueOf(-1), null);
        assertEquals(2, checkedOutDocuments.getNumItems().longValue());
        assertEquals(2, checkedOutDocuments.getObjects().size());
    }
View Full Code Here

    }

    @Test
    public void testAll() {
        String statement = "SELECT * FROM cmis:document";
        ObjectList res = doQuery(statement);
        assertEquals(5, res.getObjects().size());
        assertTrue(resultContains("alpha", res));
        assertFalse(resultContains("jens", res));
    }
View Full Code Here

    // Boolean tests

    @Test
    public void testBooleanEquals() {
        String statement = "SELECT * FROM " + COMPLEX_TYPE + " WHERE " + PROP_ID_BOOLEAN + "= true";
        ObjectList res = doQuery(statement);
        assertEquals(3, res.getObjects().size());
        assertTrue(resultContains("alpha", res));
        assertTrue(resultContains("gamma", res));
        assertTrue(resultContains("delta", res));
    }
View Full Code Here

    }

    @Test
    public void testBooleanNotEquals() {
        String statement = "SELECT * FROM " + COMPLEX_TYPE + " WHERE " + PROP_ID_BOOLEAN + "= false";
        ObjectList res = doQuery(statement);
        assertEquals(2, res.getObjects().size());
        assertTrue(resultContains("beta", res));
        assertTrue(resultContains("epsilon", res));
    }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.data.ObjectList

Copyright © 2018 www.massapicom. 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.