dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08180
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1924: More details in Activity View
------------------------------------------------------------
revno: 1924
committer: Tran Ng Minh Luan <Luan@MinhLuan-PC>
branch nick: cbhis-mobile
timestamp: Tue 2010-10-19 16:32:21 +0700
message:
More details in Activity View
Server send more details
Change View
modified:
DHISMobile/.classpath
DHISMobile/.mtj
DHISMobile/build.properties
DHISMobile/src/org/hisp/dhis/mobile/reporting/connection/ConnectionManager.java
DHISMobile/src/org/hisp/dhis/mobile/reporting/db/ActivityRecordFilter.java
DHISMobile/src/org/hisp/dhis/mobile/reporting/db/ActivityRecordStore.java
DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java
DHISMobile/src/org/hisp/dhis/mobile/reporting/model/Activity.java
DHISMobile/src/org/hisp/dhis/mobile/reporting/model/ActivityPlan.java
DHISMobile/src/org/hisp/dhis/mobile/reporting/model/Beneficiary.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/ActivityPlan.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/Beneficiary.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/mapping/BeneficiaryMapper.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 'DHISMobile/.classpath'
--- DHISMobile/.classpath 2010-10-18 08:10:12 +0000
+++ DHISMobile/.classpath 2010-10-19 09:32:21 +0000
@@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="res"/>
- <classpathentry kind="con" path="org.elipse.mtj.JavaMEContainer/Series 40 5th Edition SDK, Feature Pack 1 Lite/S40_5th_Edition_SDK_Feature_Pack_1_Lite"/>
+ <classpathentry kind="con" path="org.elipse.mtj.JavaMEContainer/Sun Java(TM) Wireless Toolkit 2.5.2_01 for CLDC/DefaultColorPhone"/>
<classpathentry exported="true" kind="lib" path="lib/jzlib-1.0.7.jar"/>
<classpathentry exported="true" kind="con" path="org.eclipse.mtj.core.EXTERNAL_LIBRARY/JMUnit for CLDC 1.1"/>
<classpathentry kind="lib" path="lib/LWUIT.jar"/>
=== modified file 'DHISMobile/.mtj'
--- DHISMobile/.mtj 2010-10-18 08:10:12 +0000
+++ DHISMobile/.mtj 2010-10-19 09:32:21 +0000
@@ -5,11 +5,11 @@
<alias/>
</signing>
<configurations>
- <configuration active="true" name="S40_5th_Edition_SDK_Feature_Pack_1">
+ <configuration active="false" name="S40_5th_Edition_SDK_Feature_Pack_1">
<device group="Series 40 5th Edition SDK, Feature Pack 1 Lite" name="S40_5th_Edition_SDK_Feature_Pack_1_Lite"/>
<symbolSet name="AmharicColorPhone">
+ <symbol name="screen.isColor" value="true"/>
<symbol name="MMAPI" value="1.1"/>
- <symbol name="screen.isColor" value="true"/>
<symbol name="screen.bitDepth" value="8"/>
<symbol name="JSR82" value="1.1"/>
<symbol name="JSR226" value="1.0"/>
@@ -18,8 +18,8 @@
<symbol name="SATSA-PKI" value="1.0"/>
<symbol name="CLDC" value="1.1"/>
<symbol name="JSR179" value="1.0"/>
+ <symbol name="WMA" value="2.0"/>
<symbol name="SATSA-JCRMI" value="1.0"/>
- <symbol name="WMA" value="2.0"/>
<symbol name="J2ME-WS" value="1.0"/>
<symbol name="screen.width" value="240"/>
<symbol name="JSR238" value="1.0"/>
@@ -52,17 +52,50 @@
<symbol name="screen.canvas.width" value="128"/>
<symbol name="screen.canvas.y" value="40"/>
<symbol name="screen.canvas.x" value="0"/>
+ <symbol name="JSR75" value="1.0"/>
<symbol name="SATSA-APDU" value="1.0"/>
<symbol name="MIDP" value="1.0"/>
- <symbol name="JSR75" value="1.0"/>
<symbol name="CLDC" value="1.0"/>
<symbol name="screen.canvas.height" value="160"/>
<symbol name="SATSA-CRYPTO" value="1.0"/>
<symbol name="version.configuration" value="CDLC-1.1"/>
- <symbol name="version.profile" value="MIDP-2.1"/>
<symbol name="WMA" value="1.1"/>
+ <symbol name="version.profile" value="MIDP-2.1"/>
<symbol name="screen.height" value="160"/>
</symbolSet>
</configuration>
+ <configuration active="true" name="DefaultColorPhone">
+ <device group="Sun Java(TM) Wireless Toolkit 2.5.2_01 for CLDC" name="DefaultColorPhone"/>
+ <symbolSet name="DefaultColorPhone">
+ <symbol name="screen.isColor" value="true"/>
+ <symbol name="MMAPI" value="1.1"/>
+ <symbol name="screen.bitDepth" value="8"/>
+ <symbol name="JSR82" value="1.1"/>
+ <symbol name="JSR226" value="1.0"/>
+ <symbol name="MIDP" value="2.1"/>
+ <symbol name="JSR229" value="1.1"/>
+ <symbol name="SATSA-PKI" value="1.0"/>
+ <symbol name="CLDC" value="1.1"/>
+ <symbol name="JSR179" value="1.0"/>
+ <symbol name="WMA" value="2.0"/>
+ <symbol name="SATSA-JCRMI" value="1.0"/>
+ <symbol name="J2ME-WS" value="1.0"/>
+ <symbol name="screen.width" value="240"/>
+ <symbol name="JSR238" value="1.0"/>
+ <symbol name="JSR239" value="1.0"/>
+ <symbol name="screen.isTouch" value="false"/>
+ <symbol name="JSR211" value="1.0"/>
+ <symbol name="JSR234" value="1.0"/>
+ <symbol name="SATSA-APDU" value="1.0"/>
+ <symbol name="JSR75" value="1.0"/>
+ <symbol name="J2ME-XMLRPC" value="1.0"/>
+ <symbol name="JSR184" value="1.1"/>
+ <symbol name="SATSA-CRYPTO" value="1.0"/>
+ <symbol name="version.configuration" value="CLDC-1.1"/>
+ <symbol name="version.profile" value="MIDP-2.1"/>
+ <symbol name="JSR180" value="1.0"/>
+ <symbol name="screen.height" value="320"/>
+ </symbolSet>
+ </configuration>
</configurations>
</mtjMetadata>
\ No newline at end of file
=== modified file 'DHISMobile/build.properties'
--- DHISMobile/build.properties 2010-10-18 03:25:22 +0000
+++ DHISMobile/build.properties 2010-10-19 09:32:21 +0000
@@ -9,3 +9,8 @@
S40_5th_Edition_SDK_Feature_Pack_1_Lite.excludes=\
+DefaultColorPhone.includes=src\
+,res\
+
+DefaultColorPhone.excludes=\
+
=== modified file 'DHISMobile/src/org/hisp/dhis/mobile/reporting/connection/ConnectionManager.java'
--- DHISMobile/src/org/hisp/dhis/mobile/reporting/connection/ConnectionManager.java 2010-10-18 03:25:22 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/reporting/connection/ConnectionManager.java 2010-10-19 09:32:21 +0000
@@ -48,6 +48,7 @@
import org.hisp.dhis.mobile.reporting.util.AlertUtil;
import com.jcraft.jzlib.ZInputStream;
+import com.sun.midp.io.Base64;
public class ConnectionManager extends Thread {
@@ -157,7 +158,7 @@
// set HTTP basic authentication
if (userName != null && password != null) {
byte[] auth = (userName+":"+password).getBytes();
- conn.setRequestProperty( "Authorization", "Basic " + Base64.encode( auth, 0, auth.length ));
+ conn.setRequestProperty( "Authorization", "Basic " + Base64.encode( auth, 0, auth.length ));
}
}
@@ -482,9 +483,9 @@
throw new IOException("Too much redirects");
}
}catch (SecurityException e){
- //e.printStackTrace();
+ e.printStackTrace();
}catch (Exception e) {
- //e.printStackTrace();
+ e.printStackTrace();
} finally {
try {
if (hcon != null)
=== modified file 'DHISMobile/src/org/hisp/dhis/mobile/reporting/db/ActivityRecordFilter.java'
--- DHISMobile/src/org/hisp/dhis/mobile/reporting/db/ActivityRecordFilter.java 2010-10-15 20:03:33 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/reporting/db/ActivityRecordFilter.java 2010-10-19 09:32:21 +0000
@@ -76,6 +76,10 @@
dis.readUTF();
dis.readUTF();
dis.readUTF();
+ int i = dis.readInt();
+ for(int j = 0; j < i; j++){
+ dis.readUTF();
+ }
dis.readLong();
dis.readInt();
dis.readInt();
@@ -104,6 +108,10 @@
dis.readUTF();
dis.readUTF();
dis.readUTF();
+ int i = dis.readInt();
+ for(int j = 0; j < i; j++){
+ dis.readUTF();
+ }
dis.readLong();
dis.readInt();
dis.readInt();
@@ -132,6 +140,10 @@
dis.readUTF();
dis.readUTF();
dis.readUTF();
+ int i = dis.readInt();
+ for(int j = 0; j < i; j++){
+ dis.readUTF();
+ }
dis.readLong();
if (dis.readInt() == this.progStageInstId) {
return true;
=== modified file 'DHISMobile/src/org/hisp/dhis/mobile/reporting/db/ActivityRecordStore.java'
--- DHISMobile/src/org/hisp/dhis/mobile/reporting/db/ActivityRecordStore.java 2010-10-18 08:10:12 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/reporting/db/ActivityRecordStore.java 2010-10-19 09:32:21 +0000
@@ -178,7 +178,7 @@
.nextRecord()));
}
} catch (Exception e) {
-
+ e.printStackTrace();
} finally {
if (re != null)
re.destroy();
=== modified file 'DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java'
--- DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java 2010-10-18 08:10:12 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/reporting/gui/DHISMIDlet.java 2010-10-19 09:32:21 +0000
@@ -402,15 +402,14 @@
mainMenuList.append("Current Activity Plan", null);
mainMenuList.append("Completed Activity Plan", null);
mainMenuList.append("Update Avtivity Plan", null);
-// mainMenuList.append("Services", null);
-// mainMenuList.append("Maintenance", null);
-// mainMenuList.append("Settings", null);
+ mainMenuList.append("Services", null);
+ mainMenuList.append("Maintenance", null);
+ mainMenuList.append("Settings", null);
mainMenuList.addCommand(getMnuListExtCmd());
mainMenuList.addCommand(getSettingCommand());
mainMenuList.setCommandListener(this);
mainMenuList.setFitPolicy(Choice.TEXT_WRAP_DEFAULT);
- mainMenuList
- .setSelectedFlags(new boolean[] { false, false, false });
+ mainMenuList.setSelectedFlags(new boolean[] { false, false, false, false, false, false });
}
return mainMenuList;
}
@@ -640,7 +639,7 @@
*/
public TextField getUrl() {
if (url == null) {
- url = new TextField("Server Location", "http://localhost:8080/api/",
+ url = new TextField("Server Location", "http://localhost:8280/dhis-web-api/api/",
64, TextField.URL);
}
return url;
@@ -893,7 +892,7 @@
public TextField getServerUrl() {
if (serverURL == null) {
serverURL = new TextField("Server Location",
- "http://localhost:8080/api/", 64, TextField.URL);
+ "http://localhost:8280/dhis-web-api/api/", 64, TextField.URL);
}
return serverURL;
}
@@ -1187,6 +1186,7 @@
+ "\nName: "
+ selectedActivity.getBeneficiary()
.getFullName()
+ +"\n"+generatePatientAtts(selectedActivity.getBeneficiary().getAttsValues())
+ "\nDue date: "
+ Period.formatDailyPeriod(selectedActivity
.getDueDate()));
@@ -1203,6 +1203,14 @@
switchDisplayable(null, getActivityDetailForm());
}
+
+ private String generatePatientAtts(Vector atts){
+ String infos = "";
+ for(int i =0; i< atts.size(); i++){
+ infos += "\n"+atts.elementAt( i )+"\n";
+ }
+ return infos;
+ }
/**
* Returns an initialized instance of maintenanceLst component.
=== modified file 'DHISMobile/src/org/hisp/dhis/mobile/reporting/model/Activity.java'
--- DHISMobile/src/org/hisp/dhis/mobile/reporting/model/Activity.java 2010-10-15 20:03:33 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/reporting/model/Activity.java 2010-10-19 09:32:21 +0000
@@ -6,6 +6,7 @@
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Date;
+import java.util.Vector;
public class Activity implements ISerializable {
@@ -51,13 +52,22 @@
Beneficiary beneficiary = new Beneficiary();
Task task = new Task();
try {
+ // Read Beneficiary Information
beneficiary.setId(din.readInt());
beneficiary.setLastName(din.readUTF());
beneficiary.setMiddleName(din.readUTF());
beneficiary.setFirstName(din.readUTF());
-
+ Vector atts = new Vector();
+ beneficiary.setAttsValues( atts );
+ int numAtt = din.readInt();
+ for(int i = 0; i < numAtt; i++){
+ atts.addElement(din.readUTF());
+ }
+
+ // Write Due Date
activity.setDueDate(new Date(din.readLong()));
-
+
+ // Write Task Information
task.setProgStageInstId(din.readInt());
task.setProgStageId(din.readInt());
task.setComplete(din.readBoolean());
@@ -75,20 +85,27 @@
DataOutputStream dout = new DataOutputStream(deOs);
try {
- // Write Beneficiary Information
+ // Write Beneficiary Information
dout.writeInt(activity.getBeneficiary().getId());
dout.writeUTF(activity.getBeneficiary().getLastName());
dout.writeUTF(activity.getBeneficiary().getMiddleName());
dout.writeUTF(activity.getBeneficiary().getFirstName());
+ Vector atts = activity.getBeneficiary().getAttsValues();
+ int numAtt = atts.size();
+ dout.writeInt(numAtt);
+ for(int i = 0; i < numAtt; i++){
+ dout.writeUTF( (String)atts.elementAt( i ) );
+ }
+
// Write Due Date
dout.writeLong(activity.getDueDate().getTime());
+
// Write Task Information
dout.writeInt(activity.getTask().getProgStageInstId());
dout.writeInt(activity.getTask().getProgStageId());
dout.writeBoolean(activity.getTask().isComplete());
dout.flush();
} catch (IOException e) {
- System.out.println(e);
e.printStackTrace();
}
return deOs.toByteArray();
@@ -120,7 +137,6 @@
dout.writeBoolean(this.getTask().isComplete());
dout.flush();
} catch (IOException e) {
- System.out.println(e);
e.printStackTrace();
}
=== modified file 'DHISMobile/src/org/hisp/dhis/mobile/reporting/model/ActivityPlan.java'
--- DHISMobile/src/org/hisp/dhis/mobile/reporting/model/ActivityPlan.java 2010-10-15 20:03:33 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/reporting/model/ActivityPlan.java 2010-10-19 09:32:21 +0000
@@ -19,7 +19,7 @@
public void deSerialize(DataInputStream din) throws IOException {
int size = din.readInt();
-
+
for (int i = 0; i < size; i++) {
Activity activity = new Activity();
activity.setDueDate(new Date(din.readLong()));
@@ -29,6 +29,13 @@
b.setFirstName(din.readUTF());
b.setMiddleName(din.readUTF());
b.setLastName(din.readUTF());
+ int attsNumb = din.readInt();
+
+ Vector attsVector = b.getAttsValues();
+
+ for(int j=0;j<attsNumb;j++){
+ attsVector.addElement( din.readUTF() );
+ }
activity.setBeneficiary(b);
Task t = new Task();
=== modified file 'DHISMobile/src/org/hisp/dhis/mobile/reporting/model/Beneficiary.java'
--- DHISMobile/src/org/hisp/dhis/mobile/reporting/model/Beneficiary.java 2010-10-15 20:03:33 +0000
+++ DHISMobile/src/org/hisp/dhis/mobile/reporting/model/Beneficiary.java 2010-10-19 09:32:21 +0000
@@ -2,6 +2,7 @@
import java.io.DataInputStream;
import java.io.IOException;
+import java.util.Vector;
public class Beneficiary implements ISerializable {
@@ -9,6 +10,8 @@
private String firstName, middleName, lastName;
+ private Vector attsValues;
+
public Beneficiary() {
}
@@ -66,7 +69,24 @@
this.lastName = lastName;
}
- public byte[] serialize() throws IOException {
+
+
+ public Vector getAttsValues()
+ {
+ if(attsValues == null){
+ this.attsValues = new Vector();
+ return attsValues;
+ }else{
+ return attsValues;
+ }
+ }
+
+ public void setAttsValues( Vector attsValues )
+ {
+ this.attsValues = attsValues;
+ }
+
+ public byte[] serialize() throws IOException {
// TODO Auto-generated method stub
return null;
}
@@ -81,5 +101,11 @@
this.setFirstName(din.readUTF());
this.setMiddleName(din.readUTF());
this.setLastName(din.readUTF());
+ this.attsValues = new Vector();
+ int attsNumb = din.readInt();
+ for(int j=0;j<attsNumb;j++){
+ attsValues.addElement( din.readUTF() );
+ }
+
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/ActivityPlan.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/ActivityPlan.java 2010-09-24 11:12:49 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/ActivityPlan.java 2010-10-19 09:32:21 +0000
@@ -5,6 +5,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
+import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@@ -49,6 +50,7 @@
DataOutputStream dout = new DataOutputStream(bout);
dout.writeInt(activitiesList.size());
+
for(int i=0; i<activitiesList.size(); i++)
{
@@ -57,7 +59,15 @@
dout.writeLong(activity.getDueDate().getTime());
Beneficiary b = activity.getBeneficiary();
- dout.writeInt(b.getId()); dout.writeUTF(b.getFirstName()); dout.writeUTF(b.getMiddleName()); dout.writeUTF(b.getLastName());
+ dout.writeInt(b.getId());
+ dout.writeUTF(b.getFirstName());
+ dout.writeUTF(b.getMiddleName());
+ dout.writeUTF(b.getLastName());
+ Set<String> atts = b.getPatientAttValues();
+ dout.writeInt( atts.size() );
+ for(String att : atts){
+ dout.writeUTF( att );
+ }
Task t = activity.getTask();
dout.writeInt(t.getId()); dout.writeInt(t.getProgramStageId()); dout.writeBoolean(t.isCompleted());
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/Beneficiary.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/Beneficiary.java 2010-09-24 11:12:49 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/model/Beneficiary.java 2010-10-19 09:32:21 +0000
@@ -4,6 +4,7 @@
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
@@ -18,6 +19,22 @@
private String middleName;
private String lastName;
+
+ private Set<String> patientAttValues;
+
+
+
+
+
+ public Set<String> getPatientAttValues()
+ {
+ return patientAttValues;
+ }
+
+ public void setPatientAttValues( Set<String> patientAttValues )
+ {
+ this.patientAttValues = patientAttValues;
+ }
@XmlAttribute
public int getId()
@@ -97,4 +114,6 @@
// TODO Auto-generated method stub
}
+
+
}
=== 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-09-24 11:12:49 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityPlanService.java 2010-10-19 09:32:21 +0000
@@ -5,12 +5,20 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import org.hisp.dhis.activityplan.Activity;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
+import org.hisp.dhis.patientattributevalue.PatientAttributeValueService;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.web.api.model.ActivityPlan;
+import org.hisp.dhis.web.api.model.Beneficiary;
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;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,6 +37,9 @@
private org.hisp.dhis.activityplan.ActivityPlanService activityPlanService;
@Autowired
+ private PatientAttributeValueService patientAttValueService ;
+
+ @Autowired
private CurrentUserService currentUserService;
// -------------------------------------------------------------------------
@@ -68,10 +79,80 @@
}
}
- ActivityPlan plan = new ActivitiesMapper().getModel( activities );
+// ActivityPlan plan = new ActivitiesMapper().getModel( activities );
+ ActivityPlan plan = getActivityPlanModel(activities);
- System.out.println("The size of the plan is: " + plan.getActivitiesList().size());
return plan;
}
+
+
+
+
+ //method replace the Mappers
+ private org.hisp.dhis.web.api.model.ActivityPlan getActivityPlanModel( Collection<org.hisp.dhis.activityplan.Activity> activities )
+ {
+ ActivityPlan plan = new ActivityPlan();
+
+ if ( activities == null || activities.isEmpty() )
+ {
+ return plan;
+ }
+
+ List<org.hisp.dhis.web.api.model.Activity> items = new ArrayList<org.hisp.dhis.web.api.model.Activity>();
+ plan.setActivitiesList( items );
+ int i = 0;
+ for ( org.hisp.dhis.activityplan.Activity activity : activities )
+ {
+ //there are error on db with patientattributeid 14, so I limit the patient to be downloaded
+ if(i<=10){
+ org.hisp.dhis.web.api.model.Activity temp = getActivityModel( activity);
+ if(temp != null){
+ items.add(temp);
+ }
+ i++;
+ }
+ }
+ return plan;
+ }
+
+
+ private org.hisp.dhis.web.api.model.Activity getActivityModel( org.hisp.dhis.activityplan.Activity activity )
+ {
+ if ( activity == null )
+ {
+ return null;
+ }
+ org.hisp.dhis.web.api.model.Activity item = new org.hisp.dhis.web.api.model.Activity();
+ Patient patient = activity.getBeneficiary();
+
+ item.setBeneficiary( getBeneficiaryModel(patient) );
+ item.setDueDate( activity.getDueDate() );
+ item.setTask( new TaskMapper().getModel( activity.getTask()) );
+ return item;
+ }
+
+
+
+ private org.hisp.dhis.web.api.model.Beneficiary getBeneficiaryModel( Patient patient )
+ {
+
+
+ Beneficiary beneficiary = new Beneficiary();
+
+ Set<String> patientAttValues = new HashSet<String>();
+
+
+ beneficiary.setId( patient.getId() );
+ beneficiary.setFirstName( patient.getFirstName() );
+ beneficiary.setLastName( patient.getLastName() );
+ beneficiary.setMiddleName( patient.getMiddleName() );
+
+ for(PatientAttributeValue value : patientAttValueService.getPatientAttributeValues( patient )){
+ patientAttValues.add( value.getPatientAttribute().getName() +" : "+ value.getValue());
+ }
+ beneficiary.setPatientAttValues( patientAttValues );
+
+ return beneficiary;
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/mapping/BeneficiaryMapper.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/mapping/BeneficiaryMapper.java 2010-08-25 17:40:56 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/mapping/BeneficiaryMapper.java 2010-10-19 09:32:21 +0000
@@ -21,7 +21,7 @@
beneficiary.setFirstName( patient.getFirstName() );
beneficiary.setLastName( patient.getLastName() );
beneficiary.setMiddleName( patient.getMiddleName() );
-
+
return beneficiary;
}