use of org.hisp.dhis.indicator.Indicator in project dhis2-core by dhis2.
the class DefaultMappingService method getIndicatorLastYearMapView.
@Override
public MapView getIndicatorLastYearMapView(String indicatorUid, String organisationUnitUid, int level) {
MapView mapView = new MapView();
Period period = periodService.reloadPeriod(new RelativePeriods().setThisYear(true).getRelativePeriods().iterator().next());
Indicator indicator = indicatorService.getIndicator(indicatorUid);
OrganisationUnit unit = organisationUnitService.getOrganisationUnit(organisationUnitUid);
mapView.addDataDimensionItem(indicator);
mapView.getPeriods().add(period);
mapView.getOrganisationUnits().add(unit);
mapView.getOrganisationUnitLevels().add(level);
mapView.setName(indicator.getName());
return mapView;
}
use of org.hisp.dhis.indicator.Indicator in project dhis2-core by dhis2.
the class DefaultExpressionService method getDimensionalItemObjectsInIndicators.
@Override
public Set<DimensionalItemObject> getDimensionalItemObjectsInIndicators(Collection<Indicator> indicators) {
Set<DimensionalItemObject> items = Sets.newHashSet();
for (Indicator indicator : indicators) {
items.addAll(getDimensionalItemObjectsInExpression(indicator.getNumerator()));
items.addAll(getDimensionalItemObjectsInExpression(indicator.getDenominator()));
}
return items;
}
use of org.hisp.dhis.indicator.Indicator in project dhis2-core by dhis2.
the class ExpressionUpgrader method upgradeIndicators.
private void upgradeIndicators() {
Collection<Indicator> indicators = indicatorService.getAllIndicators();
for (Indicator indicator : indicators) {
String numerator = upgradeExpression(indicator.getNumerator());
String denominator = upgradeExpression(indicator.getDenominator());
if (numerator != null || denominator != null) {
indicator.setNumerator(numerator);
indicator.setDenominator(denominator);
indicatorService.updateIndicator(indicator);
}
}
}
Aggregations