Esempio n. 1
0
  @Override
  public String saveDocument(
      DsSessionDto aSessionDto,
      DsDocumentDto aDocumentDto,
      String aKey,
      boolean aKeyIsNumeric,
      String aValue,
      String aSecurityPolicyName,
      String aContentFileKey) {

    if ("bug".equals(aSessionDto.getUsername())) {
      throw new IllegalStateException("this is a bug");
    }

    Transaction tx = entityStore.getEnvironment().beginTransaction(null, null);

    Document doc = new Document();
    doc.setFileKey(aContentFileKey);

    doc.setFileName(getFileName(aDocumentDto));
    documentPrimaryIndex.put(doc);
    tx.commit();

    return String.valueOf(doc.getId());
  }
Esempio n. 2
0
  @Override
  public String getDocumentContent(DsSessionDto aSessionDto, String aDocumentId) {
    if ("bug".equals(aSessionDto.getUsername())) {
      throw new IllegalStateException("this is a bug");
    }

    Document doc = documentPrimaryIndex.get(Long.valueOf(aDocumentId));
    return doc.getFileKey();
  }
Esempio n. 3
0
  @Override
  public void deleteDocument(DsSessionDto aSessionDto, String aDocumentId) {

    if ("bug".equals(aSessionDto.getUsername())) {
      throw new IllegalStateException("this is a bug");
    }

    Transaction tx = entityStore.getEnvironment().beginTransaction(null, null);
    documentPrimaryIndex.delete(Long.valueOf(aDocumentId));
    tx.commit();
  }