use of org.hisp.dhis.api.mobile.model.MobileModel in project dhis2-core by dhis2.
the class MobileOrganisationUnitController method getAllDataForOrgUnitLWUIT.
@RequestMapping(method = RequestMethod.GET, value = "{clientVersion}/LWUIT/orgUnits/{id}/all")
@ResponseBody
public org.hisp.dhis.api.mobile.model.LWUITmodel.MobileModel getAllDataForOrgUnitLWUIT(@PathVariable String clientVersion, @PathVariable int id) {
org.hisp.dhis.api.mobile.model.LWUITmodel.MobileModel mobileModel = new org.hisp.dhis.api.mobile.model.LWUITmodel.MobileModel();
mobileModel.setClientVersion(clientVersion);
OrganisationUnit unit = getUnit(id);
mobileModel.setPrograms(programService.getProgramsLWUIT(unit));
mobileModel.setServerCurrentDate(new Date());
mobileModel.setRelationshipTypes(programService.getAllRelationshipTypes());
return mobileModel;
}
use of org.hisp.dhis.api.mobile.model.MobileModel in project dhis2-core by dhis2.
the class MobileOrganisationUnitController method getAllDataForOrgUnit.
// For client version 2.9 and higher
@RequestMapping(method = RequestMethod.GET, value = "{clientVersion}/orgUnits/{id}/all")
@ResponseBody
public MobileModel getAllDataForOrgUnit(@PathVariable String clientVersion, @PathVariable int id, @RequestHeader("accept-language") String locale) {
MobileModel mobileModel = new MobileModel();
mobileModel.setClientVersion(clientVersion);
OrganisationUnit unit = getUnit(id);
// mobileModel.setActivityPlan(
// activityReportingService.getCurrentActivityPlan( unit, locale ) );
// mobileModel.setPrograms( programService.getPrograms( unit, locale )
// );
mobileModel.setDatasets(facilityReportingService.getMobileDataSetsForUnit(unit, locale));
mobileModel.setServerCurrentDate(new Date());
mobileModel.setLocales(getLocalStrings(localeService.getAllLocales()));
mobileModel.setSmsCommands(this.getMobileSMSCommands(smsCommandService.getJ2MESMSCommands()));
return mobileModel;
}
use of org.hisp.dhis.api.mobile.model.MobileModel in project dhis2-core by dhis2.
the class MobileOrganisationUnitController method updatePrograms.
@RequestMapping(method = RequestMethod.POST, value = "{clientVersion}/orgUnits/{id}/activitiyplan")
@ResponseBody
public MobileModel updatePrograms(@PathVariable String clientVersion, @PathVariable int id, @RequestHeader("accept-language") String locale, @RequestBody ModelList programsFromClient) {
MobileModel model = new MobileModel();
model.setClientVersion(clientVersion);
model.setPrograms(programService.updateProgram(programsFromClient, locale, getUnit(id)));
model.setActivityPlan(activityReportingService.getCurrentActivityPlan(getUnit(id), locale));
model.setServerCurrentDate(new Date());
return model;
}
use of org.hisp.dhis.api.mobile.model.MobileModel in project dhis2-core by dhis2.
the class MobileOrganisationUnitController method updatePrograms2_8.
@RequestMapping(method = RequestMethod.POST, value = "orgUnits/{id}/activitiyplan")
@ResponseBody
public MobileModel updatePrograms2_8(@PathVariable int id, @RequestHeader("accept-language") String locale, @RequestBody ModelList programsFromClient) {
MobileModel model = new MobileModel();
model.setClientVersion(DataStreamSerializable.TWO_POINT_EIGHT);
model.setPrograms(programService.updateProgram(programsFromClient, locale, getUnit(id)));
model.setActivityPlan(activityReportingService.getCurrentActivityPlan(getUnit(id), locale));
model.setServerCurrentDate(new Date());
return model;
}
use of org.hisp.dhis.api.mobile.model.MobileModel in project dhis2-core by dhis2.
the class MobileOrganisationUnitController method getAllDataForOrgUnit2_8.
// For client version 2.8 and lower
@RequestMapping(method = RequestMethod.GET, value = "orgUnits/{id}/all")
@ResponseBody
public MobileModel getAllDataForOrgUnit2_8(@PathVariable int id, @RequestHeader("accept-language") String locale) {
MobileModel mobileModel = new MobileModel();
mobileModel.setClientVersion(DataStreamSerializable.TWO_POINT_EIGHT);
OrganisationUnit unit = getUnit(id);
mobileModel.setActivityPlan(activityReportingService.getCurrentActivityPlan(unit, locale));
mobileModel.setPrograms(programService.getPrograms(unit, locale));
mobileModel.setDatasets(facilityReportingService.getMobileDataSetsForUnit(unit, locale));
mobileModel.setServerCurrentDate(new Date());
mobileModel.setLocales(getLocalStrings(localeService.getAllLocales()));
return mobileModel;
}
Aggregations