Пример #1
0
  protected void updateIndicatorValueProperties(
      ReportingPeriod period, PropertyMap changes, boolean creating) {

    for (Map.Entry<String, Object> change : changes.entrySet()) {

      String property = change.getKey();
      Object value = change.getValue();

      if (property.startsWith(IndicatorDTO.PROPERTY_PREFIX)) {

        int indicatorId = IndicatorDTO.indicatorIdForPropertyName(property);

        if (creating) {
          if (value != null) {
            reportingPeriodDAO.addIndicatorValue(period.getId(), indicatorId, (Double) value);
          }
        } else {
          reportingPeriodDAO.updateIndicatorValue(period.getId(), indicatorId, (Double) value);
        }
      }
    }
  }