コード例 #1
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;
 }
コード例 #2
0
 @Override
 public boolean isSignedDocument(String userLsUuid, DocumentVo documentVo) {
   // Fix me : just write a finder
   boolean res = false;
   Account actor = accountService.findByLsUuid(userLsUuid);
   try {
     DocumentEntry document = documentEntryService.findById(actor, documentVo.getIdentifier());
     Set<Signature> signatures = document.getDocument().getSignatures();
     if (signatures != null && signatures.size() > 0) res = true;
   } catch (BusinessException e) {
     logger.error("Can't find document : " + documentVo.getIdentifier() + ": " + e.getMessage());
   }
   return res;
 }
コード例 #3
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);
 }
コード例 #4
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");
   }
 }
コード例 #5
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;
  }
コード例 #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 InputStream retrieveFileStream(DocumentVo doc, String lsUid) throws BusinessException {
   Account actor = accountService.findByLsUuid(lsUid);
   return documentEntryService.getDocumentStream(actor, doc.getIdentifier());
 }