@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;
  }
  @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;
  }
예제 #3
0
  public SignatureVo disassemble(Signature entityObject) {

    SignatureVo res = null;

    if (null != entityObject) {
      res = new SignatureVo();
      res.setIdentifier(entityObject.getUuid());
      res.setCreationDate(entityObject.getCreationDate());
      res.setCertIssuerDn(entityObject.getCertIssuerDn());
      res.setCertSubjectDn(entityObject.getCertSubjectDn());
      res.setCertNotAfter(entityObject.getCertNotAfter());
      res.setCert(entityObject.getCert());
      res.setSize(entityObject.getSize());
      res.setName(entityObject.getName());
      res.setPersistenceId(entityObject.getId());

      UserVo signer = userTransformer.disassemble((User) entityObject.getSigner());
      res.setSigner(signer);
    }
    return res;
  }