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

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


      VersionedDocumentImpl doc = new VersionedDocumentImpl(this);
        doc.createSystemBasePropertiesWhenCreated(propMap, user);
        doc.setCustomProperties(propMap);
        doc.setRepositoryId(fRepositoryId);
        doc.setName(name);
        DocumentVersion version = doc.addVersion(contentStream, versioningState, user);
        if (null != folder) {
          ((FolderImpl)folder).addChildDocument(doc); // add document to folder and set
        }
        version.createSystemBasePropertiesWhenCreated(propMap, user);
        version.setCustomProperties(propMap);
        int aclId = getAclId(((FolderImpl)folder), addACEs, removeACEs);
        doc.setAclId(aclId);
        doc.persist();
        return version;
    }
View Full Code Here


        }

        String user = context.getUsername();
        checkHasUser(user);

        DocumentVersion pwc = verDoc.checkOut(content, user);
        objectId.setValue(pwc.getId()); // return the id of the created pwc
        if (null != contentCopied) // Note: always null in AtomPub binding
            contentCopied.setValue(true);
       
        // To be able to provide all Atom links in the response we need
        // additional information:
View Full Code Here

            so = ((DocumentVersion)so).getParentDocument();
        }
       
        if (so instanceof VersionedDocument) {
            VersionedDocument verDoc = (VersionedDocument) so;
            DocumentVersion latestVersion = verDoc.getLatestVersion(major);
            objData = getObject(context, repositoryId, latestVersion.getId(), filter, includeAllowableActions,
                    includeRelationships, extension, objectInfos);
        } else if (so instanceof Document) {
            objData = getObject(context, repositoryId, so.getId(), filter, includeAllowableActions,
                    includeRelationships, extension, objectInfos);
        } else {
View Full Code Here

            contentStream = cs;
        }

        // Now we are sure to have document type definition:
        if (((DocumentTypeDefinition) typeDef).isVersionable()) {
            DocumentVersion version = objectStore.createVersionedDocument(name,  propMap,
                    user, folder, addACEs, removeACEs, contentStream, versioningState);
            version.persist();
            so = version; // return the version and not the version series to caller
        } else {
            Document doc = objectStore.createDocument(name, propMap, user, folder, addACEs, removeACEs);
            doc.setContent(contentStream, false);
            doc.persist();
View Full Code Here

    public boolean deleteVersion(DocumentVersion version) {
        if (fIsCheckedOut) {
            // Note: Do not throw an exception here if the document is checked-out. In AtomPub binding cancelCheckout
            // mapped to a deleteVersion() call!
            DocumentVersion pwc = getPwc();
            if (pwc == version) {
                cancelCheckOut(false); // note object is already deleted from map in ObjectStore
                return !fVersions.isEmpty();
            }
        }
View Full Code Here

        } else {
            throw new CmisConstraintException("Error: Can't cancel checkout, Document " + getId()
                    + " is not checked out.");
        }

        DocumentVersion pwc = getPwc();
       
        if (null != content)
            pwc.setContent(content, false);

        if (null != properties && null != properties.getProperties())
            ((DocumentVersionImpl)pwc).setCustomProperties(properties.getProperties());

        pwc.setCheckinComment(checkinComment);
        pwc.commit(isMajor);
    }
View Full Code Here

        if (fIsCheckedOut) {
            throw new CmisConstraintException("Error: Can't checkout, Document " + getId() + " is already checked out.");
        }

        // create PWC
        DocumentVersion pwc = addVersion(content, VersioningState.CHECKEDOUT, user); // will
        // set check-out flag
        return pwc;
    }
View Full Code Here

        return fVersions;
    }

    public DocumentVersion getLatestVersion(boolean major) {

        DocumentVersion latest = null;
        if (major) {
            for (DocumentVersion ver : fVersions) {
                if (ver.isMajor()) {
                    latest = ver;
                }
View Full Code Here

    @Override
    public void fillProperties(Map<String, PropertyData<?>> properties, BindingsObjectFactory objFactory,
            List<String> requestedIds) {

        DocumentVersion pwc = getPwc();

        super.fillProperties(properties, objFactory, requestedIds);


        if (FilterParser.isContainedInFilter(PropertyIds.IS_IMMUTABLE, requestedIds)) {
            properties.put(PropertyIds.IS_IMMUTABLE, objFactory.createPropertyBooleanData(PropertyIds.IS_IMMUTABLE,
                    false));
        }

        // overwrite the version related properties
        if (FilterParser.isContainedInFilter(PropertyIds.VERSION_SERIES_ID, requestedIds)) {
            properties.put(PropertyIds.VERSION_SERIES_ID, objFactory.createPropertyIdData(
                    PropertyIds.VERSION_SERIES_ID, getId()));
        }
        if (FilterParser.isContainedInFilter(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, requestedIds)) {
            properties.put(PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, objFactory.createPropertyBooleanData(
                    PropertyIds.IS_VERSION_SERIES_CHECKED_OUT, isCheckedOut()));
        }
        if (FilterParser.isContainedInFilter(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, requestedIds)) {
            properties.put(PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, objFactory.createPropertyStringData(
                    PropertyIds.VERSION_SERIES_CHECKED_OUT_BY, getCheckedOutBy()));
        }
        if (FilterParser.isContainedInFilter(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, requestedIds)) {
            properties.put(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, objFactory.createPropertyIdData(
                    PropertyIds.VERSION_SERIES_CHECKED_OUT_ID, pwc == null ? null : pwc.getId()));
        }

    }
View Full Code Here

    }
   
    private void cancelCheckOut(boolean deleteInObjectStore) {
       
        DocumentVersion pwc = getPwc();
        fIsCheckedOut = false;
        fCheckedOutUser = null;
        fVersions.remove(pwc);
        if (deleteInObjectStore)
            fObjStore.removeVersion(pwc);
View Full Code Here

TOP

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

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.