Exemplo n.º 1
0
  @Override
  public void deleteObject(String objectId, Boolean allVersions, String user) {
    StoredObject obj = fStoredObjectMap.get(objectId);

    if (null == obj) {
      throw new CmisObjectNotFoundException(
          "Cannot delete object with id  " + objectId + ". Object does not exist.");
    }

    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);
    }
  }
Exemplo n.º 2
0
  @Override
  public List<StoredObject> getCheckedOutDocuments(
      String orderBy, 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;
  }