Exemplo n.º 1
0
  @Override
  public void create(CQMResultDTO cqmResult) throws EntityCreationException {

    CQMResultEntity entity = null;
    try {
      if (cqmResult.getId() != null) {
        entity = this.getEntityById(cqmResult.getId());
      }
    } catch (EntityRetrievalException e) {
      throw new EntityCreationException(e);
    }

    if (entity != null) {
      throw new EntityCreationException("An entity with this ID already exists.");
    } else {

      entity = new CQMResultEntity();
      entity.setCqmCriterionId(cqmResult.getCqmCriterionId());
      entity.setCertifiedProductId(cqmResult.getCertifiedProductId());
      entity.setSuccess(cqmResult.getSuccess());

      entity.setLastModifiedUser(Util.getCurrentUser().getId());
      entity.setLastModifiedDate(new Date());
      entity.setCreationDate(cqmResult.getCreationDate());
      entity.setDeleted(false);

      create(entity);
    }
  }
Exemplo n.º 2
0
  @Override
  public void update(CQMResultDTO cqmResult) throws EntityRetrievalException {

    CQMResultEntity entity = this.getEntityById(cqmResult.getId());
    entity.setCqmCriterionId(cqmResult.getCqmCriterionId());
    entity.setCreationDate(cqmResult.getCreationDate());
    entity.setDeleted(cqmResult.getDeleted());
    entity.setId(cqmResult.getId());
    // entity.setLastModifiedDate(cqmResult.getLastModifiedDate());
    entity.setLastModifiedUser(Util.getCurrentUser().getId());
    ;
    entity.setSuccess(cqmResult.getSuccess());

    update(entity);
  }