Esempio n. 1
0
 @Override
 public ValidationResult deleteEntityById(Integer id) {
   T document = getDao().get(id);
   ValidationResult result = periodValidator.validate(document);
   if (result.hasErrors()) {
     return result;
   }
   getDao().delete(id);
   updateEntitiesList();
   return result;
 }
Esempio n. 2
0
  @Override
  public ValidationResult save(T entity) {
    ValidationResult result = this.getValidator().validate(entity);

    periodValidator.validate(entity, result);

    if (result.hasErrors()) {
      return result;
    }
    if (entity.getId() == null) {
      getDao().save(entity);
    } else {
      getDao().update(entity);
    }
    updateEntitiesList();
    return result;
  }
Esempio n. 3
0
  @Override
  public ValidationResult deleteEntityById(List<Integer> ids) {
    ValidationResult result = ValidationResult.createEmpty();
    if (ids.size() == 0) {
      return result;
    }

    for (Integer id : ids) {
      T document = getDao().get(id);
      result = periodValidator.validate(document);
    }

    if (result.hasErrors()) {
      return result;
    }
    for (Integer id : ids) {
      getDao().delete(id);
    }
    updateEntitiesList();
    return result;
  }