← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13257: minor fixes to dhis-service-mobile

 

------------------------------------------------------------
revno: 13257
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-16 16:34:06 +0100
message:
  minor fixes to dhis-service-mobile
modified:
  dhis-2/dhis-services/dhis-service-mobile/pom.xml
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java
  dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-light/pom.xml


--
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/pom.xml'
--- dhis-2/dhis-services/dhis-service-mobile/pom.xml	2013-10-17 06:57:37 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/pom.xml	2013-12-16 15:34:06 +0000
@@ -14,11 +14,6 @@
   <name>DHIS Mobile Service</name>
 
   <dependencies>
-		
-    <dependency>
-      <groupId>org.hisp.dhis</groupId>
-      <artifactId>dhis-api</artifactId>
-    </dependency>
     <dependency>
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-service-core</artifactId>
@@ -31,7 +26,6 @@
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-service-patient</artifactId>
     </dependency>
-        
   </dependencies>
 
   <properties>

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java	2013-12-16 15:15:54 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/mobile/service/DefaultProgramService.java	2013-12-16 15:34:06 +0000
@@ -28,12 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
 import org.hisp.dhis.api.mobile.IProgramService;
 import org.hisp.dhis.api.mobile.model.DataElement;
 import org.hisp.dhis.api.mobile.model.Model;
@@ -46,6 +40,12 @@
 import org.hisp.dhis.program.ProgramStageSection;
 import org.springframework.beans.factory.annotation.Required;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 public class DefaultProgramService
     implements IProgramService
 {
@@ -70,22 +70,22 @@
 
         return programs;
     }
-    
+
     public List<org.hisp.dhis.api.mobile.model.LWUITmodel.Program> getProgramsLWUIT( OrganisationUnit unit )
     {
         Collection<org.hisp.dhis.program.Program> programByUnit = programService.getPrograms( unit );
-        
-        Collection<org.hisp.dhis.program.Program> programByCurrentUser = new HashSet<org.hisp.dhis.program.Program>( programService.getProgramsByCurrentUser());
-        
+
+        Collection<org.hisp.dhis.program.Program> programByCurrentUser = new HashSet<org.hisp.dhis.program.Program>( programService.getProgramsByCurrentUser() );
+
         programByCurrentUser.retainAll( programByUnit );
-        
+
         List<org.hisp.dhis.api.mobile.model.LWUITmodel.Program> programs = new ArrayList<org.hisp.dhis.api.mobile.model.LWUITmodel.Program>();
 
         for ( org.hisp.dhis.program.Program program : programByCurrentUser )
         {
-            programs.add( getProgramLWUIT( program.getId()) );
+            programs.add( getProgramLWUIT( program.getId() ) );
         }
-        
+
         return programs;
     }
 
@@ -96,10 +96,9 @@
 
         // Get all Program belong to this OrgUnit
         List<Program> serverPrograms = this.getPrograms( unit, localeString );
-        for ( int i = 0; i < serverPrograms.size(); i++ )
+
+        for ( Program program : serverPrograms )
         {
-            Program program = serverPrograms.get( i );
-
             // Loop thought the list of program from client
             for ( int j = 0; j < programsFromClient.getModels().size(); j++ )
             {
@@ -114,8 +113,9 @@
                     }
                 }
             }
+
             // Server has more program than client
-            if ( isExisted == false )
+            if ( !isExisted )
             {
                 programs.add( program );
             }
@@ -149,7 +149,7 @@
 
             List<DataElement> des = new ArrayList<DataElement>();
 
-            Set<ProgramStageDataElement> programStageDataElements =  programStage.getProgramStageDataElements();
+            Set<ProgramStageDataElement> programStageDataElements = programStage.getProgramStageDataElements();
 
             for ( ProgramStageDataElement programStagedataElement : programStageDataElements )
             {
@@ -174,7 +174,7 @@
 
         return pr;
     }
-    
+
     public org.hisp.dhis.api.mobile.model.LWUITmodel.Program getProgramLWUIT( int programId )
     {
         org.hisp.dhis.program.Program program = programService.getProgram( programId );
@@ -195,19 +195,19 @@
             //programStage = i18n( i18nService, locale, programStage );
 
             org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage prStg = new org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStage();
-            
+
             //add report date
-            
+
             prStg.setReportDate( "" );
-            
+
             prStg.setReportDateDescription( programStage.getReportDateDescription() );
-            
+
             prStg.setId( programStage.getId() );
 
             prStg.setName( programStage.getName() );
-            
+
             prStg.setRepeatable( programStage.getIrregular() );
-            
+
             if ( programStage.getStandardInterval() == null )
             {
                 prStg.setStandardInterval( 0 );
@@ -216,14 +216,14 @@
             {
                 prStg.setStandardInterval( programStage.getStandardInterval() );
             }
-            
+
             prStg.setCompleted( false );
-            
+
             prStg.setSingleEvent( program.isSingleEvent() );
 
             List<org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement> des = new ArrayList<org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement>();
 
-            Set<ProgramStageDataElement> programStageDataElements =  programStage.getProgramStageDataElements();
+            Set<ProgramStageDataElement> programStageDataElements = programStage.getProgramStageDataElements();
 
             for ( ProgramStageDataElement programStageDataElement : programStageDataElements )
             {
@@ -232,16 +232,16 @@
                 org.hisp.dhis.dataelement.DataElement dataElement = programStageDataElement.getDataElement();
 
                 org.hisp.dhis.api.mobile.model.LWUITmodel.ProgramStageDataElement de = ModelMapping.getDataElementLWUIT( dataElement );
-                
+
                 de.setCompulsory( programStageDataElement.isCompulsory() );
-                
+
                 de.setNumberType( programStageDataElement.getDataElement().getNumberType() );
 
                 des.add( de );
             }
 
             prStg.setDataElements( des );
-            
+
             // Set all program sections
             List<org.hisp.dhis.api.mobile.model.LWUITmodel.Section> mobileSections = new ArrayList<org.hisp.dhis.api.mobile.model.LWUITmodel.Section>();
             if ( programStage.getProgramStageSections().size() > 0 )

=== modified file 'dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml	2013-12-16 15:15:54 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/resources/META-INF/dhis/beans.xml	2013-12-16 15:34:06 +0000
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans";
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd";>
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd";>
 
   <!-- Services -->
 
@@ -12,8 +12,8 @@
     <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
     <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
     <property name="registrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
-	<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-	<property name="oUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService"></property>
+    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+    <property name="oUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 
   <bean id="org.hisp.dhis.mobile.api.ActivityReportingService" class="org.hisp.dhis.mobile.service.ActivityReportingServiceImpl">
@@ -23,33 +23,34 @@
     <property name="dataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
     <property name="patientMobileSettingService" ref="org.hisp.dhis.mobile.service.PatientMobileSettingService" />
     <property name="patientIdentifierService" ref="org.hisp.dhis.patient.PatientIdentifierService" />
-    <property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService"/>
-	<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
-	<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
-	<property name="relationshipService" ref="org.hisp.dhis.relationship.RelationshipService" />
-	<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
-	<property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
-	<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
-	<property name="patientIdentifierTypeService" ref="org.hisp.dhis.patient.PatientIdentifierTypeService"></property>
-	<property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService"></property>
-	<property name="relationshipTypeService" ref="org.hisp.dhis.relationship.RelationshipTypeService"></property>
-	<property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
-	<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-	<property name="messageService" ref="org.hisp.dhis.message.MessageService" />
-	<property name="smsSender" ref="org.hisp.dhis.sms.SmsSender" />
+    <property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService" />
+    <property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+    <property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
+    <property name="relationshipService" ref="org.hisp.dhis.relationship.RelationshipService" />
+    <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+    <property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+    <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+    <property name="patientIdentifierTypeService" ref="org.hisp.dhis.patient.PatientIdentifierTypeService" />
+    <property name="patientAttributeService" ref="org.hisp.dhis.patient.PatientAttributeService" />
+    <property name="relationshipTypeService" ref="org.hisp.dhis.relationship.RelationshipTypeService" />
+    <property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
+    <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+    <property name="messageService" ref="org.hisp.dhis.message.MessageService" />
+    <property name="smsSender" ref="org.hisp.dhis.sms.SmsSender" />
   </bean>
 
   <bean id="org.hisp.dhis.mobile.api.IProgramService" class="org.hisp.dhis.mobile.service.DefaultProgramService">
     <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
   </bean>
 
-  <bean id="org.hisp.dhis.mobile.service.PatientMobileSettingService" class="org.hisp.dhis.mobile.service.DefaultPatientMobileSettingService">
+  <bean id="org.hisp.dhis.mobile.service.PatientMobileSettingService"
+    class="org.hisp.dhis.mobile.service.DefaultPatientMobileSettingService">
     <property name="patientMobileSettingStore" ref="org.hisp.dhis.mobile.service.PatientMobileSettingStore" />
   </bean>
-  
+
   <bean id="org.hisp.dhis.mobile.service.PatientMobileSettingStore" class="org.hisp.dhis.mobile.service.HibernatePatientMobileSettingStore">
-    <property name="clazz" value="org.hisp.dhis.patient.PatientMobileSetting"/>
-    <property name="sessionFactory" ref="sessionFactory"/>
+    <property name="clazz" value="org.hisp.dhis.patient.PatientMobileSetting" />
+    <property name="sessionFactory" ref="sessionFactory" />
   </bean>
 
 </beans>

=== modified file 'dhis-2/dhis-web/dhis-web-light/pom.xml'
--- dhis-2/dhis-web/dhis-web-light/pom.xml	2013-10-17 06:57:37 +0000
+++ dhis-2/dhis-web/dhis-web-light/pom.xml	2013-12-16 15:34:06 +0000
@@ -1,5 +1,5 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
@@ -24,7 +24,7 @@
     </dependency>
 
     <!-- DHIS -->
-    
+
     <dependency>
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-api</artifactId>
@@ -48,7 +48,11 @@
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-service-core</artifactId>
     </dependency>
-    
+
+    <dependency>
+      <groupId>org.hisp.dhis</groupId>
+      <artifactId>dhis-service-patient</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.hisp.dhis</groupId>
       <artifactId>dhis-service-reporting</artifactId>