Package org.apache.chemistry.opencmis.client.api

Examples of org.apache.chemistry.opencmis.client.api.ObjectFactory


    }

    public ItemIterable<Document> getCheckedOutDocs(OperationContext context) {
        final String objectId = getObjectId();
        final NavigationService navigationService = getBinding().getNavigationService();
        final ObjectFactory objectFactory = getSession().getObjectFactory();
        final OperationContext ctxt = new OperationContextImpl(context);

        return new CollectionIterable<Document>(new AbstractPageFetcher<Document>(ctxt.getMaxItemsPerPage()) {

            @Override
            protected AbstractPageFetcher.Page<Document> fetchPage(long skipCount) {

                // get checked out documents for this folder
                ObjectList checkedOutDocs = navigationService.getCheckedOutDocs(getRepositoryId(), objectId,
                        ctxt.getFilterString(), ctxt.getOrderBy(), ctxt.isIncludeAllowableActions(),
                        ctxt.getIncludeRelationships(), ctxt.getRenditionFilterString(),
                        BigInteger.valueOf(this.maxNumItems), BigInteger.valueOf(skipCount), null);

                // convert objects
                List<Document> page = new ArrayList<Document>();
                if (checkedOutDocs.getObjects() != null) {
                    for (ObjectData objectData : checkedOutDocs.getObjects()) {
                        CmisObject doc = objectFactory.convertObject(objectData, ctxt);
                        if (!(doc instanceof Document)) {
                            // should not happen...
                            continue;
                        }
View Full Code Here


    }

    public ItemIterable<CmisObject> getChildren(OperationContext context) {
        final String objectId = getObjectId();
        final NavigationService navigationService = getBinding().getNavigationService();
        final ObjectFactory objectFactory = getSession().getObjectFactory();
        final OperationContext ctxt = new OperationContextImpl(context);

        return new CollectionIterable<CmisObject>(new AbstractPageFetcher<CmisObject>(ctxt.getMaxItemsPerPage()) {

            @Override
            protected AbstractPageFetcher.Page<CmisObject> fetchPage(long skipCount) {

                // get the children
                ObjectInFolderList children = navigationService.getChildren(getRepositoryId(), objectId,
                        ctxt.getFilterString(), ctxt.getOrderBy(), ctxt.isIncludeAllowableActions(),
                        ctxt.getIncludeRelationships(), ctxt.getRenditionFilterString(), ctxt.isIncludePathSegments(),
                        BigInteger.valueOf(this.maxNumItems), BigInteger.valueOf(skipCount), null);

                // convert objects
                List<CmisObject> page = new ArrayList<CmisObject>();
                List<ObjectInFolderData> childObjects = children.getObjects();
                if (childObjects != null) {
                    for (ObjectInFolderData objectData : childObjects) {
                        if (objectData.getObject() != null) {
                            page.add(objectFactory.convertObject(objectData.getObject(), ctxt));
                        }
                    }
                }

                return new AbstractPageFetcher.Page<CmisObject>(page, children.getNumItems(), children.hasMoreItems());
View Full Code Here

            OperationContext context) {
        if (bindingContainerList == null) {
            return null;
        }

        ObjectFactory of = getSession().getObjectFactory();

        List<Tree<FileableCmisObject>> result = new ArrayList<Tree<FileableCmisObject>>();
        for (ObjectInFolderContainer oifc : bindingContainerList) {
            if ((oifc.getObject() == null) || (oifc.getObject().getObject() == null)) {
                // shouldn't happen ...
                continue;
            }

            // convert the object
            CmisObject object = of.convertObject(oifc.getObject().getObject(), context);
            if (!(object instanceof FileableCmisObject)) {
                // the repository must not return objects that are not fileable,
                // but you never know...
                continue;
            }
View Full Code Here

    @SuppressWarnings({ "rawtypes", "unchecked" })
    protected void initialize(Session session, CmisObject object) {
        this.session = session;
        this.object = object;

        ObjectFactory of = getObjectFactory();

        // --- create snapshot ---

        // properties (modifiable)
        properties = new LinkedHashMap<String, Property<?>>();
        for (Property<?> property : object.getProperties()) {
            properties.put(property.getId(),
                    of.createProperty(property.getDefinition(), new ArrayList(property.getValues())));
        }
        isPropertyUpdateRequired = false;

        // allowable actions (unmodifiable)
        allowableActions = object.getAllowableActions();
View Full Code Here

    protected Acl prepareAcl(List<AceChangeHolder> achList) {
        if ((achList == null) || (achList.isEmpty())) {
            return null;
        }

        ObjectFactory of = getObjectFactory();

        List<Ace> aces = new ArrayList<Ace>();
        for (AceChangeHolder ach : achList) {
            aces.add(of.createAce(ach.getPrincipalId(), ach.getPermissions()));
        }

        return of.createAcl(aces);
    }
View Full Code Here

        this.objectType = objectType;
        this.extensions = new HashMap<ExtensionLevel, List<CmisExtensionElement>>();
        this.creationContext = new OperationContextImpl(context);
        this.refreshTimestamp = System.currentTimeMillis();

        ObjectFactory of = getObjectFactory();

        if (objectData != null) {
            // handle properties
            if (objectData.getProperties() != null) {
                this.properties = of.convertProperties(objectType, objectData.getProperties());
                extensions.put(ExtensionLevel.PROPERTIES, objectData.getProperties().getExtensions());
            }

            // handle allowable actions
            if (objectData.getAllowableActions() != null) {
                this.allowableActions = objectData.getAllowableActions();
                extensions.put(ExtensionLevel.ALLOWABLE_ACTIONS, objectData.getAllowableActions().getExtensions());
            }

            // handle renditions
            if (objectData.getRenditions() != null) {
                this.renditions = new ArrayList<Rendition>();
                for (RenditionData rd : objectData.getRenditions()) {
                    this.renditions.add(of.convertRendition(getId(), rd));
                }
            }

            // handle ACL
            if (objectData.getAcl() != null) {
                acl = objectData.getAcl();
                extensions.put(ExtensionLevel.ACL, objectData.getAcl().getExtensions());
            }

            // handle policies
            if ((objectData.getPolicyIds() != null) && (objectData.getPolicyIds().getPolicyIds() != null)) {
                policies = new ArrayList<Policy>();
                for (String pid : objectData.getPolicyIds().getPolicyIds()) {
                    CmisObject policy = session.getObject(getSession().createObjectId(pid));
                    if (policy instanceof Policy) {
                        policies.add((Policy) policy);
                    }
                }
                extensions.put(ExtensionLevel.POLICIES, objectData.getPolicyIds().getExtensions());
            }

            // handle relationships
            if (objectData.getRelationships() != null) {
                relationships = new ArrayList<Relationship>();
                for (ObjectData rod : objectData.getRelationships()) {
                    CmisObject relationship = of.convertObject(rod, this.creationContext);
                    if (relationship instanceof Relationship) {
                        relationships.add((Relationship) relationship);
                    }
                }
            }
View Full Code Here

        this.objectType = objectType;
        this.extensions = new HashMap<ExtensionLevel, List<Object>>();
        this.creationContext = new OperationContextImpl(context);
        this.refreshTimestamp = System.currentTimeMillis();

        ObjectFactory of = getObjectFactory();

        if (objectData != null) {
            // handle properties
            if (objectData.getProperties() != null) {
                this.properties = of.convertProperties(objectType, objectData.getProperties());
                extensions.put(ExtensionLevel.PROPERTIES, objectData.getProperties().getExtensions());
            }

            // handle allowable actions
            if (objectData.getAllowableActions() != null) {
                this.allowableActions = objectData.getAllowableActions();
                extensions.put(ExtensionLevel.ALLOWABLE_ACTIONS, objectData.getAllowableActions().getExtensions());
            }

            // handle renditions
            if (objectData.getRenditions() != null) {
                this.renditions = new ArrayList<Rendition>();
                for (RenditionData rd : objectData.getRenditions()) {
                    this.renditions.add(of.convertRendition(getId(), rd));
                }
            }

            // handle ACL
            if (objectData.getAcl() != null) {
                acl = objectData.getAcl();
                extensions.put(ExtensionLevel.ACL, objectData.getAcl().getExtensions());
            }

            // handle policies
            if ((objectData.getPolicyIds() != null) && (objectData.getPolicyIds().getPolicyIds() != null)) {
                policies = new ArrayList<Policy>();
                for (String pid : objectData.getPolicyIds().getPolicyIds()) {
                    CmisObject policy = session.getObject(getSession().createObjectId(pid));
                    if (policy instanceof Policy) {
                        policies.add((Policy) policy);
                    }
                }
                extensions.put(ExtensionLevel.POLICIES, objectData.getPolicyIds().getExtensions());
            }

            // handle relationships
            if (objectData.getRelationships() != null) {
                relationships = new ArrayList<Relationship>();
                for (ObjectData rod : objectData.getRelationships()) {
                    CmisObject relationship = of.convertObject(rod, this.creationContext);
                    if (relationship instanceof Relationship) {
                        relationships.add((Relationship) relationship);
                    }
                }
            }
View Full Code Here

    }

    public Acl applyAcl(List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation) {
        String objectId = getObjectId();

        ObjectFactory of = getObjectFactory();

        return getBinding().getAclService().applyAcl(getRepositoryId(), objectId, of.convertAces(addAces),
                of.convertAces(removeAces), aclPropagation, null);
    }
View Full Code Here

            throw new IllegalArgumentException("Properties must not be empty!");
        }

        String objectId = getObjectId();

        ObjectFactory of = getObjectFactory();

        String newId = getBinding().getObjectService().createDocument(getRepositoryId(),
                of.convertProperties(properties, null, CREATE_UPDATABILITY), objectId,
                of.convertContentStream(contentStream), versioningState, of.convertPolicies(policies),
                of.convertAces(addAces), of.convertAces(removeAces), null);

        // if no context is provided the object will not be fetched
        if ((context == null) || (newId == null)) {
            return null;
        }
View Full Code Here

        if (type.getBaseTypeId() != BaseTypeId.CMIS_DOCUMENT) {
            throw new IllegalArgumentException("Source object must be a document!");
        }

        ObjectFactory of = getObjectFactory();

        Set<Updatability> updatebility = new HashSet<Updatability>();
        updatebility.add(Updatability.READWRITE);

        String newId = getBinding().getObjectService().createDocumentFromSource(getRepositoryId(), source.getId(),
                of.convertProperties(properties, type, updatebility), objectId, versioningState,
                of.convertPolicies(policies), of.convertAces(addAces), of.convertAces(removeAces), null);

        // if no context is provided the object will not be fetched
        if ((context == null) || (newId == null)) {
            return null;
        }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.client.api.ObjectFactory

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.