Package org.apache.chemistry.opencmis.inmemory.storedobj.api

Examples of org.apache.chemistry.opencmis.inmemory.storedobj.api.VersionedDocument


            contentStream = cs;
        }

        // Now we are sure to have document type definition:
        if (((DocumentTypeDefinition) typeDef).isVersionable()) {
            VersionedDocument verDoc = fStoreManager.getObjectStore(repositoryId).createVersionedDocument(name);
            verDoc.createSystemBasePropertiesWhenCreated(properties.getProperties(), user);
            verDoc.setCustomProperties(properties.getProperties());
            DocumentVersion version = verDoc.addVersion(contentStream, versioningState, user);
            if (null != folder) {
                folder.addChildDocument(verDoc); // add document to folder and
            }
            version.createSystemBasePropertiesWhenCreated(propMap, user);
            version.setCustomProperties(propMap);
            version.persist();
            verDoc.persist();
            so = version; // return the version and not the version series to
            // caller
        } else {
            Document doc = fStoreManager.getObjectStore(repositoryId).createDocument(name);
            doc.setContent(contentStream, false);
View Full Code Here


        if (obj instanceof FolderImpl) {
            deleteFolder(objectId);
        } else if (obj instanceof DocumentVersion) {
            DocumentVersion vers = (DocumentVersion) obj;
            VersionedDocument parentDoc = vers.getParentDocument();
            fStoredObjectMap.remove(path);
            boolean otherVersionsExist = vers.getParentDocument().deleteVersion(vers);
            if (!otherVersionsExist)
                fStoredObjectMap.remove(parentDoc.getId());
        } else {
            fStoredObjectMap.remove(path);
        }
    }
View Full Code Here

        doc.setName(name);
        return doc;
    }

    public VersionedDocument createVersionedDocument(String name) {
        VersionedDocument doc = new VersionedDocumentImpl(this);
        doc.setRepositoryId(fRepositoryId);
        doc.setName(name);
        return doc;
    }
View Full Code Here

    public List<VersionedDocument> getCheckedOutDocuments(String orderBy) {
        List<VersionedDocument> res = new ArrayList<VersionedDocument>();

        for (StoredObject so : fStoredObjectMap.values()) {
            if (so instanceof VersionedDocument) {
                VersionedDocument verDoc = (VersionedDocument) so;
                if (verDoc.isCheckedOut()) {
                    res.add(verDoc);
                }
            }
        }
View Full Code Here

            objInfo.setVersionSeriesId(ver.getParentDocument().getId());
            objInfo.setWorkingCopyId(pwc == null ? null : pwc.getId());
            objInfo.setWorkingCopyOriginalId(pwc == ver ? ver.getParentDocument().getLatestVersion(false).getId()
                    : null);
        } else if (so instanceof VersionedDocument) {
            VersionedDocument doc = (VersionedDocument) so;
            DocumentVersion pwc = doc.getPwc();
            objInfo.setIsCurrentVersion(false);
            objInfo.setVersionSeriesId(doc.getId());
            objInfo.setWorkingCopyId(pwc == null ? null : pwc.getId());
            objInfo.setWorkingCopyOriginalId(null);
        } else { // unversioned document
            objInfo.setIsCurrentVersion(true);
            objInfo.setVersionSeriesId(null);
View Full Code Here

            contentStream = cs;
        }

        // Now we are sure to have document type definition:
        if (((DocumentTypeDefinition) typeDef).isVersionable()) {
            VersionedDocument verDoc = fStoreManager.getObjectStore(repositoryId).createVersionedDocument(name);
            verDoc.createSystemBasePropertiesWhenCreated(properties.getProperties(), user);
            verDoc.setCustomProperties(properties.getProperties());
            DocumentVersion version = verDoc.addVersion(contentStream, versioningState, user);
            if (null != folder)
                folder.addChildDocument(verDoc); // add document to folder and
            // set parent in doc
            else
                verDoc.persist();
            version.createSystemBasePropertiesWhenCreated(propMap, user);
            version.setCustomProperties(propMap);
            version.persist();
            so = version; // return the version and not the version series to
            // caller
View Full Code Here

     *            version or version series id of a document
     * @return version series id
     */
    protected VersionedDocument getVersionedDocumentOfObjectId(StoredObject so) {

        VersionedDocument verDoc;
        if (so instanceof DocumentVersion) {
            // get document the version is contained in to c
            verDoc = ((DocumentVersion) so).getParentDocument();
        } else {
            verDoc = (VersionedDocument) so;
View Full Code Here

        return verDoc;
    }

    protected VersionedDocument testIsNotCheckedOutBySomeoneElse(StoredObject so, String user) {
        checkIsVersionableObject(so);
        VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);
        if (verDoc.isCheckedOut())
            testCheckedOutByCurrentUser(user, verDoc);

        return verDoc;
    }
View Full Code Here

    }

    protected VersionedDocument testHasProperCheckedOutStatus(StoredObject so, String user) {

        checkIsVersionableObject(so);
        VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);

        checkHasUser(user);

        testIsCheckedOut(verDoc);
        testCheckedOutByCurrentUser(user, verDoc);
View Full Code Here

    public void cancelCheckOut(CallContext context, String repositoryId, String objectId, ExtensionsData extension) {

        StoredObject so = validator.cancelCheckOut(context, repositoryId, objectId, extension);
           
        String user = context.getUsername();
        VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);

        verDoc.cancelCheckOut(user);
    }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.inmemory.storedobj.api.VersionedDocument

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.