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

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


                doc.delete(true);
                return;
            }

            // check out
            ObjectId pwcId = doc.checkOut();
            Document pwc = (Document) session.getObject(pwcId, SELECT_ALL_NO_CACHE_OC);

            addResult(checkObject(session, pwc, getAllProperties(pwc), "PWC spec compliance - test 1"));

            checkCheckedOut(pwc);

            // cancel checkout
            pwc.cancelCheckOut();

            doc.refresh();
            checkCheckedIn(doc);

            // check out again
            pwcId = doc.checkOut();
            pwc = (Document) session.getObject(pwcId, SELECT_ALL_NO_CACHE_OC);

            addResult(checkObject(session, pwc, getAllProperties(pwc), "PWC spec compliance - test 2"));

            checkCheckedOut(pwc);

            // check in
            ObjectId newVersionId = pwc.checkIn(true, null, null, "Test Version 2");
            Document newVersion = (Document) session.getObject(newVersionId, SELECT_ALL_NO_CACHE_OC);

            addResult(checkObject(session, newVersion, getAllProperties(newVersion), "New version compliance"));

            checkCheckedIn(newVersion);
View Full Code Here


    private Document createVersion(Session session, Document doc, String content, int version) {
        CmisTestResult f;

        // check out
        ObjectId pwcId = doc.checkOut();
        Document pwc = (Document) session.getObject(pwcId, SELECT_ALL_NO_CACHE_OC);

        addResult(checkObject(session, pwc, getAllProperties(pwc), "PWC " + version + " compliance"));

        // check in
        byte[] contentBytes;
        try {
            contentBytes = content.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            contentBytes = content.getBytes();
        }
        ContentStream contentStream = new ContentStreamImpl(doc.getName(), BigInteger.valueOf(contentBytes.length),
                "text/plain", new ByteArrayInputStream(contentBytes));

        ObjectId newVersionId = pwc.checkIn(true, null, contentStream, "test version " + version);
        Document newVersion = (Document) session.getObject(newVersionId, SELECT_ALL_NO_CACHE_OC);

        addResult(checkObject(session, newVersion, getAllProperties(newVersion), "Version " + version + " compliance"));

        // check version history
View Full Code Here

    public Document createDocument(Map<String, ?> properties, ContentStream contentStream,
            VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
            OperationContext context) {

        ObjectId newId = getSession().createDocument(properties, this, contentStream, versioningState, policies,
                addAces, removeAces);

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

    public Document createDocumentFromSource(ObjectId source, Map<String, ?> properties,
            VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
            OperationContext context) {

        ObjectId newId = getSession().createDocumentFromSource(source, properties, this, versioningState, policies,
                addAces, removeAces);

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

    }

    public Folder createFolder(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
            List<Ace> removeAces, OperationContext context) {

        ObjectId newId = getSession().createFolder(properties, this, policies, addAces, removeAces);

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

    }

    public Policy createPolicy(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces,
            List<Ace> removeAces, OperationContext context) {

        ObjectId newId = getSession().createPolicy(properties, this, policies, addAces, removeAces);

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

            DocumentTypeDefinition docType = (DocumentTypeDefinition) type;
            VersioningState versioningState = (Boolean.TRUE.equals(docType.isVersionable()) ? VersioningState.MAJOR
                    : VersioningState.NONE);

            // create and fetch the document
            ObjectId id = session.createDocument(properties, testFolder, contentStream, versioningState);
            Document doc = (Document) session.getObject(id);

            // check the new document
            addResult(checkObject(session, doc, getAllProperties(doc), "New document object spec compliance"));
View Full Code Here

                addResult(createResult(SKIPPED,
                        "A content stream is required for this docuemnt type. deleteContentStream() test skipped!"));
            } else {
                // delete content stream
                try {
                    ObjectId newObjectId = workDoc.deleteContentStream(true);

                    // deleteContentStream may have created a new version
                    Document contentDoc = getNewVersion(session, workDoc, checkedout, newObjectId,
                            "deleteContentStream()");

                    f = createResult(FAILURE, "Document still has content after deleteContentStream() has been called!");
                    addResult(assertNull(contentDoc.getContentStream(), null, f));

                    workDoc = contentDoc;
                } catch (CmisNotSupportedException e) {
                    addResult(createResult(WARNING, "deleteContentStream() is not supported!"));
                }
            }

            // set a new content stream
            byte[] contentBytes = new byte[0];
            try {
                contentBytes = CONTENT2.getBytes("UTF-8");
            } catch (Exception e) {
            }

            ContentStream contentStream = new ContentStreamImpl(workDoc.getName(),
                    BigInteger.valueOf(contentBytes.length), "text/plain", new ByteArrayInputStream(contentBytes));

            ObjectId newObjectId = workDoc.setContentStream(contentStream, true, true);

            // setContentStream may have created a new version
            Document contentDoc = getNewVersion(session, workDoc, checkedout, newObjectId, "setContentStream()");

            // test new content
View Full Code Here

            // update
            Map<String, Object> properties = new HashMap<String, Object>();
            properties.put(PropertyIds.NAME, NAME2);

            ObjectId newId = workDoc.updateProperties(properties, false);
            Document doc2 = (Document) session.getObject(newId, SELECT_ALL_NO_CACHE_OC);

            addResult(checkObject(session, doc2, getAllProperties(doc2), "Updated document compliance"));

            f = createResult(FAILURE, "Document name doesn't match updated value!");
View Full Code Here

                String type = ((ObjectTypeItem) typeBox.getSelectedItem()).getObjectType().getId();

                try {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                    ObjectId objectId = getClientModel().createFolder(name, type);

                    if (objectId != null) {
                        getClientModel().loadObject(objectId.getId());
                    }

                    thisDialog.setVisible(false);
                    thisDialog.dispose();
                } catch (Exception e) {
View Full Code Here

TOP

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

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.