コード例 #1
0
  @Override
  public Long getUserAvailableSize(UserVo userVo) throws BusinessException {
    Account account = accountService.findByLsUuid(userVo.getLsUuid());

    return Math.min(
        documentEntryService.getAvailableSize(account),
        documentEntryService.getUserMaxFileSize(account));
  }
コード例 #2
0
 @Override
 public DocumentVo decryptDocument(DocumentVo docVo, UserVo userVo, String password)
     throws BusinessException {
   Account actor = accountService.findByLsUuid(userVo.getLsUuid());
   DocumentEntry documentEntry =
       enciphermentService.decryptDocument(actor, docVo.getIdentifier(), actor, password);
   return documentEntryTransformer.disassemble(documentEntry);
 }
コード例 #3
0
 @Override
 public void removeDocument(UserVo actorVo, DocumentVo document) throws BusinessException {
   Account actor = accountService.findByLsUuid(actorVo.getLsUuid());
   if (actor != null) {
     entryService.deleteAllShareEntriesWithDocumentEntry(actor, document.getIdentifier());
   } else {
     throw new BusinessException(BusinessErrorCode.USER_NOT_FOUND, "The user couldn't be found");
   }
 }
コード例 #4
0
 @Override
 public DocumentVo insertFile(InputStream in, String fileName, UserVo owner)
     throws BusinessException {
   logger.debug("insert files for document entries");
   Account actor = accountService.findByLsUuid(owner.getLsUuid());
   fileName = fileName.replace("\\", "_");
   fileName = fileName.replace(":", "_");
   DocumentEntry createDocumentEntry =
       documentEntryService.createDocumentEntry(actor, in, fileName);
   return documentEntryTransformer.disassemble(createDocumentEntry);
 }
コード例 #5
0
 @Override
 public List<SignatureVo> getAllSignatures(UserVo userVo, DocumentVo documentVo) {
   Account actor = accountService.findByLsUuid(userVo.getLsUuid());
   try {
     DocumentEntry document = documentEntryService.findById(actor, documentVo.getIdentifier());
     return signatureTransformer.disassembleList(
         new ArrayList<Signature>(document.getDocument().getSignatures()));
   } catch (BusinessException e) {
     logger.error("Can't find document : " + documentVo.getIdentifier() + ": " + e.getMessage());
   }
   return null;
 }
コード例 #6
0
 @Override
 public void insertSignatureFile(
     InputStream file,
     long size,
     String fileName,
     UserVo ownerVo,
     DocumentVo documentVo,
     X509Certificate signerCertificate)
     throws BusinessException {
   Account actor = accountService.findByLsUuid(ownerVo.getLsUuid());
   DocumentEntry documentEntry = documentEntryService.findById(actor, documentVo.getIdentifier());
   signatureService.createSignature(
       actor, documentEntry.getDocument(), file, size, fileName, signerCertificate);
 }
コード例 #7
0
  @Override
  public boolean isSignedDocumentByCurrentUser(UserVo currentSigner, DocumentVo documentVo)
      throws BusinessException {

    Account actor = accountService.findByLsUuid(currentSigner.getLsUuid());
    DocumentEntry doc = documentEntryService.findById(actor, documentVo.getIdentifier());
    Set<Signature> signatures = doc.getDocument().getSignatures();

    boolean res = false;

    for (Signature signature : signatures) {
      if (signature.getSigner().equals(actor)) {
        res = true;
        break;
      }
    }

    return res;
  }
コード例 #8
0
  @Override
  public SignatureVo getSignature(UserVo currentSigner, DocumentVo documentVo) {
    Account actor = accountService.findByLsUuid(currentSigner.getLsUuid());
    try {
      DocumentEntry document = documentEntryService.findById(actor, documentVo.getIdentifier());
      SignatureVo res = null;
      for (Signature signature : document.getDocument().getSignatures()) {
        if (signature.getSigner().equals(actor)) {
          res = signatureTransformer.disassemble(signature);
          break;
        }
      }
      return res;

    } catch (BusinessException e) {
      logger.error("Can't find document : " + documentVo.getIdentifier() + ": " + e.getMessage());
    }
    return null;
  }
コード例 #9
0
  @Override
  public DocumentVo updateDocumentContent(
      String currentFileUUID,
      InputStream file,
      long size,
      String fileName,
      UserVo ownerVo,
      String friendlySize)
      throws BusinessException {
    Account actor = accountService.findByLsUuid(ownerVo.getLsUuid());

    DocumentEntry originalEntry = documentEntryService.findById(actor, currentFileUUID);
    String originalFileName = originalEntry.getName();

    DocumentEntry documentEntry =
        documentEntryService.updateDocumentEntry(actor, currentFileUUID, file, size, fileName);
    if (documentEntry.isShared()) {
      // send email, file has been replaced ....
      entryService.sendSharedUpdateDocNotification(documentEntry, friendlySize, originalFileName);
    }

    return documentEntryTransformer.disassemble(documentEntry);
  }
コード例 #10
0
 @Override
 public Long getGlobalQuota(UserVo userVo) throws BusinessException {
   Account actor = accountService.findByLsUuid(userVo.getLsUuid());
   return documentEntryService.getGlobalQuota(actor);
 }
コード例 #11
0
 @Override
 public boolean isUserQuotaActive(UserVo userVo) throws BusinessException {
   Account actor = accountService.findByLsUuid(userVo.getLsUuid());
   return documentEntryService.isUserQuotaActive(actor);
 }
コード例 #12
0
 @Override
 public boolean isEnciphermentActive(UserVo userVo) {
   Account actor = accountService.findByLsUuid(userVo.getLsUuid());
   return documentEntryService.isEnciphermentActive(actor);
 }
コード例 #13
0
 @Override
 public Long getUserTotalQuota(UserVo userVo) throws BusinessException {
   Account account = accountService.findByLsUuid(userVo.getLsUuid());
   return documentEntryService.getTotalSize(account);
 }
コード例 #14
0
 @Override
 public InputStream retrieveFileStream(DocumentVo doc, UserVo actorVo) throws BusinessException {
   return retrieveFileStream(doc, actorVo.getLsUuid());
 }