Package org.apache.chemistry.opencmis.commons.server

Examples of org.apache.chemistry.opencmis.commons.server.ObjectInfo


        if (checkedOut == null) {
            throw new CmisRuntimeException("Checked Out list is null!");
        }

        ObjectInfo folderInfo = null;
        if (folderId != null) {
            folderInfo = service.getObjectInfo(repositoryId, folderId);
            if (folderInfo == null) {
                throw new CmisRuntimeException("Folder Object Info is missing!");
            }
        } else {
            folderInfo = new ObjectInfoImpl();
            GregorianCalendar now = new GregorianCalendar();

            ((ObjectInfoImpl) folderInfo).setId("uri:x-checkedout");
            ((ObjectInfoImpl) folderInfo).setName("Checked Out");
            ((ObjectInfoImpl) folderInfo).setCreatedBy("");
            ((ObjectInfoImpl) folderInfo).setCreationDate(now);
            ((ObjectInfoImpl) folderInfo).setLastModificationDate(now);
            ((ObjectInfoImpl) folderInfo).setHasParent(false);
            ((ObjectInfoImpl) folderInfo).setSupportsDescendants(false);
            ((ObjectInfoImpl) folderInfo).setSupportsFolderTree(false);
        }

        // 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
        feed.writeFeedElements(folderInfo.getId(), folderInfo.getCreatedBy(), folderInfo.getName(),
                folderInfo.getLastModificationDate(), null, checkedOut.getNumItems());

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

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

        feed.writeSelfLink(compileUrl(baseUrl, RESOURCE_CHECKEDOUT, folderInfo.getId()), null);

        UrlBuilder pagingUrl = new UrlBuilder(compileUrlBuilder(baseUrl, RESOURCE_CHECKEDOUT, folderInfo.getId()));
        pagingUrl.addParameter(Constants.PARAM_FILTER, filter);
        pagingUrl.addParameter(Constants.PARAM_ORDER_BY, orderBy);
        pagingUrl.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
        pagingUrl.addParameter(Constants.PARAM_RELATIONSHIPS, includeRelationships);
        pagingUrl.addParameter(Constants.PARAM_RENDITION_FILTER, renditionFilter);
View Full Code Here


        // execute
        Holder<String> checkOutId = new Holder<String>(parser.getId());
        service.checkOut(repositoryId, checkOutId, null, null);

        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, checkOutId.getValue());
        if (objectInfo == null) {
            throw new CmisRuntimeException("Object Info is missing!");
        }

        ObjectData object = objectInfo.getObject();
        if (object == null) {
            throw new CmisRuntimeException("Object is null!");
        }

        if (object.getId() == null) {
View Full Code Here

        if (versions == null) {
            throw new CmisRuntimeException("Versions are null!");
        }

        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
        if (objectInfo == null) {
            throw new CmisRuntimeException("Version Series Info is missing!");
        }

        // 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
        feed.writeFeedElements(objectInfo.getId(), objectInfo.getCreatedBy(), objectInfo.getName(), objectInfo
                .getLastModificationDate(), null, null);

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

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

        feed.writeSelfLink(compileUrl(baseUrl, RESOURCE_VERSIONS, objectInfo.getId()), null);

        feed.writeViaLink(compileUrl(baseUrl, RESOURCE_ENTRY, objectId));

        // write entries
        AtomEntry entry = new AtomEntry(feed.getWriter());
View Full Code Here

        if (relationships == null) {
            throw new CmisRuntimeException("Relationships are null!");
        }

        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
        if (objectInfo == null) {
            throw new CmisRuntimeException("Object Info is missing!");
        }

        // 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
        feed.writeFeedElements(objectInfo.getId(), objectInfo.getCreatedBy(), objectInfo.getName(),
                objectInfo.getLastModificationDate(), null, relationships.getNumItems());

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

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

        feed.writeSelfLink(compileUrl(baseUrl, RESOURCE_RELATIONSHIPS, objectInfo.getId()), null);

        UrlBuilder pagingUrl = new UrlBuilder(compileUrlBuilder(baseUrl, RESOURCE_RELATIONSHIPS, objectInfo.getId()));
        pagingUrl.addParameter(Constants.PARAM_SUB_RELATIONSHIP_TYPES, includeSubRelationshipTypes);
        pagingUrl.addParameter(Constants.PARAM_RELATIONSHIP_DIRECTION, relationshipDirection);
        pagingUrl.addParameter(Constants.PARAM_TYPE_ID, typeId);
        pagingUrl.addParameter(Constants.PARAM_FILTER, filter);
        pagingUrl.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, includeAllowableActions);
View Full Code Here

        if (policies == null) {
            throw new CmisRuntimeException("Policies are null!");
        }

        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
        if (objectInfo == null) {
            throw new CmisRuntimeException("Object Info is missing!");
        }

        // 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
        feed.writeFeedElements(objectInfo.getId(), objectInfo.getCreatedBy(), objectInfo.getName(),
                objectInfo.getLastModificationDate(), null, null);

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

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

        feed.writeSelfLink(compileUrl(baseUrl, RESOURCE_POLICIES, objectInfo.getId()), null);

        // write entries
        AtomEntry entry = new AtomEntry(feed.getWriter());
        for (ObjectData policy : policies) {
            if (policy == null) {
                continue;
            }
            writePolicyEntry(service, entry, objectInfo.getId(), policy, repositoryId, baseUrl);
        }

        // we are done
        feed.endFeed();
        feed.endDocument();
View Full Code Here

        AtomEntryParser parser = new AtomEntryParser(request.getInputStream());

        // execute
        service.applyPolicy(repositoryId, parser.getId(), objectId, null);

        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, parser.getId());
        if (objectInfo == null) {
            throw new CmisRuntimeException("Object Info is missing!");
        }

        ObjectData policy = objectInfo.getObject();
        if (policy == null) {
            throw new CmisRuntimeException("Policy is null!");
        }

        // set headers
View Full Code Here

        CmisObjectType resultJaxb = convert(policy);
        if (resultJaxb == null) {
            return;
        }

        ObjectInfo info = service.getObjectInfo(repositoryId, policy.getId());
        if (info == null) {
            throw new CmisRuntimeException("Object Info not found!");
        }

        // start
        entry.startEntry(false);

        // write the object
        entry.writeObject(policy, info, null, null, null, null);

        // write links
        UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_POLICIES, objectId);
        selfLink.addParameter(Constants.PARAM_POLICY_ID, info.getId());
        entry.writeSelfLink(selfLink.toString(), null);

        // we are done
        entry.endEntry();
    }
View Full Code Here

                service.moveObject(repositoryId, objectIdHolder, folderId, sourceFolderId, null);
                newObjectId = objectIdHolder.getValue();
            }
        }

        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, newObjectId);
        if (objectInfo == null) {
            throw new CmisRuntimeException("Object Info is missing!");
        }

        ObjectData object = objectInfo.getObject();
        if (object == null) {
            throw new CmisRuntimeException("Object is null!");
        }

        // set headers
View Full Code Here

        // execute
        String newObjectId = service.createRelationship(repositoryId, parser.getProperties(), parser.getPolicyIds(),
                null, null, null);

        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, newObjectId);
        if (objectInfo == null) {
            throw new CmisRuntimeException("Object Info is missing!");
        }

        ObjectData object = objectInfo.getObject();
        if (object == null) {
            throw new CmisRuntimeException("Object is null!");
        }

        // set headers
View Full Code Here

        if (object == null) {
            throw new CmisRuntimeException("Object is null!");
        }

        ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
        if (objectInfo == null) {
            throw new CmisRuntimeException("Object Info is missing!");
        }

        // set headers
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.server.ObjectInfo

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.