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

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


        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) {
                    fStoredObjectMap.remove(ver.getId());
                }
            } else {
                fStoredObjectMap.remove(objectId);
                otherVersionsExists = parentDoc.deleteVersion(vers);
            }
           
            if (!otherVersionsExists) {
                fStoredObjectMap.remove(parentDoc.getId());
            }
        } else {
            fStoredObjectMap.remove(objectId);
        }
    }
View Full Code Here


      String user, IncludeRelationships includeRelationships) {
      List<StoredObject> res = new ArrayList<StoredObject>();

        for (StoredObject so : fStoredObjectMap.values()) {
            if (so instanceof VersionedDocument) {
                VersionedDocument verDoc = (VersionedDocument) so;
                if (verDoc.isCheckedOut() && hasReadAccess(user, verDoc)) {
                    res.add(verDoc.getPwc());
                }
            }
        }

        return res;
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);
       
        // if this is the last version delete the document itself
        if (verDoc.getAllVersions().size() == 0)
            fStoreManager.getObjectStore(repositoryId).deleteObject(verDoc.getId(), true, user);
    }
View Full Code Here

            Acl addAces, Acl removeAces, ExtensionsData extension, ObjectInfoHandler objectInfos) {

        StoredObject so = validator.checkIn(context, repositoryId, objectId, addAces, removeAces, extension);

        String user = context.getUsername();
        VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);

        // check if the contentStream is a usable object or ignore it otherwise
        // Note Bworser binding sets an empty object
        if (contentStream != null && contentStream.getStream() == null)
            contentStream = null;
       
        verDoc.checkIn(major, properties, contentStream, checkinComment, user);

        // To be able to provide all Atom links in the response we need
        // additional information:
        if (context.isObjectInfoRequired()) {
            ObjectInfoImpl objectInfo = new ObjectInfoImpl();
View Full Code Here

            throw new CmisNotSupportedException("Object can't be checked-out, type is not versionable.");
        }

        checkIsVersionableObject(so);

        VersionedDocument verDoc = getVersionedDocumentOfObjectId(so);

        ContentStream content = null;

        if (so instanceof DocumentVersion) {
            // get document the version is contained in to c
            content = ((DocumentVersion) so).getContent(0, -1);
        } else {
            content = ((VersionedDocument) so).getLatestVersion(false).getContent(0, -1);
        }

        if (verDoc.isCheckedOut()) {
            throw new CmisUpdateConflictException("Document " + objectId.getValue() + " is already checked out.");
        }

        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
View Full Code Here

        }
//        ObjectData objData = getObject(context, repositoryId, so.getId(), filter, includeAllowableActions,
//                IncludeRelationships.NONE,extension, objectInfos);
//        res.add(objData);

        VersionedDocument verDoc = (VersionedDocument) so;
        res = new ArrayList<ObjectData>();
        List<DocumentVersion> versions = verDoc.getAllVersions();
        for (DocumentVersion version : versions) {
            ObjectData objData = getObject(context, repositoryId, version.getId(), filter, includeAllowableActions,
                    IncludeRelationships.NONE,extension, objectInfos);
            res.add(objData);
        }
View Full Code Here

        if (so instanceof DocumentVersion) {
            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);
View Full Code Here

        if (so instanceof DocumentVersion) {
            so = ((DocumentVersion)so).getParentDocument();
        }

        if (so instanceof VersionedDocument) {
            VersionedDocument verDoc = (VersionedDocument) so;
            latestVersionObject = verDoc.getLatestVersion(major);
        } else if (so instanceof Document) {
            latestVersionObject = so;
        } else {
            throw new CmisInvalidArgumentException("Object is not instance of a document (version series)");
        }
View Full Code Here

            Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension, ObjectInfoHandler objectInfos) {

        LOG.debug("start getObjectByPath()");
        StoredObject so = validator.getObjectByPath(context, repositoryId, path, extension);
        if (so instanceof VersionedDocument) {
            VersionedDocument verDoc = (VersionedDocument) so;
            so = verDoc.getLatestVersion(false);
        }

        String user = context.getUsername();

        TypeDefinition td = fStoreManager.getTypeById(repositoryId, so.getTypeId()).getTypeDefinition();
View Full Code Here

        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) {
                    fStoredObjectMap.remove(ver.getId());
                }
            } else {
                fStoredObjectMap.remove(objectId);
                otherVersionsExists = parentDoc.deleteVersion(vers);
            }
           
            if (!otherVersionsExists) {
                fStoredObjectMap.remove(parentDoc.getId());
            }
        } else {
            fStoredObjectMap.remove(objectId);
        }
    }
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.