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

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


        }

        if (obj instanceof FolderImpl) {
          deleteFolder(objectId, user);
        } else if (obj instanceof DocumentVersion) {
            DocumentVersion vers = (DocumentVersion) obj;
            VersionedDocument parentDoc = vers.getParentDocument();
            boolean otherVersionsExists;
            if (allVersions != null && allVersions) {
                otherVersionsExists = false;
                List<DocumentVersion> allVers = parentDoc.getAllVersions();
                for (DocumentVersion ver : allVers) {
View Full Code Here


      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

        if (!fIsMajor) {
            return false;
        }

        List<DocumentVersion> allVersions = fContainer.getAllVersions();
        DocumentVersion latestMajor = null;

        for (DocumentVersion ver : allVersions) {
            if (ver.isMajor() && !ver.isPwc()) {
                latestMajor = ver;
            }
View Full Code Here

    @Override
    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);


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

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

public class PropertyUtil {
   
    public static Object getProperty(StoredObject so, String propertyId, PropertyDefinition<?> pd) {
        ContentStream content = null;
        DocumentVersion ver = null;
        VersionedDocument verDoc = null;
        Folder folder = null;
        Document doc = null;
        boolean cmis11 = InMemoryServiceContext.getCallContext().getCmisVersion() != CmisVersion.CMIS_1_0;

        if (so instanceof Content)
            content = ((Content) so).getContent(0, 0);
        if (so instanceof DocumentVersion)
            ver = (DocumentVersion) so;
        if (so instanceof VersionedDocument)
            verDoc = (VersionedDocument) so;
        if (so instanceof Folder)
            folder = (Folder) so;
        if (so instanceof Document)
            doc = (Document) so;

        // generic properties:
        if (propertyId.equals(PropertyIds.NAME)) {
            return so.getName();
        }
        if (propertyId.equals(PropertyIds.OBJECT_ID)) {
            return so.getId();
        }
        if (propertyId.equals(PropertyIds.OBJECT_TYPE_ID)) {
            return so.getTypeId();
        }
        if (propertyId.equals(PropertyIds.BASE_TYPE_ID)) {
            return null; // TOODO: return so.getBaseTypeId());
        }
        if (propertyId.equals(PropertyIds.CREATED_BY)) {
            return so.getCreatedBy();
        }
        if (propertyId.equals(PropertyIds.CREATION_DATE)) {
            return so.getCreatedAt();
        }
        if (propertyId.equals(PropertyIds.LAST_MODIFIED_BY)) {
            return so.getModifiedBy();
        }
        if (propertyId.equals(PropertyIds.LAST_MODIFICATION_DATE)) {
            return so.getModifiedAt();
        }
        if (propertyId.equals(PropertyIds.CHANGE_TOKEN)) {
            return so.getChangeToken();
        }
        if (cmis11 && propertyId.equals(PropertyIds.DESCRIPTION)) {
            return so.getDescription();
        }

        if (ver != null) {
            // get version related properties
            // not support on a version, only on a versioned document:
            // VERSION_SERIES_ID, IS_VERSION_SERIES_CHECKED_OUT,
            // VERSION_SERIES_CHECKED_OUT_BY,
            // VERSION_SERIES_CHECKED_OUT_ID, IS_LATEST_MAJOR_VERSION,
            // IS_LATEST_VERSION
            if (propertyId.equals(PropertyIds.IS_MAJOR_VERSION)) {
                return ver.isMajor();
            }

            if (propertyId.equals(PropertyIds.CHECKIN_COMMENT)) {
                return ver.getCheckinComment();
            }
            if (propertyId.equals(PropertyIds.VERSION_LABEL)) {
                return ver.getVersionLabel();
            }
            if (propertyId.equals(PropertyIds.VERSION_SERIES_CHECKED_OUT_ID)) {
                return ver.isPwc() ? ver.getId() : null;
            }
        }

        // get versioned document related properties
        if (verDoc != null) {
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.