← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12802: [mobile] change models to support client

 

------------------------------------------------------------
revno: 12802
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Wed 2013-10-23 15:26:05 +0700
message:
  [mobile] change models to support client
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientIdentifier.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.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-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientIdentifier.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientIdentifier.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/PatientIdentifier.java	2013-10-23 08:26:05 +0000
@@ -42,6 +42,8 @@
     private String identifierType;
 
     private String identifier;
+    
+    private boolean isMandatory;
 
     public PatientIdentifier()
     {
@@ -52,6 +54,13 @@
         this.identifierType = identifierType;
         this.identifier = identifier;
     }
+    
+    public PatientIdentifier( String identifierType, String identifier, boolean isMandatory )
+    {
+        this.identifierType = identifierType;
+        this.identifier = identifier;
+        this.isMandatory = isMandatory;
+    }
 
     @XmlAttribute
     public String getIdentifierType()
@@ -84,6 +93,16 @@
     {
         this.clientVersion = clientVersion;
     }
+    
+    public boolean isMandatory()
+    {
+        return isMandatory;
+    }
+
+    public void setMandatory( boolean isMandatory )
+    {
+        this.isMandatory = isMandatory;
+    }
 
     @Override
     public void serialize( DataOutputStream dataOutputStream )
@@ -91,6 +110,7 @@
     {
         dataOutputStream.writeUTF( identifierType );
         dataOutputStream.writeUTF( identifier );
+        dataOutputStream.writeBoolean( isMandatory );
     }
 
     @Override
@@ -99,6 +119,7 @@
     {
         identifierType = dataInputStream.readUTF();
         identifier = dataInputStream.readUTF();
+        isMandatory = dataInputStream.readBoolean();
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2013-10-22 04:01:39 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/ActivityReportingServiceImpl.java	2013-10-23 08:26:05 +0000
@@ -563,10 +563,9 @@
         if ( isNumber( keyword ) == false )
         {
             OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
-
             List<Patient> patients = (List<Patient>) patientService.getPatientByFullname( keyword,
                 organisationUnit );
-
+            
             if ( patients.size() > 1 )
             {
                 String patientsInfo = new String();
@@ -1400,7 +1399,6 @@
         {
 
             OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId );
-
             String fullName = enrollmentRelationship.getPersonBName();
             List<Patient> patients = (List<Patient>) patientService.getPatientByFullname( fullName,
                 organisationUnit );
@@ -1766,7 +1764,7 @@
             {
                 idt += " (*)";
             }
-            list.add( new org.hisp.dhis.api.mobile.model.PatientIdentifier( idt, id ) );
+            list.add( new org.hisp.dhis.api.mobile.model.PatientIdentifier( idt, id, identifierType.isMandatory() ) );
         }
         return list;
     }