dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40297
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20412: remove TrackedEntityAttribute type constants
------------------------------------------------------------
revno: 20412
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-09-30 14:07:39 +0700
message:
remove TrackedEntityAttribute type constants
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.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-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2015-09-03 15:30:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2015-09-30 07:07:39 +0000
@@ -59,18 +59,6 @@
public class TrackedEntityAttribute
extends BaseDimensionalObject
{
- public static final String TYPE_STRING = "string";
- public static final String TYPE_PHONE_NUMBER = "phoneNumber";
- public static final String TYPE_EMAIL = "email";
- public static final String TYPE_NUMBER = "number";
- public static final String TYPE_LETTER = "letter";
- public static final String TYPE_BOOL = "bool";
- public static final String TYPE_TRUE_ONLY = "trueOnly";
- public static final String TYPE_DATE = "date";
- public static final String TYPE_OPTION_SET = "optionSet";
- public static final String TYPE_TRACKER_ASSOCIATE = "trackerAssociate";
- public static final String TYPE_USERS = "users";
-
private String description;
private ValueType valueType;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java 2015-09-03 09:36:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java 2015-09-30 07:07:39 +0000
@@ -43,6 +43,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
+import java.util.Objects;
/**
* @author Abyot Asalefew Gizaw
@@ -224,12 +225,13 @@
{
boolean orgunitScope = false;
boolean programScope = false;
- if ( scope != null && (scope == SCOPE_ORGUNIT || scope == SCOPE_PROGRAM_IN_ORGUNIT) )
+
+ if ( Objects.equals( scope, SCOPE_ORGUNIT ) || Objects.equals( scope, SCOPE_PROGRAM_IN_ORGUNIT ) )
{
orgunitScope = true;
}
- if ( scope != null && (scope == SCOPE_PROGRAM || scope == SCOPE_PROGRAM_IN_ORGUNIT) )
+ if ( Objects.equals( scope, SCOPE_PROGRAM ) || Objects.equals( scope, SCOPE_PROGRAM_IN_ORGUNIT ) )
{
programScope = true;
}
@@ -237,11 +239,11 @@
trackedEntityAttribute.setOrgunitScope( orgunitScope );
trackedEntityAttribute.setProgramScope( programScope );
}
- else if ( valueType.equals( TrackedEntityAttribute.TYPE_OPTION_SET ) )
+ else if ( ValueType.OPTION_SET == valueType )
{
trackedEntityAttribute.setOptionSet( optionService.getOptionSet( optionSetId ) );
}
- else if ( valueType.equals( TrackedEntityAttribute.TYPE_TRACKER_ASSOCIATE ) )
+ else if ( ValueType.TRACKER_ASSOCIATE == valueType )
{
trackedEntityAttribute.setTrackedEntity( trackedEntityService.getTrackedEntity( trackedEntityId ) );
}
@@ -253,8 +255,7 @@
if ( jsonAttributeValues != null )
{
- AttributeUtils.updateAttributeValuesFromJson( trackedEntityAttribute.getAttributeValues(), jsonAttributeValues,
- attributeService );
+ AttributeUtils.updateAttributeValuesFromJson( trackedEntityAttribute.getAttributeValues(), jsonAttributeValues, attributeService );
}
trackedEntityAttributeService.addTrackedEntityAttribute( trackedEntityAttribute );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java 2015-09-03 09:36:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java 2015-09-30 07:07:39 +0000
@@ -42,6 +42,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
+import java.util.Objects;
/**
* @author Abyot Asalefew Gizaw
@@ -229,12 +230,12 @@
boolean orgunitScope = false;
boolean programScope = false;
- if ( scope != null && (scope == SCOPE_ORGUNIT || scope == SCOPE_PROGRAM_IN_ORGUNIT) )
+ if ( Objects.equals( scope, SCOPE_ORGUNIT ) || Objects.equals( scope, SCOPE_PROGRAM_IN_ORGUNIT ) )
{
orgunitScope = true;
}
- if ( scope != null && (scope == SCOPE_PROGRAM || scope == SCOPE_PROGRAM_IN_ORGUNIT) )
+ if ( Objects.equals( scope, SCOPE_PROGRAM ) || Objects.equals( scope, SCOPE_PROGRAM_IN_ORGUNIT ) )
{
programScope = true;
}
@@ -242,11 +243,11 @@
trackedEntityAttribute.setOrgunitScope( orgunitScope );
trackedEntityAttribute.setProgramScope( programScope );
}
- else if ( valueType.equals( TrackedEntityAttribute.TYPE_OPTION_SET ) )
+ else if ( ValueType.OPTION_SET == valueType )
{
trackedEntityAttribute.setOptionSet( optionService.getOptionSet( optionSetId ) );
}
- else if ( valueType.equals( TrackedEntityAttribute.TYPE_TRACKER_ASSOCIATE ) )
+ else if ( ValueType.TRACKER_ASSOCIATE == valueType )
{
trackedEntityAttribute.setTrackedEntity( trackedEntityService.getTrackedEntity( trackedEntityId ) );
}