dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08519
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2058: Fix: error when get group-factor PatientAttribute which is null
------------------------------------------------------------
revno: 2058
committer: Tran Ng Minh Luan <Luan@MinhLuan-PC>
branch nick: dhis2
timestamp: Mon 2010-11-15 15:35:53 +0700
message:
Fix: error when get group-factor PatientAttribute which is null
Change: using bean instead autowire
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResouce.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityPlanModelService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityPlanService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityValueService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultDataSetService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultDataValueService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultPeriodService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultProgramService.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ProgramStageService.java
dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResouce.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResouce.java 2010-11-03 07:28:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/MobileResouce.java 2010-11-15 08:35:53 +0000
@@ -1,6 +1,5 @@
package org.hisp.dhis.web.api.resources;
-import java.net.URI;
import java.util.Collection;
import javax.ws.rs.GET;
@@ -24,20 +23,58 @@
import org.hisp.dhis.web.api.service.IProgramService;
import org.springframework.beans.factory.annotation.Autowired;
-@Path("/mobile")
-public class MobileResouce {
- @Autowired
+@Path( "/mobile" )
+public class MobileResouce
+{
+
private IProgramService programService;
-
- @Autowired
+
+ public IProgramService getProgramService()
+ {
+ return programService;
+ }
+
+ public void setProgramService( IProgramService programService )
+ {
+ this.programService = programService;
+ }
+
private IActivityPlanService activityPlanService;
-
- @Autowired
- private IDataSetService idataSetService;
-
- @Autowired
+
+ public IActivityPlanService getActivityPlanService()
+ {
+ return activityPlanService;
+ }
+
+ public void setActivityPlanService( IActivityPlanService activityPlanService )
+ {
+ this.activityPlanService = activityPlanService;
+ }
+
+ private IDataSetService idataSetService;
+
+ public IDataSetService getIdataSetService()
+ {
+ return idataSetService;
+ }
+
+ public void setIdataSetService( IDataSetService idataSetService )
+ {
+ this.idataSetService = idataSetService;
+ }
+
private CurrentUserService currentUserService;
+ public CurrentUserService getCurrentUserService()
+ {
+ return currentUserService;
+ }
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
@Context
private UriInfo uriInfo;
@@ -55,45 +92,44 @@
}
else if ( units.size() > 1 )
{
- StringBuilder sb = new StringBuilder("User is registered to more than one unit: ");
-
+ StringBuilder sb = new StringBuilder( "User is registered to more than one unit: " );
+
int i = units.size();
for ( OrganisationUnit unit : units )
{
sb.append( unit.getName() );
- if (i-- > 1)
+ if ( i-- > 1 )
sb.append( ", " );
}
-
+
return Response.status( Status.CONFLICT ).entity( sb.toString() ).build();
}
-
+
OrganisationUnit unit = units.iterator().next();
- return Response.ok(getOrgUnit(unit)).build();
+ return Response.ok( getOrgUnit( unit ) ).build();
}
-
-
- @GET
- @Path("all")
+ @GET
+ @Path( "all" )
@Produces( "application/vnd.org.dhis2.mobileresource+serialized" )
- public MobileWrapper getAllDataForUser(@HeaderParam("accept-language") String locale)
+ public MobileWrapper getAllDataForUser( @HeaderParam( "accept-language" ) String locale )
{
MobileWrapper mobileWrapper = new MobileWrapper();
- mobileWrapper.setActivityPlan(activityPlanService.getCurrentActivityPlan( locale ));
-
+ mobileWrapper.setActivityPlan( activityPlanService.getCurrentActivityPlan( locale ) );
+
mobileWrapper.setPrograms( programService.getAllProgramsForLocale( locale ) );
-
-
- mobileWrapper.setDatasets(idataSetService.getAllMobileDataSetsForLocale(locale));
-
-// ActivityWrapper activityWrapper = new ActivityWrapper();
-// activityWrapper.setActivityPlan( activityPlanService.getCurrentActivityPlan( locale ) );
-// activityWrapper.setPrograms( programService.getAllProgramsForLocale( locale ) );
+
+ mobileWrapper.setDatasets( idataSetService.getAllMobileDataSetsForLocale( locale ) );
+
+ // ActivityWrapper activityWrapper = new ActivityWrapper();
+ // activityWrapper.setActivityPlan(
+ // activityPlanService.getCurrentActivityPlan( locale ) );
+ // activityWrapper.setPrograms( programService.getAllProgramsForLocale(
+ // locale ) );
return mobileWrapper;
}
-
- private OrgUnit getOrgUnit(OrganisationUnit unit)
+
+ private OrgUnit getOrgUnit( OrganisationUnit unit )
{
OrgUnit m = new OrgUnit();
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java 2010-11-03 07:28:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/OrgUnitResource.java 2010-11-15 08:35:53 +0000
@@ -18,19 +18,45 @@
@Path( "/orgUnits/{id}" )
public class OrgUnitResource
{
-
- @Autowired
private OrganisationUnitService organisationUnitService;
- @Autowired
+ public OrganisationUnitService getOrganisationUnitService()
+ {
+ return organisationUnitService;
+ }
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
private ActivityPlanModelService service;
- @Autowired
+ public ActivityPlanModelService getService()
+ {
+ return service;
+ }
+
+ public void setService( ActivityPlanModelService service )
+ {
+ this.service = service;
+ }
+
private ProgramStageService programStageService;
+ public ProgramStageService getProgramStageService()
+ {
+ return programStageService;
+ }
+
+ public void setProgramStageService( ProgramStageService programStageService )
+ {
+ this.programStageService = programStageService;
+ }
+
@PathParam( "id" )
private int unitId;
-
+
@GET
@Path( "activityplan/current" )
@Produces( MediaType.APPLICATION_XML )
@@ -39,11 +65,12 @@
return service.getCurrentActivityPlan( organisationUnitService.getOrganisationUnit( unitId ) );
}
- @GET
- @Path("programforms")
- @Produces(MediaType.APPLICATION_XML)
- public List<Form> getAllForms() {
+ @GET
+ @Path( "programforms" )
+ @Produces( MediaType.APPLICATION_XML )
+ public List<Form> getAllForms()
+ {
return programStageService.getAllForms();
- }
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityPlanModelService.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityPlanModelService.java 2010-08-25 17:40:56 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityPlanModelService.java 2010-11-15 08:35:53 +0000
@@ -15,8 +15,13 @@
public class ActivityPlanModelService
{
- @Autowired
+
private ActivityPlanService activityPlanService;
+
+ public ActivityPlanService getActivityPlanService()
+ {
+ return activityPlanService;
+ }
/**
* Gets the current activity plan for an org unit.
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityPlanService.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityPlanService.java 2010-11-12 10:28:30 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityPlanService.java 2010-11-15 08:35:53 +0000
@@ -19,7 +19,6 @@
import org.hisp.dhis.web.api.model.ActivityPlan;
import org.hisp.dhis.web.api.model.Beneficiary;
import org.hisp.dhis.web.api.model.PatientAttribute;
-import org.hisp.dhis.web.api.service.mapping.ActivitiesMapper;
import org.hisp.dhis.web.api.service.mapping.TaskMapper;
import org.joda.time.DateMidnight;
import org.joda.time.DateTime;
@@ -37,18 +36,54 @@
// Dependencies
// -------------------------------------------------------------------------
- @Autowired
private org.hisp.dhis.activityplan.ActivityPlanService activityPlanService;
- @Autowired
+ public org.hisp.dhis.activityplan.ActivityPlanService getActivityPlanService()
+ {
+ return activityPlanService;
+ }
+
+ public void setActivityPlanService( org.hisp.dhis.activityplan.ActivityPlanService activityPlanService )
+ {
+ this.activityPlanService = activityPlanService;
+ }
+
private PatientAttributeValueService patientAttValueService;
- @Autowired
+ public PatientAttributeValueService getPatientAttValueService()
+ {
+ return patientAttValueService;
+ }
+
+ public void setPatientAttValueService( PatientAttributeValueService patientAttValueService )
+ {
+ this.patientAttValueService = patientAttValueService;
+ }
+
private PatientAttributeService patientAttService;
- @Autowired
+ public PatientAttributeService getPatientAttService()
+ {
+ return patientAttService;
+ }
+
+ public void setPatientAttService( PatientAttributeService patientAttService )
+ {
+ this.patientAttService = patientAttService;
+ }
+
private CurrentUserService currentUserService;
+ public CurrentUserService getCurrentUserService()
+ {
+ return currentUserService;
+ }
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
// -------------------------------------------------------------------------
// MobileDataSetService
// -------------------------------------------------------------------------
@@ -140,7 +175,8 @@
beneficiary.setLastName( patient.getLastName() );
beneficiary.setMiddleName( patient.getMiddleName() );
- // Set attribute which is used to group beneficiary on mobile (only if there is attribute which is set to be group factor)
+ // Set attribute which is used to group beneficiary on mobile (only if
+ // there is attribute which is set to be group factor)
PatientAttribute beneficiaryAttribute = null;
org.hisp.dhis.patient.PatientAttribute patientAttribute = patientAttService.getPatientAttributeByGroupBy( true );
@@ -148,11 +184,11 @@
{
beneficiaryAttribute = new PatientAttribute();
beneficiaryAttribute.setName( patientAttribute.getName() );
- beneficiaryAttribute.setValue( patientAttValueService.getPatientAttributeValue( patient, patientAttribute )
- .getValue() );
+ PatientAttributeValue value = patientAttValueService.getPatientAttributeValue( patient, patientAttribute );
+ beneficiaryAttribute.setValue( value == null ? "Unknown" : value.getValue() );
beneficiary.setGroupAttribute( beneficiaryAttribute );
}
- patientAttribute = null;
+ patientAttribute = null;
// Set all attributes
for ( PatientAttributeValue value : patientAttValueService.getPatientAttributeValues( patient ) )
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityValueService.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityValueService.java 2010-11-13 17:48:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityValueService.java 2010-11-15 08:35:53 +0000
@@ -15,7 +15,6 @@
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.web.api.model.ActivityValue;
import org.hisp.dhis.web.api.model.DataValue;
-import org.springframework.beans.factory.annotation.Autowired;
public class DefaultActivityValueService
implements IActivityValueService
@@ -24,19 +23,55 @@
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
-
- @Autowired
private org.hisp.dhis.program.ProgramStageInstanceService programStageInstanceService;
- @Autowired
+ public org.hisp.dhis.program.ProgramStageInstanceService getProgramStageInstanceService()
+ {
+ return programStageInstanceService;
+ }
+
+ public void setProgramStageInstanceService(
+ org.hisp.dhis.program.ProgramStageInstanceService programStageInstanceService )
+ {
+ this.programStageInstanceService = programStageInstanceService;
+ }
+
private org.hisp.dhis.dataelement.DataElementCategoryService categoryService;
- @Autowired
+ public org.hisp.dhis.dataelement.DataElementCategoryService getCategoryService()
+ {
+ return categoryService;
+ }
+
+ public void setCategoryService( org.hisp.dhis.dataelement.DataElementCategoryService categoryService )
+ {
+ this.categoryService = categoryService;
+ }
+
private org.hisp.dhis.patientdatavalue.PatientDataValueService dataValueService;
- @Autowired
+ public org.hisp.dhis.patientdatavalue.PatientDataValueService getDataValueService()
+ {
+ return dataValueService;
+ }
+
+ public void setDataValueService( org.hisp.dhis.patientdatavalue.PatientDataValueService dataValueService )
+ {
+ this.dataValueService = dataValueService;
+ }
+
private CurrentUserService currentUserService;
+ public CurrentUserService getCurrentUserService()
+ {
+ return currentUserService;
+ }
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
// -------------------------------------------------------------------------
// DataValueService
// -------------------------------------------------------------------------
@@ -46,6 +81,7 @@
{
Collection<OrganisationUnit> units = currentUserService.getCurrentUser().getOrganisationUnits();
+
OrganisationUnit unit = null;
if ( units.size() > 0 )
@@ -118,10 +154,8 @@
for ( DataValue dv : activityValue.getDataValues() )
{
value = dv.getVal();
- System.out.println("COC ID: " + dv.getCategoryOptComboID());
DataElementCategoryOptionCombo cateOptCombo = categoryService.getDataElementCategoryOptionCombo( dv
.getCategoryOptComboID() );
- System.out.println(cateOptCombo);
if ( value != null && value.trim().length() == 0 )
{
value = null;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultDataSetService.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultDataSetService.java 2010-11-09 02:53:08 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultDataSetService.java 2010-11-15 08:35:53 +0000
@@ -20,7 +20,6 @@
import org.hisp.dhis.web.api.model.DataSet;
import org.hisp.dhis.web.api.model.Section;
import org.hisp.dhis.web.api.utils.LocaleUtil;
-import org.springframework.beans.factory.annotation.Autowired;
public class DefaultDataSetService
implements IDataSetService
@@ -31,19 +30,47 @@
// -------------------------------------------------------------------------
private DataElementSortOrderComparator dataElementComparator = new DataElementSortOrderComparator();
- @Autowired
+
private org.hisp.dhis.dataset.DataSetService dataSetService;
-
- @Autowired
+
+ public org.hisp.dhis.dataset.DataSetService getDataSetService()
+ {
+ return dataSetService;
+ }
+
+ public void setDataSetService( org.hisp.dhis.dataset.DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
private org.hisp.dhis.i18n.I18nService i18nService;
-
- @Autowired
+
+ public org.hisp.dhis.i18n.I18nService getI18nService()
+ {
+ return i18nService;
+ }
+
+ public void setI18nService( org.hisp.dhis.i18n.I18nService i18nService )
+ {
+ this.i18nService = i18nService;
+ }
+
private CurrentUserService currentUserService;
+ public CurrentUserService getCurrentUserService()
+ {
+ return currentUserService;
+ }
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
// -------------------------------------------------------------------------
// MobileDataSetService
// -------------------------------------------------------------------------
+
public List<DataSet> getAllMobileDataSetsForLocale( String localeString )
{
Collection<OrganisationUnit> units = currentUserService.getCurrentUser().getOrganisationUnits();
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultDataValueService.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultDataValueService.java 2010-11-09 02:53:08 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultDataValueService.java 2010-11-15 08:35:53 +0000
@@ -23,21 +23,66 @@
// Dependencies
// -------------------------------------------------------------------------
- @Autowired
private org.hisp.dhis.dataset.DataSetService dataSetService;
- @Autowired
+ public org.hisp.dhis.dataset.DataSetService getDataSetService()
+ {
+ return dataSetService;
+ }
+
+ public void setDataSetService( org.hisp.dhis.dataset.DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
private IPeriodService periodService;
- @Autowired
+ public IPeriodService getPeriodService()
+ {
+ return periodService;
+ }
+
+ public void setPeriodService( IPeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
private org.hisp.dhis.dataelement.DataElementCategoryService categoryService;
- @Autowired
+ public org.hisp.dhis.dataelement.DataElementCategoryService getCategoryService()
+ {
+ return categoryService;
+ }
+
+ public void setCategoryService( org.hisp.dhis.dataelement.DataElementCategoryService categoryService )
+ {
+ this.categoryService = categoryService;
+ }
+
private org.hisp.dhis.datavalue.DataValueService dataValueService;
- @Autowired
+ public org.hisp.dhis.datavalue.DataValueService getDataValueService()
+ {
+ return dataValueService;
+ }
+
+ public void setDataValueService( org.hisp.dhis.datavalue.DataValueService dataValueService )
+ {
+ this.dataValueService = dataValueService;
+ }
+
private CurrentUserService currentUserService;
+ public CurrentUserService getCurrentUserService()
+ {
+ return currentUserService;
+ }
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
// -------------------------------------------------------------------------
// DataValueService
// -------------------------------------------------------------------------
@@ -80,10 +125,10 @@
dataElementIds.add( dv.getId() );
}
-// if ( dataElements.size() != dataElementIds.size() )
-// {
-// return "INVALID_DATASET";
-// }
+ // if ( dataElements.size() != dataElementIds.size() )
+ // {
+ // return "INVALID_DATASET";
+ // }
Map<Integer, org.hisp.dhis.dataelement.DataElement> dataElementMap = new HashMap<Integer, org.hisp.dhis.dataelement.DataElement>();
for ( org.hisp.dhis.dataelement.DataElement dataElement : dataElements )
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultPeriodService.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultPeriodService.java 2010-11-09 02:53:08 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultPeriodService.java 2010-11-15 08:35:53 +0000
@@ -15,7 +15,6 @@
import org.hisp.dhis.period.QuarterlyPeriodType;
import org.hisp.dhis.period.WeeklyPeriodType;
import org.hisp.dhis.period.YearlyPeriodType;
-import org.springframework.beans.factory.annotation.Autowired;
/**
* @author abyotag_adm
@@ -29,13 +28,23 @@
// Dependencies
// -------------------------------------------------------------------------
- @Autowired
private org.hisp.dhis.period.PeriodService periodService;
+
+ public org.hisp.dhis.period.PeriodService getPeriodService()
+ {
+ return periodService;
+ }
+ public void setPeriodService( org.hisp.dhis.period.PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
// -------------------------------------------------------------------------
// PeriodService
// -------------------------------------------------------------------------
+
+
public Period getPeriod( String periodName, DataSet dataSet )
{
org.hisp.dhis.period.Period period = null;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultProgramService.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultProgramService.java 2010-11-13 17:48:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultProgramService.java 2010-11-15 08:35:53 +0000
@@ -33,59 +33,35 @@
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
-
- @Autowired
private org.hisp.dhis.program.ProgramService programService;
- @Autowired
+ public org.hisp.dhis.program.ProgramService getProgramService()
+ {
+ return programService;
+ }
+
+ public void setProgramService( org.hisp.dhis.program.ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
private org.hisp.dhis.i18n.I18nService i18nService;
- @Autowired
+ public org.hisp.dhis.i18n.I18nService getI18nService()
+ {
+ return i18nService;
+ }
+
+ public void setI18nService( org.hisp.dhis.i18n.I18nService i18nService )
+ {
+ this.i18nService = i18nService;
+ }
+
private CurrentUserService currentUserService;
// -------------------------------------------------------------------------
// ProgramService
// -------------------------------------------------------------------------
-
- // public AbstractModelList getAllProgramsForLocale(String localeString)
- // {
- // Collection<OrganisationUnit> units =
- // currentUserService.getCurrentUser().getOrganisationUnits();
- // OrganisationUnit unit = null;
- //
- // if( units.size() > 0 )
- // {
- // unit = units.iterator().next();
- // }
- // else
- // {
- // return null;
- // }
- //
- // Locale locale = LocaleUtil.getLocale(localeString);
- //
- // AbstractModelList abstractModelList = new AbstractModelList();
- //
- // List<AbstractModel> abstractModels = new ArrayList<AbstractModel>();
- //
- // for (org.hisp.dhis.program.Program program :
- // programService.getPrograms(unit))
- // {
- // program = i18n( i18nService, locale, program );
- //
- // AbstractModel abstractModel = new AbstractModel();
- //
- // abstractModel.setId( program.getId());
- // abstractModel.setName(program.getName());
- //
- // abstractModels.add(abstractModel);
- // }
- //
- // abstractModelList.setAbstractModels(abstractModels);
- //
- // return abstractModelList;
- // }
-
public List<Program> getAllProgramsForLocale( String localeString )
{
List<Program> programs = new ArrayList<Program>();
@@ -171,4 +147,5 @@
return pr;
}
+
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ProgramStageService.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ProgramStageService.java 2010-09-24 11:12:49 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ProgramStageService.java 2010-11-15 08:35:53 +0000
@@ -9,51 +9,63 @@
import org.hisp.dhis.web.api.model.DataElement;
import org.springframework.beans.factory.annotation.Autowired;
-public class ProgramStageService {
-
- @Autowired
- private org.hisp.dhis.program.ProgramStageService programStageService;
-
- public List<Form> getAllForms() {
-
- List<Form> forms = new ArrayList<Form>();
-
- for (org.hisp.dhis.program.ProgramStage programStage : programStageService.getAllProgramStages()) {
-
- Form modelProgramStage = new Form();
-
- modelProgramStage.setId( programStage.getId());
- modelProgramStage.setName( programStage.getName());
-
- forms.add(modelProgramStage);
-
- }
-
- return forms;
- }
-
- public Form getForm(int programStageId)
- {
- org.hisp.dhis.program.ProgramStage programStage = programStageService.getProgramStage( programStageId );
-
- Collection<ProgramStageDataElement> dataElements = programStage.getProgramStageDataElements();
-
- Form modelProgramStage = new Form();
- List<DataElement> des = new ArrayList<DataElement>();
- modelProgramStage.setId( programStage.getId() );
- modelProgramStage.setName( programStage.getName() );
-
- for( ProgramStageDataElement programStageDataElement : dataElements )
- {
- DataElement de = new DataElement();
- de.setId( programStageDataElement.getDataElement().getId() );
- de.setName( programStageDataElement.getDataElement().getName() );
- de.setType( programStageDataElement.getDataElement().getType() );
- des.add( de );
- }
-
- modelProgramStage.setDataElements(des);
-
- return modelProgramStage;
- }
+public class ProgramStageService
+{
+
+ private org.hisp.dhis.program.ProgramStageService programStageService;
+
+ public org.hisp.dhis.program.ProgramStageService getProgramStageService()
+ {
+ return programStageService;
+ }
+
+ public void setProgramStageService( org.hisp.dhis.program.ProgramStageService programStageService )
+ {
+ this.programStageService = programStageService;
+ }
+
+ public List<Form> getAllForms()
+ {
+
+ List<Form> forms = new ArrayList<Form>();
+
+ for ( org.hisp.dhis.program.ProgramStage programStage : programStageService.getAllProgramStages() )
+ {
+
+ Form modelProgramStage = new Form();
+
+ modelProgramStage.setId( programStage.getId() );
+ modelProgramStage.setName( programStage.getName() );
+
+ forms.add( modelProgramStage );
+
+ }
+
+ return forms;
+ }
+
+ public Form getForm( int programStageId )
+ {
+ org.hisp.dhis.program.ProgramStage programStage = programStageService.getProgramStage( programStageId );
+
+ Collection<ProgramStageDataElement> dataElements = programStage.getProgramStageDataElements();
+
+ Form modelProgramStage = new Form();
+ List<DataElement> des = new ArrayList<DataElement>();
+ modelProgramStage.setId( programStage.getId() );
+ modelProgramStage.setName( programStage.getName() );
+
+ for ( ProgramStageDataElement programStageDataElement : dataElements )
+ {
+ DataElement de = new DataElement();
+ de.setId( programStageDataElement.getDataElement().getId() );
+ de.setName( programStageDataElement.getDataElement().getName() );
+ de.setType( programStageDataElement.getDataElement().getType() );
+ des.add( de );
+ }
+
+ modelProgramStage.setDataElements( des );
+
+ return modelProgramStage;
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml 2010-11-03 07:28:12 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml 2010-11-15 08:35:53 +0000
@@ -25,11 +25,34 @@
<!-- Resources -->
<bean id="org.hisp.dhis.web.api.resources.MobileResouce"
- class="org.hisp.dhis.web.api.resources.MobileResouce" scope="prototype"/>
+ class="org.hisp.dhis.web.api.resources.MobileResouce" scope="prototype">
+ <property name="programService">
+ <ref bean="org.hisp.dhis.web.api.service.IProgramService"/>
+ </property>
+ <property name="activityPlanService">
+ <ref bean="org.hisp.dhis.web.api.service.IActivityPlanService"/>
+ </property>
+ <property name="idataSetService">
+ <ref bean="org.hisp.dhis.web.api.service.IDataSetService"/>
+ </property>
+ <property name="currentUserService">
+ <ref bean="org.hisp.dhis.user.CurrentUserService"/>
+ </property>
+ </bean>
<bean id="org.hisp.dhis.web.api.resources.OrgUnitResource"
class="org.hisp.dhis.web.api.resources.OrgUnitResource"
- scope="prototype"/>
+ scope="prototype">
+ <property name="service">
+ <ref bean="org.hisp.dhis.web.api.service.ActivityPlanModelService"/>
+ </property>
+ <property name="programStageService">
+ <ref bean="org.hisp.dhis.web.api.service.ProgramStageService"/>
+ </property>
+ <property name="organisationUnitService">
+ <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+ </property>
+ </bean>
<bean id="org.hisp.dhis.web.api.resources.DataSetResource"
class="org.hisp.dhis.web.api.resources.DataSetResource" scope="prototype"/>
@@ -42,28 +65,102 @@
<!-- Services -->
<bean id="org.hisp.dhis.web.api.service.ActivityPlanModelService"
- class="org.hisp.dhis.web.api.service.ActivityPlanModelService"/>
+ class="org.hisp.dhis.web.api.service.ActivityPlanModelService">
+ <property name="activityPlanService">
+ <ref bean="org.hisp.dhis.activityplan.ActivityPlanService"/>
+ </property>
+ </bean>
<bean id="org.hisp.dhis.web.api.service.IActivityPlanService"
- class="org.hisp.dhis.web.api.service.DefaultActivityPlanService"/>
+ class="org.hisp.dhis.web.api.service.DefaultActivityPlanService">
+ <property name="activityPlanService">
+ <ref bean="org.hisp.dhis.activityplan.ActivityPlanService"/>
+ </property>
+ <property name="patientAttValueService">
+ <ref bean="org.hisp.dhis.patientattributevalue.PatientAttributeValueService"/>
+ </property>
+ <property name="patientAttService">
+ <ref bean="org.hisp.dhis.patient.PatientAttributeService"/>
+ </property>
+ <property name="currentUserService">
+ <ref bean="org.hisp.dhis.user.CurrentUserService"/>
+ </property>
+ </bean>
<bean id="org.hisp.dhis.web.api.service.ProgramStageService"
- class="org.hisp.dhis.web.api.service.ProgramStageService"/>
+ class="org.hisp.dhis.web.api.service.ProgramStageService">
+ <property name="programStageService">
+ <ref bean="org.hisp.dhis.program.ProgramStageService"/>
+ </property>
+ </bean>
<bean id="org.hisp.dhis.web.api.service.IProgramService"
- class="org.hisp.dhis.web.api.service.DefaultProgramService"/>
+ class="org.hisp.dhis.web.api.service.DefaultProgramService">
+ <property name="programService">
+ <ref bean="org.hisp.dhis.program.ProgramService"/>
+ </property>
+ <property name="i18nService">
+ <ref bean="org.hisp.dhis.i18n.I18nService"/>
+ </property>
+ <property name="currentUserService">
+ <ref bean="org.hisp.dhis.user.CurrentUserService"/>
+ </property>
+ </bean>
<bean id="org.hisp.dhis.web.api.service.IDataSetService"
- class="org.hisp.dhis.web.api.service.DefaultDataSetService" />
+ class="org.hisp.dhis.web.api.service.DefaultDataSetService">
+ <property name="dataSetService">
+ <ref bean="org.hisp.dhis.dataset.DataSetService"/>
+ </property>
+ <property name="i18nService">
+ <ref bean="org.hisp.dhis.i18n.I18nService"/>
+ </property>
+ <property name="currentUserService">
+ <ref bean="org.hisp.dhis.user.CurrentUserService"/>
+ </property>
+ </bean>
<bean id="org.hisp.dhis.web.api.service.IDataValueService"
- class="org.hisp.dhis.web.api.service.DefaultDataValueService" />
+ class="org.hisp.dhis.web.api.service.DefaultDataValueService">
+ <property name="dataSetService">
+ <ref bean="org.hisp.dhis.dataset.DataSetService"/>
+ </property>
+ <property name="periodService">
+ <ref bean="org.hisp.dhis.web.api.service.IPeriodService"/>
+ </property>
+ <property name="categoryService">
+ <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
+ </property>
+ <property name="dataValueService">
+ <ref bean="org.hisp.dhis.datavalue.DataValueService"/>
+ </property>
+ <property name="currentUserService">
+ <ref bean="org.hisp.dhis.user.CurrentUserService"/>
+ </property>
+ </bean>
<bean id="org.hisp.dhis.web.api.service.IActivityValueService"
- class="org.hisp.dhis.web.api.service.DefaultActivityValueService" />
+ class="org.hisp.dhis.web.api.service.DefaultActivityValueService">
+ <property name="programStageInstanceService">
+ <ref bean="org.hisp.dhis.program.ProgramStageInstanceService"/>
+ </property>
+ <property name="categoryService">
+ <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService"/>
+ </property>
+ <property name="dataValueService">
+ <ref bean="org.hisp.dhis.patientdatavalue.PatientDataValueService"/>
+ </property>
+ <property name="currentUserService">
+ <ref bean="org.hisp.dhis.user.CurrentUserService"/>
+ </property>
+ </bean>
<bean id="org.hisp.dhis.web.api.service.IPeriodService"
- class="org.hisp.dhis.web.api.service.DefaultPeriodService" />
+ class="org.hisp.dhis.web.api.service.DefaultPeriodService">
+ <property name="periodService">
+ <ref bean="org.hisp.dhis.period.PeriodService"/>
+ </property>
+ </bean>
<!-- Response writers -->
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java 2010-11-12 10:28:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/AddPatientAttributeAction.java 2010-11-15 08:35:53 +0000
@@ -137,6 +137,7 @@
patientAtt.setGroupBy( false );
patientAttributeService.updatePatientAttribute( patientAtt );
}
+ patientAttribute.setMandatory( true );
}
patientAttributeService.savePatientAttribute( patientAttribute );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java 2010-11-12 10:28:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/patientattribute/UpdatePatientAttributeAction.java 2010-11-15 08:35:53 +0000
@@ -151,6 +151,7 @@
patientAtt.setGroupBy( false );
patientAttributeService.updatePatientAttribute( patientAtt );
}
+ patientAttribute.setMandatory( true );
}
patientAttribute.setGroupBy( groupBy );
HttpServletRequest request = ServletActionContext.getRequest();