diff --git a/dhis2/src/main/java/org/motechproject/dhis2/domain/DataElement.java b/dhis2/src/main/java/org/motechproject/dhis2/domain/DataElement.java index 3f7b0efa3..3d2f8f597 100644 --- a/dhis2/src/main/java/org/motechproject/dhis2/domain/DataElement.java +++ b/dhis2/src/main/java/org/motechproject/dhis2/domain/DataElement.java @@ -2,6 +2,7 @@ import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.builder.HashCodeBuilder; +import org.motechproject.dhis2.dto.DataElementDto; import org.motechproject.mds.annotations.Access; import org.motechproject.mds.annotations.Entity; import org.motechproject.mds.annotations.Field; @@ -45,6 +46,10 @@ public void setUuid(String uuid) { this.uuid = uuid; } + public DataElementDto toDto () { + return new DataElementDto(name, uuid); + } + @Override public boolean equals(Object o) { diff --git a/dhis2/src/main/java/org/motechproject/dhis2/domain/OrgUnit.java b/dhis2/src/main/java/org/motechproject/dhis2/domain/OrgUnit.java index d5d1e23e3..c7f7caf2c 100644 --- a/dhis2/src/main/java/org/motechproject/dhis2/domain/OrgUnit.java +++ b/dhis2/src/main/java/org/motechproject/dhis2/domain/OrgUnit.java @@ -1,5 +1,6 @@ package org.motechproject.dhis2.domain; +import org.motechproject.dhis2.dto.OrgUnitDto; import org.motechproject.mds.annotations.Access; import org.motechproject.mds.annotations.Entity; import org.motechproject.mds.annotations.Field; @@ -42,4 +43,9 @@ public String getUuid() { public void setUuid(String uuid) { this.uuid = uuid; } + + public OrgUnitDto toDto () { + return new OrgUnitDto(name, uuid); + } + } diff --git a/dhis2/src/main/java/org/motechproject/dhis2/domain/Program.java b/dhis2/src/main/java/org/motechproject/dhis2/domain/Program.java index fe980deb8..36fee9274 100644 --- a/dhis2/src/main/java/org/motechproject/dhis2/domain/Program.java +++ b/dhis2/src/main/java/org/motechproject/dhis2/domain/Program.java @@ -1,5 +1,8 @@ package org.motechproject.dhis2.domain; +import org.motechproject.dhis2.dto.ProgramDto; +import org.motechproject.dhis2.dto.StageDto; +import org.motechproject.dhis2.dto.TrackedEntityAttributeDto; import org.motechproject.mds.annotations.Access; import org.motechproject.mds.annotations.Cascade; import org.motechproject.mds.annotations.Entity; @@ -7,6 +10,7 @@ import org.motechproject.mds.util.SecurityMode; import javax.jdo.annotations.Unique; +import java.util.ArrayList; import java.util.List; /** @@ -105,4 +109,19 @@ public String getProgramType() { public void setProgramType(String programType) { this.programType = programType; } + + public ProgramDto toDto() { + List stageDtos = new ArrayList<>(); + List trackedEntityAttributeDtos = new ArrayList<>(); + + for (Stage stage : stages) { + stageDtos.add(stage.toDto()); + } + + for (TrackedEntityAttribute trackedEntityAttribute : attributes) { + trackedEntityAttributeDtos.add(trackedEntityAttribute.toDto()); + } + + return new ProgramDto(uuid, name, trackedEntity.toDto(), stageDtos, trackedEntityAttributeDtos, singleEvent, registration, programType); + } } diff --git a/dhis2/src/main/java/org/motechproject/dhis2/domain/Stage.java b/dhis2/src/main/java/org/motechproject/dhis2/domain/Stage.java index 35e63fe5a..d99aad02a 100644 --- a/dhis2/src/main/java/org/motechproject/dhis2/domain/Stage.java +++ b/dhis2/src/main/java/org/motechproject/dhis2/domain/Stage.java @@ -1,11 +1,14 @@ package org.motechproject.dhis2.domain; +import org.motechproject.dhis2.dto.DataElementDto; +import org.motechproject.dhis2.dto.StageDto; import org.motechproject.mds.annotations.Access; import org.motechproject.mds.annotations.Entity; import org.motechproject.mds.annotations.Field; import org.motechproject.mds.util.SecurityMode; import javax.jdo.annotations.Unique; +import java.util.ArrayList; import java.util.List; /** @@ -69,4 +72,14 @@ public String getProgram() { public void setProgram(String program) { this.program = program; } + + public StageDto toDto() { + List dataElementDtos = new ArrayList<>(); + + for (DataElement dataElement : dataElements) { + dataElementDtos.add(dataElement.toDto()); + } + + return new StageDto(uuid, name, dataElementDtos, program, registration); + } } diff --git a/dhis2/src/main/java/org/motechproject/dhis2/domain/TrackedEntity.java b/dhis2/src/main/java/org/motechproject/dhis2/domain/TrackedEntity.java index 113fac593..925806224 100644 --- a/dhis2/src/main/java/org/motechproject/dhis2/domain/TrackedEntity.java +++ b/dhis2/src/main/java/org/motechproject/dhis2/domain/TrackedEntity.java @@ -1,5 +1,6 @@ package org.motechproject.dhis2.domain; +import org.motechproject.dhis2.dto.TrackedEntityDto; import org.motechproject.mds.annotations.Access; import org.motechproject.mds.annotations.Entity; import org.motechproject.mds.annotations.Field; @@ -42,4 +43,8 @@ public String getUuid() { public void setUuid(String uuid) { this.uuid = uuid; } + + public TrackedEntityDto toDto() { + return new TrackedEntityDto(name, uuid); + } } diff --git a/dhis2/src/main/java/org/motechproject/dhis2/domain/TrackedEntityAttribute.java b/dhis2/src/main/java/org/motechproject/dhis2/domain/TrackedEntityAttribute.java index 3c35ec049..65b84d706 100644 --- a/dhis2/src/main/java/org/motechproject/dhis2/domain/TrackedEntityAttribute.java +++ b/dhis2/src/main/java/org/motechproject/dhis2/domain/TrackedEntityAttribute.java @@ -1,5 +1,6 @@ package org.motechproject.dhis2.domain; +import org.motechproject.dhis2.dto.TrackedEntityAttributeDto; import org.motechproject.mds.annotations.Access; import org.motechproject.mds.annotations.Entity; import org.motechproject.mds.annotations.Field; @@ -42,4 +43,8 @@ public String getUuid() { public void setUuid(String uuid) { this.uuid = uuid; } + + public TrackedEntityAttributeDto toDto() { + return new TrackedEntityAttributeDto(name, uuid); + } } diff --git a/dhis2/src/main/java/org/motechproject/dhis2/dto/DataElementDto.java b/dhis2/src/main/java/org/motechproject/dhis2/dto/DataElementDto.java new file mode 100644 index 000000000..41bb5c8c4 --- /dev/null +++ b/dhis2/src/main/java/org/motechproject/dhis2/dto/DataElementDto.java @@ -0,0 +1,53 @@ +package org.motechproject.dhis2.dto; + +import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.lang.builder.HashCodeBuilder; + +public class DataElementDto { + private String uuid; + private String name; + + public DataElementDto() { } + + public DataElementDto(String name, String uuid) { + this.uuid = uuid; + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @Override + public boolean equals(Object o) { + + if (this == o) { + return true; + } + + if (!(o instanceof DataElementDto)) { + return false; + } + + DataElementDto other = (DataElementDto) o; + + return ObjectUtils.equals(uuid, other.uuid) && ObjectUtils.equals(name, other.name); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(uuid).append(name).toHashCode(); + } +} diff --git a/dhis2/src/main/java/org/motechproject/dhis2/dto/OrgUnitDto.java b/dhis2/src/main/java/org/motechproject/dhis2/dto/OrgUnitDto.java new file mode 100644 index 000000000..507f1f46f --- /dev/null +++ b/dhis2/src/main/java/org/motechproject/dhis2/dto/OrgUnitDto.java @@ -0,0 +1,54 @@ +package org.motechproject.dhis2.dto; + +import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.lang.builder.HashCodeBuilder; + +public class OrgUnitDto { + private String uuid; + + private String name; + + public OrgUnitDto() { } + + public OrgUnitDto(String name, String uuid) { + this.uuid = uuid; + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @Override + public boolean equals(Object o) { + + if (this == o) { + return true; + } + + if (!(o instanceof OrgUnitDto)) { + return false; + } + + OrgUnitDto other = (OrgUnitDto) o; + + return ObjectUtils.equals(uuid, other.uuid) && ObjectUtils.equals(name, other.name); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(uuid).append(name).toHashCode(); + } +} diff --git a/dhis2/src/main/java/org/motechproject/dhis2/dto/ProgramDto.java b/dhis2/src/main/java/org/motechproject/dhis2/dto/ProgramDto.java new file mode 100644 index 000000000..d460e22ac --- /dev/null +++ b/dhis2/src/main/java/org/motechproject/dhis2/dto/ProgramDto.java @@ -0,0 +1,137 @@ +package org.motechproject.dhis2.dto; + +import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.lang.builder.HashCodeBuilder; + +import java.util.List; + +public class ProgramDto { + + private String uuid; + + private String name; + + private TrackedEntityDto trackedEntity; + + private List stages; + + private List attributes; + + private boolean singleEvent; + + private boolean registration; + + private String programType; + + public ProgramDto() {} + + public ProgramDto(String uuid, String name, TrackedEntityDto trackedEntity, List stages, List attributes, boolean singleEvent, boolean registration, String programType) { + this.uuid = uuid; + this.name = name; + this.trackedEntity = trackedEntity; + this.stages = stages; + this.attributes = attributes; + this.singleEvent = singleEvent; + this.registration = registration; + this.programType = programType; + } + + public boolean isSingleEvent() { + return singleEvent; + } + + public void setSingleEvent(boolean singleEvent) { + this.singleEvent = singleEvent; + } + + public boolean hasRegistration() { + return registration; + } + + public void setRegistration(boolean registration) { + this.registration = registration; + } + + public TrackedEntityDto getTrackedEntity() { + return trackedEntity; + } + + public void setTrackedEntity(TrackedEntityDto trackedEntity) { + this.trackedEntity = trackedEntity; + } + + public List getStages() { + return stages; + } + + public void setStages(List stages) { + this.stages = stages; + } + + public List getAttributes() { + return attributes; + } + + public void setAttributes(List attributes) { + this.attributes = attributes; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getProgramType() { + return programType; + } + + public void setProgramType(String programType) { + this.programType = programType; + } + + @Override + public boolean equals(Object o) { + + if (this == o) { + return true; + } + + if (!(o instanceof ProgramDto)) { + return false; + } + + ProgramDto other = (ProgramDto) o; + + return ObjectUtils.equals(uuid, other.uuid) && + ObjectUtils.equals(name, other.name) && + ObjectUtils.equals(trackedEntity, other.trackedEntity) && + ObjectUtils.equals(stages, other.stages) && + ObjectUtils.equals(attributes, other.attributes) && + ObjectUtils.equals(singleEvent, other.singleEvent) && + ObjectUtils.equals(registration, other.registration) && + ObjectUtils.equals(programType, other.programType); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(uuid). + append(name). + append(trackedEntity). + append(stages). + append(attributes). + append(singleEvent). + append(registration). + append(programType).toHashCode(); + } +} diff --git a/dhis2/src/main/java/org/motechproject/dhis2/dto/StageDto.java b/dhis2/src/main/java/org/motechproject/dhis2/dto/StageDto.java new file mode 100644 index 000000000..5259d2684 --- /dev/null +++ b/dhis2/src/main/java/org/motechproject/dhis2/dto/StageDto.java @@ -0,0 +1,97 @@ +package org.motechproject.dhis2.dto; + +import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.lang.builder.HashCodeBuilder; + +import java.util.List; + +public class StageDto { + private String uuid; + + private String name; + + private List dataElements; + + private String program; + + private boolean registration; + + public StageDto() {} + + public StageDto(String uuid, String name, List dataElements, String program, boolean registration) { + this.uuid = uuid; + this.name = name; + this.dataElements = dataElements; + this.program = program; + this.registration = registration; + } + + public boolean hasRegistration() { + return registration; + } + + public void setRegistration(boolean registration) { + this.registration = registration; + } + + public List getDataElements() { + return dataElements; + } + + public void setDataElements(List dataElements) { + this.dataElements = dataElements; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getProgram() { + return program; + } + + public void setProgram(String program) { + this.program = program; + } + + @Override + public boolean equals(Object o) { + + if (this == o) { + return true; + } + + if (!(o instanceof StageDto)) { + return false; + } + + StageDto other = (StageDto) o; + + return ObjectUtils.equals(uuid, other.uuid) && + ObjectUtils.equals(name, other.name) && + ObjectUtils.equals(dataElements, other.dataElements) && + ObjectUtils.equals(program, other.program) && + ObjectUtils.equals(registration, other.registration); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(uuid). + append(name). + append(dataElements). + append(program). + append(registration).toHashCode(); + } +} diff --git a/dhis2/src/main/java/org/motechproject/dhis2/dto/TrackedEntityAttributeDto.java b/dhis2/src/main/java/org/motechproject/dhis2/dto/TrackedEntityAttributeDto.java new file mode 100644 index 000000000..7102f5a4a --- /dev/null +++ b/dhis2/src/main/java/org/motechproject/dhis2/dto/TrackedEntityAttributeDto.java @@ -0,0 +1,54 @@ +package org.motechproject.dhis2.dto; + +import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.lang.builder.HashCodeBuilder; + +public class TrackedEntityAttributeDto { + private String uuid; + + private String name; + + public TrackedEntityAttributeDto() { } + + public TrackedEntityAttributeDto(String name, String uuid) { + this.name = name; + this.uuid = uuid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @Override + public boolean equals(Object o) { + + if (this == o) { + return true; + } + + if (!(o instanceof TrackedEntityAttributeDto)) { + return false; + } + + TrackedEntityAttributeDto other = (TrackedEntityAttributeDto) o; + + return ObjectUtils.equals(uuid, other.uuid) && ObjectUtils.equals(name, other.name); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(uuid).append(name).toHashCode(); + } +} diff --git a/dhis2/src/main/java/org/motechproject/dhis2/dto/TrackedEntityDto.java b/dhis2/src/main/java/org/motechproject/dhis2/dto/TrackedEntityDto.java new file mode 100644 index 000000000..2101cf485 --- /dev/null +++ b/dhis2/src/main/java/org/motechproject/dhis2/dto/TrackedEntityDto.java @@ -0,0 +1,54 @@ +package org.motechproject.dhis2.dto; + +import org.apache.commons.lang.ObjectUtils; +import org.apache.commons.lang.builder.HashCodeBuilder; + +public class TrackedEntityDto { + private String uuid; + + private String name; + + public TrackedEntityDto() { } + + public TrackedEntityDto(String name, String uuid) { + this.name = name; + this.uuid = uuid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @Override + public boolean equals(Object o) { + + if (this == o) { + return true; + } + + if (!(o instanceof TrackedEntityDto)) { + return false; + } + + TrackedEntityDto other = (TrackedEntityDto) o; + + return ObjectUtils.equals(uuid, other.uuid) && ObjectUtils.equals(name, other.name); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(uuid).append(name).toHashCode(); + } +} diff --git a/dhis2/src/main/java/org/motechproject/dhis2/service/Dhis2WebService.java b/dhis2/src/main/java/org/motechproject/dhis2/service/Dhis2WebService.java new file mode 100644 index 000000000..f1d163af3 --- /dev/null +++ b/dhis2/src/main/java/org/motechproject/dhis2/service/Dhis2WebService.java @@ -0,0 +1,41 @@ +package org.motechproject.dhis2.service; + +import org.motechproject.dhis2.dto.DataElementDto; +import org.motechproject.dhis2.dto.OrgUnitDto; +import org.motechproject.dhis2.dto.ProgramDto; +import org.motechproject.dhis2.dto.TrackedEntityAttributeDto; +import org.motechproject.dhis2.dto.TrackedEntityDto; + +import java.util.List; + +/** + * This interface is used by Dhis2 controllers to work with dto objects. + */ +public interface Dhis2WebService { + + /** + * @see DataElementService#findAll() + */ + List getDataElements(); + + /** + * @see OrgUnitService#findAll() + */ + List getOrgUnits(); + + /** + * @see TrackedEntityService#findAll() + */ + List getTrackedEntities(); + + /** + * @see TrackedEntityAttributeService#findAll() + */ + List getAttributes(); + + /** + * @see ProgramService#findAll() + */ + List getPrograms(); +} + diff --git a/dhis2/src/main/java/org/motechproject/dhis2/service/impl/Dhis2WebServiceImpl.java b/dhis2/src/main/java/org/motechproject/dhis2/service/impl/Dhis2WebServiceImpl.java new file mode 100644 index 000000000..7de4f39e5 --- /dev/null +++ b/dhis2/src/main/java/org/motechproject/dhis2/service/impl/Dhis2WebServiceImpl.java @@ -0,0 +1,126 @@ +package org.motechproject.dhis2.service.impl; + +import org.motechproject.dhis2.domain.DataElement; +import org.motechproject.dhis2.domain.OrgUnit; +import org.motechproject.dhis2.domain.Program; +import org.motechproject.dhis2.domain.TrackedEntity; +import org.motechproject.dhis2.domain.TrackedEntityAttribute; +import org.motechproject.dhis2.dto.DataElementDto; +import org.motechproject.dhis2.dto.OrgUnitDto; +import org.motechproject.dhis2.dto.ProgramDto; +import org.motechproject.dhis2.dto.TrackedEntityAttributeDto; +import org.motechproject.dhis2.dto.TrackedEntityDto; +import org.motechproject.dhis2.service.DataElementService; +import org.motechproject.dhis2.service.Dhis2WebService; +import org.motechproject.dhis2.service.OrgUnitService; +import org.motechproject.dhis2.service.ProgramService; +import org.motechproject.dhis2.service.TrackedEntityAttributeService; +import org.motechproject.dhis2.service.TrackedEntityService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; + +/** + * The implementation of the {@link Dhis2WebService} interface. + */ +@Service("dhis2WebService") +public class Dhis2WebServiceImpl implements Dhis2WebService { + + @Autowired + private DataElementService dataElementService; + + @Autowired + private OrgUnitService orgUnitService; + + @Autowired + private TrackedEntityAttributeService trackedEntityAttributeService; + + @Autowired + private TrackedEntityService trackedEntityService; + + @Autowired + private ProgramService programService; + + @Override + @Transactional + public List getDataElements() { + return dataElementsToDtos(dataElementService.findAll()); + } + + @Override + @Transactional + public List getOrgUnits() { + return orgUnitsToDtos(orgUnitService.findAll()); + } + + @Override + @Transactional + public List getTrackedEntities() { + return trackedEntitiesToDtos(trackedEntityService.findAll()); + } + + @Override + @Transactional + public List getAttributes() { + return attributesToDtos(trackedEntityAttributeService.findAll()); + } + + @Override + @Transactional + public List getPrograms() { + return programsToDtos(programService.findAll()); + } + + private List dataElementsToDtos(List dataElementsList) { + List dataElementDtos = new ArrayList<>(); + + for (DataElement dataElement : dataElementsList) { + dataElementDtos.add(dataElement.toDto()); + } + + return dataElementDtos; + } + + private List orgUnitsToDtos(List orgUnitList) { + List orgUnitDtos = new ArrayList<>(); + + for (OrgUnit orgUnit : orgUnitList) { + orgUnitDtos.add(orgUnit.toDto()); + } + + return orgUnitDtos; + } + + private List attributesToDtos(List trackedEntityAttributeList) { + List trackedEntityAttributeDtos = new ArrayList<>(); + + for (TrackedEntityAttribute trackedEntityAttribute : trackedEntityAttributeList) { + trackedEntityAttributeDtos.add(trackedEntityAttribute.toDto()); + } + + return trackedEntityAttributeDtos; + } + + private List trackedEntitiesToDtos(List trackedEntitiesList) { + List trackedEntityDtos = new ArrayList<>(); + + for (TrackedEntity trackedEntity : trackedEntitiesList) { + trackedEntityDtos.add(trackedEntity.toDto()); + } + + return trackedEntityDtos; + } + + private List programsToDtos(List programList) { + List programDtos = new ArrayList<>(); + + for (Program program : programList) { + programDtos.add(program.toDto()); + } + + return programDtos; + } +} diff --git a/dhis2/src/main/java/org/motechproject/dhis2/web/DhisSchemaController.java b/dhis2/src/main/java/org/motechproject/dhis2/web/DhisSchemaController.java index eded47a06..42266ea36 100644 --- a/dhis2/src/main/java/org/motechproject/dhis2/web/DhisSchemaController.java +++ b/dhis2/src/main/java/org/motechproject/dhis2/web/DhisSchemaController.java @@ -1,15 +1,11 @@ package org.motechproject.dhis2.web; -import org.motechproject.dhis2.domain.DataElement; -import org.motechproject.dhis2.domain.OrgUnit; -import org.motechproject.dhis2.domain.Program; -import org.motechproject.dhis2.domain.TrackedEntity; -import org.motechproject.dhis2.domain.TrackedEntityAttribute; -import org.motechproject.dhis2.service.DataElementService; -import org.motechproject.dhis2.service.OrgUnitService; -import org.motechproject.dhis2.service.ProgramService; -import org.motechproject.dhis2.service.TrackedEntityAttributeService; -import org.motechproject.dhis2.service.TrackedEntityService; +import org.motechproject.dhis2.dto.DataElementDto; +import org.motechproject.dhis2.dto.OrgUnitDto; +import org.motechproject.dhis2.dto.ProgramDto; +import org.motechproject.dhis2.dto.TrackedEntityAttributeDto; +import org.motechproject.dhis2.dto.TrackedEntityDto; +import org.motechproject.dhis2.service.Dhis2WebService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; @@ -27,48 +23,40 @@ public class DhisSchemaController { @Autowired - private ProgramService programService; - @Autowired - private TrackedEntityAttributeService trackedEntityAttributeService; - @Autowired - private TrackedEntityService trackedEntityService; - @Autowired - private OrgUnitService orgUnitService; - @Autowired - private DataElementService dataElementService; + private Dhis2WebService dhis2WebService; @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/programs", method = RequestMethod.GET) @ResponseBody - public List getPrograms() { - return programService.findAll(); + public List getPrograms() { + return dhis2WebService.getPrograms(); } @ResponseBody @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/trackedEntityAttributes", method = RequestMethod.GET) - public List getAttributes() { - return trackedEntityAttributeService.findAll(); + public List getAttributes() { + return dhis2WebService.getAttributes(); } @ResponseBody @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/trackedEntities", method = RequestMethod.GET) - public List getTrackedEntities() { - return trackedEntityService.findAll(); + public List getTrackedEntities() { + return dhis2WebService.getTrackedEntities(); } @ResponseBody @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/orgUnits", method = RequestMethod.GET) - public List getOrgUnits() { - return orgUnitService.findAll(); + public List getOrgUnits() { + return dhis2WebService.getOrgUnits(); } @ResponseBody @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/dataElements", method = RequestMethod.GET) - public List getDataElements() { - return dataElementService.findAll(); + public List getDataElements() { + return dhis2WebService.getDataElements(); } }