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

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


        assertEquals(content1, content2);
    }

    @Test
    public void createDocumentAndUpdateContent() throws IOException {
        ObjectId parentId = session.createObjectId(fixture.getTestRootId());
        String folderName = UUID.randomUUID().toString();
        String typeId = FixtureData.DOCUMENT_TYPE_ID.value();

        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put(PropertyIds.NAME, folderName);
        properties.put(PropertyIds.OBJECT_TYPE_ID, typeId);

        String filename1 = UUID.randomUUID().toString();
        String mimetype = "text/html; charset=UTF-8";
        String content1 = "Im Walde rauscht ein Wasserfall. Wenn's nicht mehr rauscht ist's Wasser all.";

        byte[] buf1 = content1.getBytes("UTF-8");
        ByteArrayInputStream in1 = new ByteArrayInputStream(buf1);
        ContentStream contentStream1 = session.getObjectFactory().createContentStream(filename1, buf1.length, mimetype,
                in1);
        assertNotNull(contentStream1);

        ObjectId id = session.createDocument(properties, parentId, contentStream1, VersioningState.NONE);
        assertNotNull(id);

        // set and verify content
        String filename2 = UUID.randomUUID().toString();
        String content2 = "abc";
View Full Code Here


    }

    @Ignore
    @Test(expected = CmisContentAlreadyExistsException.class)
    public void createDocumentAndUpdateContentNoOverwrite() throws IOException {
        ObjectId parentId = session.createObjectId(fixture.getTestRootId());
        String folderName = UUID.randomUUID().toString();
        String typeId = FixtureData.DOCUMENT_TYPE_ID.value();

        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put(PropertyIds.NAME, folderName);
        properties.put(PropertyIds.OBJECT_TYPE_ID, typeId);

        String filename1 = UUID.randomUUID().toString();
        String mimetype = "text/html; charset=UTF-8";
        String content1 = "Im Walde rauscht ein Wasserfall. Wenn's nicht mehr rauscht ist's Wasser all.";

        byte[] buf1 = content1.getBytes("UTF-8");
        ByteArrayInputStream in1 = new ByteArrayInputStream(buf1);
        ContentStream contentStream1 = session.getObjectFactory().createContentStream(filename1, buf1.length, mimetype,
                in1);
        assertNotNull(contentStream1);

        ObjectId id = session.createDocument(properties, parentId, contentStream1, VersioningState.NONE);
        assertNotNull(id);

        // set and verify content
        String filename2 = UUID.randomUUID().toString();
        String content2 = "abc";
View Full Code Here

            if (properties.isEmpty()) {
                return false;
            }

            ObjectId newId = object.updateProperties(properties, false);

            if ((newId != null) && newId.getId().equals(model.getCurrentObject().getId())) {
                try {
                    model.reloadObject();
                    model.reloadFolder();
                } catch (Exception ex) {
                    ClientHelper.showError(null, ex);
View Full Code Here

        return getObject().getAllowableActions().getAllowableActions().contains(Action.CAN_ADD_OBJECT_TO_FOLDER);
    }

    @Override
    public void doAction() throws Exception {
        ObjectId folderId = getClientModel().getClientSession().getSession().createObjectId(folderField.getText());
        ((FileableCmisObject) getObject()).addToFolder(folderId, allVersionsBox.isSelected());
    }
View Full Code Here

        return getObject().getAllowableActions().getAllowableActions().contains(Action.CAN_REMOVE_OBJECT_FROM_FOLDER);
    }

    @Override
    public void doAction() throws Exception {
        ObjectId folderId = getClientModel().getClientSession().getSession().createObjectId(folderField.getText());
        ((FileableCmisObject) getObject()).removeFromFolder(folderId);
    }
View Full Code Here

                        versioningState = VersioningState.CHECKEDOUT;
                    }

                    if (filename.length() > 0) {
                        // create a document from a file
                        ObjectId objectId = getClientModel().createDocument(name, type, filename, versioningState,
                                unfiledButton.isSelected());

                        if (verifyAfterUploadButton.isSelected()) {
                            ContentStream contentStream = getClientModel().createContentStream(filename);
                            verifyContentStreams(contentStream, objectId);
                        }
                    } else {
                        // create a document with random data
                        long seed = System.currentTimeMillis();
                        long length = ((Number) generateContentSizeField.getValue()).longValue();
                        if (length < 0) {
                            length = 0;
                        } else {
                            for (int i = 0; i < generateContentUnitField.getSelectedIndex(); i++) {
                                length = length * 1024;
                            }
                        }

                        ObjectId objectId = getClientModel().createDocument(name, type, length, seed, versioningState,
                                unfiledButton.isSelected());

                        if (verifyAfterUploadButton.isSelected()) {
                            ContentStream contentStream = getClientModel().createContentStream("", length, seed);
                            verifyContentStreams(contentStream, objectId);
View Full Code Here

        properties.put(PropertyIds.NAME, name);
        properties.put(PropertyIds.OBJECT_TYPE_ID, objectTypeId);
        properties.put(PropertyIds.SOURCE_ID, source.getId());
        properties.put(PropertyIds.TARGET_ID, target.getId());

        ObjectId relId;
        Relationship result = null;

        try {
            relId = session.createRelationship(properties);
            result = (Relationship) session.getObject(relId, SELECT_ALL_NO_CACHE_OC);
View Full Code Here

        properties.put(PropertyIds.NAME, name);
        properties.put(PropertyIds.OBJECT_TYPE_ID, objectTypeId);
        properties.put(PropertyIds.SOURCE_ID, source.getId());
        properties.put(PropertyIds.TARGET_ID, target.getId());

        ObjectId relId;
        Relationship result = null;

        try {
            relId = session.createRelationship(properties);
            result = (Relationship) session.getObject(relId, SELECT_ALL_NO_CACHE_OC);
View Full Code Here

                        versioningState = VersioningState.MINOR;
                    } else if (versioningStateCheckedoutButton.isSelected()) {
                        versioningState = VersioningState.CHECKEDOUT;
                    }

                    ObjectId objectId = null;
                    if (filename.length() > 0) {
                        // create a document from a file
                        objectId = getClientModel().createDocument(name, type, filename, versioningState,
                                unfiledButton.isSelected());

                        if (verifyAfterUploadButton.isSelected()) {
                            ContentStream contentStream = getClientModel().createContentStream(filename);
                            verifyContentStreams(contentStream, objectId);
                        }
                    } else {
                        // create a document with random data
                        long seed = System.currentTimeMillis();
                        long length = ((Number) generateContentSizeField.getValue()).longValue();
                        if (length < 0) {
                            length = 0;
                        } else {
                            for (int i = 0; i < generateContentUnitField.getSelectedIndex(); i++) {
                                length = length * 1024;
                            }
                        }

                        objectId = getClientModel().createDocument(name, type, length, seed, versioningState,
                                unfiledButton.isSelected());

                        if (verifyAfterUploadButton.isSelected()) {
                            ContentStream contentStream = getClientModel().createContentStream("", length, seed);
                            verifyContentStreams(contentStream, objectId);
                        }
                    }

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

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

            DocumentTypeDefinition docType = (DocumentTypeDefinition) doc.getType();

            if (!docType.isVersionable()) {
                addResult(createResult(WARNING, "Test type is not versionable. Check out skipped!"));
            } else {
                ObjectId pwcId = doc.checkOut();
                pwc = (Document) session.getObject(pwcId, SELECT_ALL_NO_CACHE_OC);
            }

            // test all checked-out documents
            int sessionCheckedOut = checkPWCs(session, session.getCheckedOutDocs(SELECT_ALL_NO_CACHE_OC_ORDER_BY_NAME));
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.