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

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


    // }

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

        DocumentVersion pwc = fContainer.getPwc();

        // First get the properties of the container (like custom type
        // properties, etc)
        fContainer.fillProperties(properties, objFactory, requestedIds);

        // overwrite the version specific properties (like modification date,
        // user, etc.)
        // and set some properties specific to the version
        super.fillProperties(properties, objFactory, requestedIds);

        // fill the version related properties
        if (FilterParser.isContainedInFilter(PropertyIds.IS_LATEST_VERSION, requestedIds)) {
            properties.put(PropertyIds.IS_LATEST_VERSION, objFactory.createPropertyBooleanData(
                    PropertyIds.IS_LATEST_VERSION, isLatestVersion()));
        }
        if (FilterParser.isContainedInFilter(PropertyIds.IS_MAJOR_VERSION, requestedIds)) {
            properties.put(PropertyIds.IS_MAJOR_VERSION, objFactory.createPropertyBooleanData(
                    PropertyIds.IS_MAJOR_VERSION, fIsMajor));
        }
        if (FilterParser.isContainedInFilter(PropertyIds.IS_LATEST_MAJOR_VERSION, requestedIds)) {
            properties.put(PropertyIds.IS_LATEST_MAJOR_VERSION, objFactory.createPropertyBooleanData(
                    PropertyIds.IS_LATEST_MAJOR_VERSION, isLatestMajorVersion()));
        }
        if (FilterParser.isContainedInFilter(PropertyIds.VERSION_SERIES_ID, requestedIds)) {
            properties.put(PropertyIds.VERSION_SERIES_ID, objFactory.createPropertyIdData(
                    PropertyIds.VERSION_SERIES_ID, fContainer.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, fContainer.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, fContainer.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()));
        }
        if (FilterParser.isContainedInFilter(PropertyIds.CHECKIN_COMMENT, requestedIds)) {
            properties.put(PropertyIds.CHECKIN_COMMENT, objFactory.createPropertyStringData(
                    PropertyIds.CHECKIN_COMMENT, fComment));
        }
View Full Code Here


        objInfo.setBaseType(typeDef.getBaseTypeId());
        objInfo.setObject(od);

        // versioning information:
        if (so instanceof DocumentVersion) {
            DocumentVersion ver = (DocumentVersion) so;
            DocumentVersion pwc = ver.getParentDocument().getPwc();
            objInfo.setIsCurrentVersion(ver == ver.getParentDocument().getLatestVersion(false));
            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);
            objInfo.setWorkingCopyId(null);
View Full Code Here

        for (String id : fObjStore.getIds()) {
            StoredObject obj = fObjStore.getObject(id);
            Filing pathObj = (Filing) obj;
            if (pathObj.getParents().contains(this)) {
                if (pathObj instanceof VersionedDocument) {
                    DocumentVersion ver = ((VersionedDocument) pathObj).getLatestVersion(false);
                    result.add(ver);
                } else if (pathObj instanceof DocumentVersion) {
                    // ignore
                } else {
                    result.add(obj);
View Full Code Here

        return !fVersions.isEmpty();
    }

    public void cancelCheckOut(String user) {
        DocumentVersion pwc = getPwc();
        fVersions.remove(pwc);
        fObjStore.removeVersion(pwc);
        fIsCheckedOut = false;
        fCheckedOutUser = null;
    }
View Full Code Here

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

        DocumentVersion pwc = getPwc();
        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
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

    }

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

        DocumentVersion pwc = getPwc();

        super.fillProperties(properties, objFactory, requestedIds);

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

        // 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
        } else {
            Document doc = fStoreManager.getObjectStore(repositoryId).createDocument(name);
            doc.setContent(contentStream, false);
View Full Code Here

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

        DocumentVersion pwc = verDoc.getPwc();

        if (null != contentStream)
            pwc.setContent(contentStream, false);

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

        verDoc.checkIn(major, checkinComment, user);

        // To be able to provide all Atom links in the response we need
        // additional information:
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.