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

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


        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.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

    //byte[] content = "Hello World!".getBytes();
    ByteArrayInputStream stream = new ByteArrayInputStream(file);
    ContentStream contentStream = new ContentStreamImpl(fileName, BigInteger.valueOf(file.length), "application/pdf", stream);

    // create a major version
    Document newDoc = parent.createDocument(properties, contentStream, VersioningState.MAJOR);   
   
  }
 
  private void storeInSubversion(byte[] file, String fileName, String commitComment) throws SVNException {
    try {
View Full Code Here

    //byte[] content = "Hello World!".getBytes();
    ByteArrayInputStream stream = new ByteArrayInputStream(file);
    ContentStream contentStream = new ContentStreamImpl(fileName, BigInteger.valueOf(file.length), "application/pdf", stream);

    // create a major version
    Document newDoc = parent.createDocument(properties, contentStream, VersioningState.MAJOR);   
   
  }
 
  private void storeInSubversion(byte[] file, String fileName, String commitComment) throws SVNException {
    try {
View Full Code Here

        switch (objectType.getBaseTypeId()) {
            case CMIS_FOLDER:
                params.put(PropertyIds.PATH, path);
                return ObjectId.toString(ObjectId.Type.OBJECT, parent.createFolder(params).getId());
            case CMIS_DOCUMENT:
                return ObjectId.toString(ObjectId.Type.OBJECT, parent.createDocument(params, null, VersioningState.NONE).getId());
            default:
                return null;
        }
    }
View Full Code Here

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

        try {
            return parentFolder.createDocument(properties, contentStream, versioningState);
        } finally {
            if (stream != null) {
                try {
                    stream.close();
                } catch (IOException ioe) {
View Full Code Here

        ByteArrayInputStream bais = new ByteArrayInputStream(contentBytes);
        ContentStream contentStream = new ContentStreamImpl(name, BigInteger.valueOf(contentBytes.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, BaseTypeId.CMIS_DOCUMENT.value());
        properties.put(PropertyIds.NAME, filename);
        ObjectId id = newFolder.createDocument(properties, contentStream, VersioningState.NONE);

        // Did it work?
        // Get the contents of the document by id
        System.out.println("Getting object by id : " + id.getId());
        Document doc = (Document) session.getObject(id);
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.