← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13264: Light, centralized methods

 

------------------------------------------------------------
revno: 13264
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-16 18:21:39 +0100
message:
  Light, centralized methods
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java
  dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetActivityListAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java
  dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.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-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2013-12-16 17:13:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2013-12-16 17:21:39 +0000
@@ -73,7 +73,6 @@
 
         for ( GenericIdentifiableObjectStore<IdentifiableObject> store : identifiableObjectStores )
         {
-            System.out.println("id store '" + store + "' - '" + store.getClazz() + "' - '" + store.getClass());
             if ( store != null && store.getClazz() != null )
             {
                 identifiableObjectStoreMap.put( store.getClazz(), store );

=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java	2013-12-16 17:13:31 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java	2013-12-16 17:21:39 +0000
@@ -97,6 +97,7 @@
     /**
      * Could be injected through container.
      */
+    @Required
     public void setClazz( Class<T> clazz )
     {
         this.clazz = clazz;

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java	2013-12-16 17:13:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java	2013-12-16 17:21:39 +0000
@@ -364,7 +364,7 @@
                     else if ( type.equals( DataElement.VALUE_TYPE_INT )
                         && numberType.equals( DataElement.VALUE_TYPE_POSITIVE_INT ) )
                     {
-                        if ( !FormUtils.isPositiveInteger( value ) )
+                        if ( !MathUtils.isPositiveInteger( value ) )
                         {
                             correctType = false;
                             typeViolations.put( key, "\"" + value + "\"" + " " + i18n.getString( "is_invalid_positive_integer" ) );
@@ -373,7 +373,7 @@
                     else if ( type.equals( DataElement.VALUE_TYPE_INT )
                         && numberType.equals( DataElement.VALUE_TYPE_NEGATIVE_INT ) )
                     {
-                        if ( !FormUtils.isNegativeInteger( value ) )
+                        if ( !MathUtils.isNegativeInteger( value ) )
                         {
                             correctType = false;
                             typeViolations.put( key, "\"" + value + "\"" + " " + i18n.getString( "is_invalid_negative_integer" ) );
@@ -382,7 +382,7 @@
                     else if ( type.equals( DataElement.VALUE_TYPE_INT)
                         && numberType.equals( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT ) )
                     {
-                        if ( !FormUtils.isZeroOrPositiveInteger( value ) )
+                        if ( !MathUtils.isZeroOrPositiveInteger( value ) )
                         {
                             correctType = false;
                             typeViolations.put( key, "\"" + value + "\"" + " " + i18n.getString( "is_invalid_zero_or_positive_integer" ) );

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetActivityListAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetActivityListAction.java	2013-12-16 15:45:17 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetActivityListAction.java	2013-12-16 17:21:39 +0000
@@ -28,16 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.hisp.dhis.api.mobile.ActivityReportingService;
 import org.hisp.dhis.api.mobile.model.Activity;
 import org.hisp.dhis.api.mobile.model.ActivityPlan;
-import org.hisp.dhis.light.utils.NamebasedUtils;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 
-import java.util.ArrayList;
-import java.util.List;
+import com.opensymphony.xwork2.Action;
 
 public class GetActivityListAction
     implements Action
@@ -60,13 +60,6 @@
         this.organisationUnitService = organisationUnitService;
     }
 
-    private NamebasedUtils util;
-
-    public void setUtil( NamebasedUtils util )
-    {
-        this.util = util;
-    }
-
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java	2013-12-16 15:45:17 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java	2013-12-16 17:21:39 +0000
@@ -38,7 +38,6 @@
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.struts2.StrutsStatics;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.light.utils.NamebasedUtils;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -117,13 +116,6 @@
         this.patientService = patientService;
     }
 
-    private DataElementCategoryService dataElementCategoryService;
-
-    public void setDataElementCategoryService( DataElementCategoryService dataElementCategoryService )
-    {
-        this.dataElementCategoryService = dataElementCategoryService;
-    }
-
     private ProgramStageService programStageService;
 
     public void setProgramStageService( ProgramStageService programStageService )

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java	2013-12-16 17:13:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/FormUtils.java	2013-12-16 17:21:39 +0000
@@ -299,21 +299,6 @@
     // Static Utils
     // -------------------------------------------------------------------------
 
-    public static boolean isPositiveInteger( String value )
-    {
-        return valueHigher( value, 0 );
-    }
-    
-    public static boolean isZeroOrPositiveInteger( String value )
-    {
-        return valueHigherOrEqual( value, 0 );
-    }
-
-    public static boolean isNegativeInteger( String value )
-    {
-        return valueLower( value, 0 );
-    }
-
     public static boolean valueHigher( String value, int max )
     {
         int integerValue;

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java	2013-12-16 17:13:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/utils/NamebasedUtils.java	2013-12-16 17:21:39 +0000
@@ -119,21 +119,21 @@
         }
         else if ( type.equals( DataElement.VALUE_TYPE_INT ) && numberType.equals( DataElement.VALUE_TYPE_POSITIVE_INT ) )
         {
-            if ( !FormUtils.isPositiveInteger( value ) )
+            if ( !MathUtils.isPositiveInteger( value ) )
             {
                 return "is_invalid_positive_integer";
             }
         }
         else if ( type.equals( DataElement.VALUE_TYPE_INT ) && numberType.equals( DataElement.VALUE_TYPE_NEGATIVE_INT ) )
         {
-            if ( !FormUtils.isNegativeInteger( value ) )
+            if ( !MathUtils.isNegativeInteger( value ) )
             {
                 return "is_invalid_negative_integer";
             }
         }
         else if ( type.equals( DataElement.VALUE_TYPE_INT ) && numberType.equals( DataElement.VALUE_TYPE_ZERO_OR_POSITIVE_INT ) )
         {
-            if ( !FormUtils.isZeroOrPositiveInteger( value ) )
+            if ( !MathUtils.isZeroOrPositiveInteger( value ) )
             {
                 return "is_invalid_zero_or_positive_integer";
             }

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2013-12-16 17:13:31 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2013-12-16 17:21:39 +0000
@@ -156,7 +156,6 @@
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 		<property name="activityReportingService"
 			ref="org.hisp.dhis.mobile.api.ActivityReportingService" />
-		<property name="util" ref="org.hisp.dhis.light.utils.NamebasedUtils" />
 	</bean>
 
 	<bean