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

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


    public void singleClickAction(MouseEvent e, int rowIndex, int colIndex) {
        if (getColumnClass(colIndex) != ObjectId.class) {
            return;
        }

        ObjectId id = (ObjectId) getValueAt(rowIndex, colIndex);
        if ((id == null) || (id.getId() == null)) {
            return;
        }

        try {
            getClientModel().loadObject(id.getId());
            setTab(0);
        } catch (Exception ex) {
            ClientHelper.showError(this, ex);
        }
    }
View Full Code Here


public abstract class AbstractWriteObjectIT extends AbstractSessionTest {

    @Test
    public void createFolder() {
        ObjectId parentId = this.session.createObjectId(this.fixture.getTestRootId());
        String folderName = UUID.randomUUID().toString();
        String typeId = FixtureData.FOLDER_TYPE_ID.value();

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

        ObjectId id = this.session.createFolder(properties, parentId, null, null, null);
        assertNotNull(id);
    }
View Full Code Here

        assertNotNull(id);
    }

    @Test
    public void createDocument() throws IOException {
        ObjectId parentId = this.session.createObjectId(this.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 filename = 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 contentStream = this.session.getObjectFactory().createContentStream(filename, buf1.length,
                mimetype, in1);
        assertNotNull(contentStream);

        ObjectId id = this.session.createDocument(properties, parentId, contentStream, VersioningState.NONE, null,
                null, null);
        assertNotNull(id);

        // verify content
        Document doc = (Document) this.session.getObject(id);
View Full Code Here

            String path = "/" + Fixture.TEST_ROOT_FOLDER_NAME + "/" + FixtureData.DOCUMENT1_NAME;
            Document srcDocument = (Document) this.session.getObjectByPath(path);
            assertNotNull("Document not found: " + path, srcDocument);
            String srcContent = this.getContentAsString(srcDocument.getContentStream());

            ObjectId parentFolder = session.createObjectId(this.fixture.getTestRootId());
            String name = UUID.randomUUID().toString();

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

            ObjectId dstDocumentId = this.session.createDocumentFromSource(srcDocument, properties, parentFolder,
                    VersioningState.NONE, null, null, null);
            assertNotNull(dstDocumentId);
            Document dstDocument = (Document) this.session.getObject(dstDocumentId);
            String dstContent = this.getContentAsString(dstDocument.getContentStream());
            assertEquals(srcContent, dstContent);
View Full Code Here

        String id = document.getId();
        assertNotNull(id);

        // update single property
        ObjectId newId = document.updateProperties(properties);
        assertNotNull(newId);
        assertEquals(id, newId.getId())// should not be a new version
  
        session.clear();
       
        // verify
        String s1 = FixtureData.DOCUMENT1_NAME.toString();
View Full Code Here

        return sbuf.toString();
    }

    @Test
    public void createDocumentAndSetContent() throws IOException {
        ObjectId parentId = this.session.createObjectId(this.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 filename = 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 contentStream = this.session.getObjectFactory().createContentStream(filename, buf1.length,
                mimetype, in1);
        assertNotNull(contentStream);

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

        // set and verify content
        Document doc = (Document) this.session.getObject(id);
        assertNotNull(doc);
View Full Code Here

    }

    @Ignore
    @Test
    public void createDocumentAndSetContentNoOverwrite() throws IOException {
        ObjectId parentId = this.session.createObjectId(this.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 filename = 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 contentStream = this.session.getObjectFactory().createContentStream(filename, buf1.length,
                mimetype, in1);
        assertNotNull(contentStream);

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

        // set and verify content
        Document doc = (Document) this.session.getObject(id);
        assertNotNull(doc);
View Full Code Here

        assertEquals(content1, content2);
    }

    @Test
    public void createDocumentAndUpdateContent() throws IOException {
        ObjectId parentId = this.session.createObjectId(this.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 = this.session.getObjectFactory().createContentStream(filename1, buf1.length,
                mimetype, in1);
        assertNotNull(contentStream1);

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

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

    }

    @Ignore
    @Test(expected = CmisContentAlreadyExistsException.class)
    public void createDocumentAndUpdateContentNoOverwrite() throws IOException {
        ObjectId parentId = this.session.createObjectId(this.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 = this.session.getObjectFactory().createContentStream(filename1, buf1.length,
                mimetype, in1);
        assertNotNull(contentStream1);

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

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

        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put(PropertyIds.OBJECT_TYPE_ID, ObjectType.RELATIONSHIP_BASETYPE_ID);
        properties.put(PropertyIds.SOURCE_ID, document1.getId());
        properties.put(PropertyIds.TARGET_ID, document2.getId());

        ObjectId id = this.session.createRelationship(properties, null, null, null);

        ObjectType ot = document1.getType();
        ItemIterable<Relationship> relations = document1.getRelationships(true, RelationshipDirection.EITHER, ot,
                this.session.getDefaultContext());
        for (Relationship r : relations) {
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.