use of org.hisp.dhis.configuration.Configuration in project dhis2-core by dhis2.
the class ConfigurationController method setInfrastructuralIndicators.
@PreAuthorize("hasRole('ALL') or hasRole('F_SYSTEM_SETTING')")
@RequestMapping(value = "/infrastructuralIndicators", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void setInfrastructuralIndicators(@RequestBody String uid) throws NotFoundException {
IndicatorGroup group = identifiableObjectManager.get(IndicatorGroup.class, uid);
if (group == null) {
throw new NotFoundException("Indicator group", uid);
}
Configuration config = configurationService.getConfiguration();
config.setInfrastructuralIndicators(group);
configurationService.setConfiguration(config);
}
use of org.hisp.dhis.configuration.Configuration in project dhis2-core by dhis2.
the class ConfigurationController method setInfrastructuralPeriodType.
@PreAuthorize("hasRole('ALL') or hasRole('F_SYSTEM_SETTING')")
@RequestMapping(value = "/infrastructuralPeriodType", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void setInfrastructuralPeriodType(@RequestBody String name) throws NotFoundException {
PeriodType periodType = PeriodType.getPeriodTypeByName(name);
if (periodType == null) {
throw new NotFoundException("Period type", name);
}
Configuration config = configurationService.getConfiguration();
periodType = periodService.reloadPeriodType(periodType);
config.setInfrastructuralPeriodType(periodType);
configurationService.setConfiguration(config);
}
use of org.hisp.dhis.configuration.Configuration in project dhis2-core by dhis2.
the class ConfigurationController method setOfflineOrganisationUnitLevel.
@PreAuthorize("hasRole('ALL') or hasRole('F_SYSTEM_SETTING')")
@RequestMapping(value = "/offlineOrganisationUnitLevel", method = RequestMethod.POST)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void setOfflineOrganisationUnitLevel(@RequestBody String uid) throws NotFoundException {
OrganisationUnitLevel organisationUnitLevel = identifiableObjectManager.get(OrganisationUnitLevel.class, uid);
if (organisationUnitLevel == null) {
throw new NotFoundException("Organisation unit level", uid);
}
Configuration config = configurationService.getConfiguration();
config.setOfflineOrganisationUnitLevel(organisationUnitLevel);
configurationService.setConfiguration(config);
}
use of org.hisp.dhis.configuration.Configuration in project dhis2-core by dhis2.
the class ConfigurationController method setSelfRegistrationOrgUnit.
@PreAuthorize("hasRole('ALL') or hasRole('F_SYSTEM_SETTING')")
@RequestMapping(value = "/selfRegistrationOrgUnit", method = RequestMethod.POST)
public void setSelfRegistrationOrgUnit(@RequestBody String uid) throws NotFoundException {
OrganisationUnit orgunit = identifiableObjectManager.get(OrganisationUnit.class, uid);
if (orgunit == null) {
throw new NotFoundException("Organisation unit", uid);
}
Configuration config = configurationService.getConfiguration();
config.setSelfRegistrationOrgUnit(orgunit);
configurationService.setConfiguration(config);
}
use of org.hisp.dhis.configuration.Configuration in project dhis2-core by dhis2.
the class ConfigurationController method removeSelfRegistrationOrgUnit.
@PreAuthorize("hasRole('ALL') or hasRole('F_SYSTEM_SETTING')")
@RequestMapping(value = "/selfRegistrationOrgUnit", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void removeSelfRegistrationOrgUnit() {
Configuration config = configurationService.getConfiguration();
config.setSelfRegistrationOrgUnit(null);
configurationService.setConfiguration(config);
}
Aggregations