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

Examples of org.apache.chemistry.opencmis.client.api.Folder.createDocument()


                addResult(createResult(SKIPPED, "Test type is not versionable. Test skipped!"));
                return;
            }

            // major version
            Document docMajor = testFolder.createDocument(getProperties("major.txt"), getContentStream(),
                    VersioningState.MAJOR);
            addResult(checkObject(session, docMajor, getAllProperties(docMajor), "Major version compliance"));

            f = createResult(FAILURE, "Document should be major version.");
            addResult(assertIsTrue(docMajor.isMajorVersion(), null, f));
View Full Code Here


            deleteObject(docMajor);

            // minor version
            try {
                Document docMinor = testFolder.createDocument(getProperties("minor.txt"), getContentStream(),
                        VersioningState.MINOR);
                addResult(checkObject(session, docMinor, getAllProperties(docMinor), "Minor version compliance"));

                f = createResult(FAILURE, "Document should be minor version.");
                addResult(assertIsFalse(docMinor.isMajorVersion(), null, f));
View Full Code Here

                        + "The repository might not support minor versions.  Exception: " + iae, iae, false));
            }

            // checked out version
            try {
                Document docCheckedOut = testFolder.createDocument(getProperties("checkout.txt"), getContentStream(),
                        VersioningState.CHECKEDOUT);
                addResult(checkObject(session, docCheckedOut, getAllProperties(docCheckedOut),
                        "Checked out version compliance"));

                f = createResult(FAILURE, "Version series should be checked out.");
View Full Code Here

            ContentStream contentStream = session.getObjectFactory().createContentStream(fileName,
                    length, mimeType, is);
            if (!properties.containsKey(PropertyIds.NAME))
                properties.put(PropertyIds.NAME, f.getName());
            Document doc = parentFolder.createDocument(properties, contentStream, VersioningState.NONE);
            id = doc.getId();
            LOG.info("New document created with id: " + id + ", name: " +  properties.get(PropertyIds.NAME) + " in folder: " + parentFolder.getId());
        } catch (Exception e) {
            LOG.error("Failed to create CMIS document.", e);
        } finally {
View Full Code Here

        properties.put(PropertyIds.NAME, name);

        ContentStream contentStream = new ContentStreamImpl(name, BigInteger.valueOf(file.length()), mimetype,
                new FileInputStream(file));

        return parentFolder.createDocument(properties, contentStream, versioningState);
    }

    /**
     * Creates a text document from a string.
     *
 
View Full Code Here

        ByteArrayInputStream bais = new ByteArrayInputStream(content == null ? new byte[0] : content.getBytes());
        ContentStream contentStream = new ContentStreamImpl(name, BigInteger.valueOf(content == null ? 0 : content
                .getBytes().length), "text/plain", bais);

        return parentFolder.createDocument(properties, contentStream, versioningState);
    }

    /**
     * Creates a child folder with the name specified of the type specified. If
     * type is null then will default to cmis:folder.
View Full Code Here

        // Create the Document Object
        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
        properties.put(PropertyIds.NAME, filename);
        ObjectId id = newFolder.createDocument(properties, contentStream, VersioningState.NONE);

        // Did it work?
        // Get the contents of the document by id
        Document doc = (Document) session.getObject(id);
        try {
View Full Code Here

        // Create Document Object with no content stream
        System.out.println("creating a document  called testNoContent with no ContentStream");
        properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
        properties.put(PropertyIds.NAME, "testNoContent");
        newFolder.createDocument(properties, null, VersioningState.NONE);

        // Create a new document and then update its name
        final String textFileName2 = "test2.txt";
        System.out.println("creating a simple text document, " + textFileName2);
        mimetype = "text/plain; charset=UTF-8";
View Full Code Here

        contentStream = session.getObjectFactory().createContentStream(filename, buf.length,
                mimetype, input);
        properties = new HashMap<String, Object>();
        properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
        properties.put(PropertyIds.NAME, filename);
        ObjectId id2 = newFolder.createDocument(properties, contentStream, VersioningState.NONE);

        Document doc2 = (Document) session.getObject(id2);
        System.out.println("renaming " + doc2.getName() + " to test3.txt");
        properties = new HashMap<String, Object>();
        properties.put(PropertyIds.NAME, "test3.txt");
View Full Code Here

        newFolderProps.put(PropertyIds.NAME, "ADGFolder121");
        Folder folder121 = folder12.createFolder(newFolderProps);

        newFileProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
        newFileProps.put(PropertyIds.NAME, "ADGFile121f1");
        folder121.createDocument(newFileProps, contentStream, VersioningState.NONE);

        newFolderProps.put(PropertyIds.NAME, "ADGFolder122");
        folder12.createFolder(newFolderProps);

        // Navigating the object tree
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.