← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21163: refactor AttributeService/AttributeStore to use a Class => PropertyName for Attribute map instead...

 

------------------------------------------------------------
revno: 21163
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-11-23 16:06:48 +0700
message:
  refactor AttributeService/AttributeStore to use a Class => PropertyName for Attribute map instead, simplified AttributeStore service to have getAttribute(klass) for getting associated attributes, also added getMandatoryAttributes(klass) and getUniqueAttributes(klass)
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeStoreTest.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ShowAddDataElementCategoryOptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/GetCategoryOptionGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowAddCategoryOptionGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowUpdateCategoryOptionGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/ShowAddCategoryOptionGroupSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowDataElementFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowAddDataElementGroupForm.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowUpdateDataElementGroupFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowAddIndicatorForm.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowAddIndicatorGroupForm.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowUpdateIndicatorGroupFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/EditDataSetFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/ShowAddOrganisationUnitFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/ShowAddOrganisationUnitGroupFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/ShowAddOrganisationUnitGroupSetFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/ShowUpdateGroupSetFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowAddProgramFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowUpdateProgramFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/GetProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/ShowAddUpdateTrackedEntityAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddUpdateAttributeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/AddUserGroupFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/EditUserGroupFormAction.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/attribute/AttributeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java	2015-11-23 07:21:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java	2015-11-23 09:06:48 +0000
@@ -105,117 +105,11 @@
      */
     List<Attribute> getAllAttributes();
 
-    /**
-     * Gets attributes which are associated with data elements.
-     *
-     * @return a set of attributes associated with data elements.
-     */
-    List<Attribute> getDataElementAttributes();
-
-    /**
-     * Gets attributes which are associated with data element groups.
-     *
-     * @return a set of attributes associated with data element groups.
-     */
-    List<Attribute> getDataElementGroupAttributes();
-
-    /**
-     * Gets attributes which are associated with indicators.
-     *
-     * @return a set of attributes associated with indicators.
-     */
-    List<Attribute> getIndicatorAttributes();
-
-    /**
-     * Gets attributes which are associated with data elements.
-     *
-     * @return a set of attributes associated with data elements.
-     */
-    List<Attribute> getIndicatorGroupAttributes();
-
-    /**
-     * Gets attributes which are associated with data sets.
-     *
-     * @return a set of attributes associated with data sets.
-     */
-    List<Attribute> getDataSetAttributes();
-
-    /**
-     * Gets attributes which are associated with organisation units.
-     *
-     * @return a set of attributes associated with organisation units.
-     */
-    List<Attribute> getOrganisationUnitAttributes();
-
-    /**
-     * Gets attributes which are associated with organisation unit groups.
-     *
-     * @return a set of attributes associated with organisation unit groups.
-     */
-    List<Attribute> getOrganisationUnitGroupAttributes();
-
-    /**
-     * Gets attributes which are associated with organisation unit group sets.
-     *
-     * @return a set of attributes associated with organisation unit group sets.
-     */
-    List<Attribute> getOrganisationUnitGroupSetAttributes();
-
-    /**
-     * Gets attributes which are associated with users.
-     *
-     * @return a set of attributes which are associated with users.
-     */
-    List<Attribute> getUserAttributes();
-
-    /**
-     * Gets attributes which are associated with user groups.
-     *
-     * @return a set of attributes which are associated with user groups.
-     */
-    List<Attribute> getUserGroupAttributes();
-
-    /**
-     * Gets attributes which are associated with programs.
-     *
-     * @return a set of attributes which are associated with programs.
-     */
-    List<Attribute> getProgramAttributes();
-
-    /**
-     * Gets attributes which are associated with program stages.
-     *
-     * @return a set of attributes which are associated with programs.
-     */
-    List<Attribute> getProgramStageAttributes();
-
-    /**
-     * Gets attributes which are associated with tracked entities.
-     *
-     * @return a set of attributes which are associated with programs.
-     */
-    List<Attribute> getTrackedEntityAttributes();
-
-    /**
-     * Gets attributes which are associated with tracked entity attributes
-     *
-     * @return a set of attributes which are associated with tracked entity attributes
-     */
-    List<Attribute> getTrackedEntityAttributeAttributes();
-
-    /**
-     * Gets attributes which are associated with category option attributes
-     *
-     * @return a set of attributes which are associated with category option attributes
-     */
-    List<Attribute> getCategoryOptionAttributes();
-
-    /**
-     * Gets attributes which are associated with category option group attributes
-     *
-     * @return a set of attributes which are associated with category option group attributes
-     */
-    List<Attribute> getCategoryOptionGroupAttributes();
+    List<Attribute> getAttributes( Class<?> klass );
+
+    List<Attribute> getMandatoryAttributes( Class<?> klass );
+
+    List<Attribute> getUniqueAttributes( Class<?> klass );
 
     /**
      * Gets the number of attributes.

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java	2015-11-17 04:18:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java	2015-11-23 09:06:48 +0000
@@ -28,10 +28,27 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.google.common.collect.ImmutableMap;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.dataelement.CategoryOptionGroup;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.trackedentity.TrackedEntity;
+import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserGroup;
+
 import java.util.List;
 
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
@@ -40,115 +57,28 @@
 {
     String ID = AttributeStore.class.getName();
 
-    /**
-     * Get all attributes that are enabled for data elements.
-     *
-     * @return All attributes with attribute.dataElement = true
-     */
-    List<Attribute> getDataElementAttributes();
-
-    /**
-     * Get all attributes that are enabled for data element groups.
-     *
-     * @return All attributes with attribute.dataElementGroup = true
-     */
-    List<Attribute> getDataElementGroupAttributes();
-
-    /**
-     * Get all attributes that are enabled for indicators.
-     *
-     * @return All attributes with attribute.indicator = true
-     */
-    List<Attribute> getIndicatorAttributes();
-
-    /**
-     * Get all attributes that are enabled for indicator groups.
-     *
-     * @return All attributes with attribute.indicatorGroup = true
-     */
-    List<Attribute> getIndicatorGroupAttributes();
-
-    /**
-     * Get all attributes that are enabled for data sets.
-     *
-     * @return All attributes with attribute.dataSet = true
-     */
-    List<Attribute> getDataSetAttributes();
-
-    /**
-     * Get all attributes that are enabled for organisation units.
-     *
-     * @return All attributes with attribute.organisationUnit = true
-     */
-    List<Attribute> getOrganisationUnitAttributes();
-
-    /**
-     * Get all attributes that are enabled for organisation unit groups.
-     *
-     * @return All attributes with attribute.organisationUnitGroup = true
-     */
-    List<Attribute> getOrganisationUnitGroupAttributes();
-
-    /**
-     * Get all attributes that are enabled for organisation unit group sets.
-     *
-     * @return All attributes with attribute.organisationUnitGroupSet = true
-     */
-    List<Attribute> getOrganisationUnitGroupSetAttributes();
-
-    /**
-     * Get all attributes that are enabled for users.
-     *
-     * @return All attributes with attribute.organisationUnit = true
-     */
-    List<Attribute> getUserAttributes();
-
-    /**
-     * Get all attributes that are enabled for user group.
-     *
-     * @return All attributes with attribute.organisationUnitGroup = true
-     */
-    List<Attribute> getUserGroupAttributes();
-
-    /**
-     * Get all attributes that are enabled for program.
-     *
-     * @return All attributes with attribute.program = true
-     */
-    List<Attribute> getProgramAttributes();
-
-    /**
-     * Gets attributes which are associated with program stages.
-     *
-     * @return a set of attributes which are associated with programs.
-     */
-    List<Attribute> getProgramStageAttributes();
-
-    /**
-     * Gets attributes which are associated with tracked entities.
-     *
-     * @return a set of attributes which are associated with programs.
-     */
-    List<Attribute> getTrackedEntityAttributes();
-
-    /**
-     * Gets attributes which are associated with tracked entity attributes
-     *
-     * @return a set of attributes which are associated with tracked entity attributes
-     */
-    List<Attribute> getTrackedEntityAttributeAttributes();
-
-    /**
-     * Gets attributes which are associated with category option attributes
-     *
-     * @return a set of attributes which are associated with category option attributes
-     */
-    List<Attribute> getCategoryOptionAttributes();
-
-    /**
-     * Gets attributes which are associated with category option group attributes
-     *
-     * @return a set of attributes which are associated with category option group attributes
-     */
-    List<Attribute> getCategoryOptionGroupAttributes();
+    ImmutableMap<Class<?>, String> CLASS_ATTRIBUTE_MAP = ImmutableMap.<Class<?>, String>builder()
+        .put( DataElement.class, "dataElementAttribute" )
+        .put( DataElementGroup.class, "dataElementGroupAttribute" )
+        .put( Indicator.class, "indicatorAttribute" )
+        .put( IndicatorGroup.class, "indicatorGroupAttribute" )
+        .put( DataSet.class, "dataSetAttribute" )
+        .put( OrganisationUnit.class, "organisationUnitAttribute" )
+        .put( OrganisationUnitGroup.class, "organisationUnitGroupAttribute" )
+        .put( OrganisationUnitGroupSet.class, "organisationUnitGroupSetAttribute" )
+        .put( User.class, "userAttribute" )
+        .put( UserGroup.class, "userGroupAttribute" )
+        .put( Program.class, "programAttribute" )
+        .put( ProgramStage.class, "programStageAttribute" )
+        .put( TrackedEntity.class, "trackedEntityAttribute" )
+        .put( TrackedEntityAttribute.class, "trackedEntityAttributeAttribute" )
+        .put( DataElementCategoryOption.class, "categoryOptionAttribute" )
+        .put( CategoryOptionGroup.class, "categoryOptionGroupAttribute" )
+        .build();
+
+    List<Attribute> getAttributes( Class<?> klass );
+
+    List<Attribute> getMandatoryAttributes( Class<?> klass );
+
+    List<Attribute> getUniqueAttributes( Class<?> klass );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java	2015-11-23 07:21:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java	2015-11-23 09:06:48 +0000
@@ -135,98 +135,21 @@
     }
 
     @Override
-    public List<Attribute> getDataElementAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getDataElementAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getDataElementGroupAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getDataElementGroupAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getIndicatorAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getIndicatorAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getIndicatorGroupAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getIndicatorGroupAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getDataSetAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getDataSetAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getOrganisationUnitAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getOrganisationUnitAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getOrganisationUnitGroupAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getOrganisationUnitGroupAttributes() ) );
-    }
-
-    @Override public List<Attribute> getOrganisationUnitGroupSetAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getOrganisationUnitGroupSetAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getUserAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getUserAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getUserGroupAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getUserGroupAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getProgramAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getProgramAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getProgramStageAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getProgramStageAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getTrackedEntityAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getTrackedEntityAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getTrackedEntityAttributeAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getTrackedEntityAttributeAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getCategoryOptionAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getCategoryOptionAttributes() ) );
-    }
-
-    @Override
-    public List<Attribute> getCategoryOptionGroupAttributes()
-    {
-        return new ArrayList<>( i18n( i18nService, attributeStore.getCategoryOptionGroupAttributes() ) );
+    public List<Attribute> getAttributes( Class<?> klass )
+    {
+        return attributeStore.getAttributes( klass );
+    }
+
+    @Override
+    public List<Attribute> getMandatoryAttributes( Class<?> klass )
+    {
+        return attributeStore.getMandatoryAttributes( klass );
+    }
+
+    @Override
+    public List<Attribute> getUniqueAttributes( Class<?> klass )
+    {
+        return attributeStore.getUniqueAttributes( klass );
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java	2015-11-17 04:18:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java	2015-11-23 09:06:48 +0000
@@ -45,113 +45,43 @@
 {
     @Override
     @SuppressWarnings( "unchecked" )
-    public List<Attribute> getDataElementAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "dataElementAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getDataElementGroupAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "dataElementGroupAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getIndicatorAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "indicatorAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getIndicatorGroupAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "indicatorGroupAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getDataSetAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "dataSetAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getOrganisationUnitAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "organisationUnitAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getOrganisationUnitGroupAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "organisationUnitGroupAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getOrganisationUnitGroupSetAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "organisationUnitGroupSetAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getUserAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "userAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getUserGroupAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "userGroupAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getProgramAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "programAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getProgramStageAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "programStageAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getTrackedEntityAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "trackedEntityAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getTrackedEntityAttributeAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "trackedEntityAttributeAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getCategoryOptionAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "categoryOptionAttribute", true ) ).list() );
-    }
-
-    @Override
-    @SuppressWarnings( "unchecked" )
-    public List<Attribute> getCategoryOptionGroupAttributes()
-    {
-        return new ArrayList<>( getCriteria( Restrictions.eq( "categoryOptionGroupAttribute", true ) ).list() );
+    public List<Attribute> getAttributes( Class<?> klass )
+    {
+        if ( !CLASS_ATTRIBUTE_MAP.containsKey( klass ) )
+        {
+            return new ArrayList<>();
+        }
+
+        return new ArrayList<>( getCriteria( Restrictions.eq( CLASS_ATTRIBUTE_MAP.get( klass ), true ) ).list() );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public List<Attribute> getMandatoryAttributes( Class<?> klass )
+    {
+        if ( !CLASS_ATTRIBUTE_MAP.containsKey( klass ) )
+        {
+            return new ArrayList<>();
+        }
+
+        return new ArrayList<>( getCriteria(
+            Restrictions.eq( "mandatory", true ),
+            Restrictions.eq( CLASS_ATTRIBUTE_MAP.get( klass ), true )
+        ).list() );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public List<Attribute> getUniqueAttributes( Class<?> klass )
+    {
+        if ( !CLASS_ATTRIBUTE_MAP.containsKey( klass ) )
+        {
+            return new ArrayList<>();
+        }
+
+        return new ArrayList<>( getCriteria(
+            Restrictions.eq( "unique", true ),
+            Restrictions.eq( CLASS_ATTRIBUTE_MAP.get( klass ), true )
+        ).list() );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeStoreTest.java	2015-11-18 05:35:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeStoreTest.java	2015-11-23 09:06:48 +0000
@@ -33,6 +33,7 @@
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -73,19 +74,19 @@
     @Test
     public void testGetDataElementAttributes()
     {
-        assertEquals( 2, attributeStore.getDataElementAttributes().size() );
+        assertEquals( 2, attributeStore.getAttributes( DataElement.class ).size() );
     }
 
     @Test
     public void testGetIndicatorAttributes()
     {
-        assertEquals( 1, attributeStore.getIndicatorAttributes().size() );
+        assertEquals( 1, attributeStore.getAttributes( Indicator.class ).size() );
     }
 
     @Test
     public void testGetOrganisationUnitAttributes()
     {
-        assertEquals( 1, attributeStore.getOrganisationUnitAttributes().size() );
+        assertEquals( 1, attributeStore.getAttributes( OrganisationUnit.class ).size() );
     }
 
     @Test

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionAction.java	2015-08-19 05:26:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryOptionAction.java	2015-11-23 09:06:48 +0000
@@ -119,7 +119,7 @@
 
         selectionManager.setSelectedOrganisationUnits( dataElementCategoryOption.getOrganisationUnits() );
 
-        attributes = new ArrayList<>( attributeService.getCategoryOptionAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( DataElementCategoryOption.class ) );
 
         attributeValues = AttributeUtils.getAttributeValueMap( dataElementCategoryOption.getAttributeValues() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ShowAddDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ShowAddDataElementCategoryOptionAction.java	2015-09-03 10:14:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/ShowAddDataElementCategoryOptionAction.java	2015-11-23 09:06:48 +0000
@@ -28,15 +28,15 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Jim Grace
@@ -76,7 +76,7 @@
     {
         selectionManager.setSelectedOrganisationUnits( new ArrayList<>() );
 
-        attributes = new ArrayList<>( attributeService.getCategoryOptionAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( DataElementCategoryOption.class ) );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/GetCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/GetCategoryOptionGroupAction.java	2015-08-22 15:02:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/GetCategoryOptionGroupAction.java	2015-11-23 09:06:48 +0000
@@ -28,20 +28,19 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.dataelement.CategoryOptionGroup;
+import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Chau Thu Tran
- * @version $ GetCategoryOptionGroupAction.java Feb 12, 2014 11:27:01 PM $
  */
 public class GetCategoryOptionGroupAction
     implements Action
@@ -91,7 +90,7 @@
     {
         categoryOptionGroup = dataElementCategoryService.getCategoryOptionGroup( id );
 
-        attributes = new ArrayList<>( attributeService.getDataElementAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( DataElement.class ) );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowAddCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowAddCategoryOptionGroupAction.java	2015-08-19 07:56:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowAddCategoryOptionGroupAction.java	2015-11-23 09:06:48 +0000
@@ -31,6 +31,7 @@
 import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.dataelement.CategoryOptionGroup;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.ArrayList;
@@ -68,7 +69,7 @@
     public String execute()
         throws Exception
     {
-        attributes = attributeService.getCategoryOptionGroupAttributes();
+        attributes = attributeService.getAttributes( CategoryOptionGroup.class );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowUpdateCategoryOptionGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowUpdateCategoryOptionGroupAction.java	2015-08-19 05:26:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroup/ShowUpdateCategoryOptionGroupAction.java	2015-11-23 09:06:48 +0000
@@ -111,7 +111,7 @@
 
         categoryOptions = new ArrayList<>( categoryOptionGroup.getMembers() );
 
-        attributes = new ArrayList<>( attributeService.getCategoryOptionGroupAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( CategoryOptionGroup.class ) );
 
         attributeValues = AttributeUtils.getAttributeValueMap( categoryOptionGroup.getAttributeValues() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/ShowAddCategoryOptionGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/ShowAddCategoryOptionGroupSetAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoptiongroupset/ShowAddCategoryOptionGroupSetAction.java	2015-11-23 09:06:48 +0000
@@ -28,20 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.dataelement.CategoryOptionGroup;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author Chau Thu Tran
- * 
- * @version $ ShowAddCategoryOptionGroupSetAction.java Feb 12, 2014 11:20:01 PM
- *          $
  */
 public class ShowAddCategoryOptionGroupSetAction
     implements Action
@@ -72,8 +68,7 @@
     public String execute()
         throws Exception
     {
-        categoryOptionGroups = new ArrayList<>(
-            dataElementCategoryService.getAllCategoryOptionGroups() );
+        categoryOptionGroups = new ArrayList<>( dataElementCategoryService.getAllCategoryOptionGroups() );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowDataElementFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowDataElementFormAction.java	2015-02-24 13:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowDataElementFormAction.java	2015-11-23 09:06:48 +0000
@@ -28,13 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
@@ -53,7 +47,12 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.system.util.AttributeUtils;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Hans S. Toemmerholt
@@ -82,7 +81,7 @@
     // -------------------------------------------------------------------------
     // Input/output
     // -------------------------------------------------------------------------
-    
+
     private List<OrganisationUnitLevel> aggregationLevels = new ArrayList<>();
     private DataElementCategoryCombo defaultCategoryCombo;
     private List<DataElementGroupSet> groupSets;
@@ -231,7 +230,7 @@
         groupSets = new ArrayList<>( dataElementService
             .getCompulsoryDataElementGroupSetsWithMembers() );
 
-        attributes = new ArrayList<>( attributeService.getDataElementAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( DataElement.class ) );
 
         optionSets = new ArrayList<>( optionService.getAllOptionSets() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowAddDataElementGroupForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowAddDataElementGroupForm.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowAddDataElementGroupForm.java	2015-11-23 09:06:48 +0000
@@ -32,6 +32,7 @@
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
+import org.hisp.dhis.dataelement.DataElementGroup;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -69,7 +70,7 @@
     @Override
     public String execute()
     {
-        attributes = new ArrayList<>( attributeService.getDataElementGroupAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( DataElementGroup.class ) );
         Collections.sort( attributes, AttributeSortOrderComparator.INSTANCE );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowUpdateDataElementGroupFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowUpdateDataElementGroupFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/ShowUpdateDataElementGroupFormAction.java	2015-11-23 09:06:48 +0000
@@ -38,7 +38,11 @@
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.system.util.AttributeUtils;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Chau Thu Tran
@@ -123,7 +127,7 @@
 
         dataElements = new ArrayList<>( dataElementGroup.getMembers() );
 
-        attributes = new ArrayList<>( attributeService.getDataElementGroupAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( DataElementGroup.class ) );
 
         attributeValues = AttributeUtils.getAttributeValueMap( dataElementGroup.getAttributeValues() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowAddIndicatorForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowAddIndicatorForm.java	2015-02-24 13:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowAddIndicatorForm.java	2015-11-23 09:06:48 +0000
@@ -28,20 +28,20 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
 import org.hisp.dhis.legend.LegendService;
 import org.hisp.dhis.legend.LegendSet;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -98,7 +98,7 @@
     {
         return legendSets;
     }
-    
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -107,15 +107,15 @@
     public String execute()
     {
         indicatorTypes = new ArrayList<>( indicatorService.getAllIndicatorTypes() );
-        
-        attributes = new ArrayList<>( attributeService.getIndicatorAttributes() );
+
+        attributes = new ArrayList<>( attributeService.getAttributes( Indicator.class ) );
 
         legendSets = new ArrayList<>( legendService.getAllLegendSets() );
-        
+
         Collections.sort( indicatorTypes, IdentifiableObjectNameComparator.INSTANCE );
         Collections.sort( attributes, AttributeSortOrderComparator.INSTANCE );
         Collections.sort( legendSets, IdentifiableObjectNameComparator.INSTANCE );
-        
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java	2015-02-24 13:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ShowUpdateIndicatorFormAction.java	2015-11-23 09:06:48 +0000
@@ -28,12 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
@@ -46,12 +41,15 @@
 import org.hisp.dhis.legend.LegendSet;
 import org.hisp.dhis.system.util.AttributeUtils;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Chau Thu Tran
  * @version $ ShowUpdateIndicatorFormAction.java May 30, 2011 2:34:10 PM $
- * 
  */
 public class ShowUpdateIndicatorFormAction
     implements Action
@@ -168,12 +166,12 @@
 
         groupSets = new ArrayList<>( indicatorService.getCompulsoryIndicatorGroupSetsWithMembers() );
 
-        attributes = new ArrayList<>( attributeService.getIndicatorAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( Indicator.class ) );
 
         attributeValues = AttributeUtils.getAttributeValueMap( indicator.getAttributeValues() );
 
         legendSets = new ArrayList<>( legendService.getAllLegendSets() );
-        
+
         Collections.sort( indicatorTypes, IdentifiableObjectNameComparator.INSTANCE );
         Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );
         Collections.sort( attributes, AttributeSortOrderComparator.INSTANCE );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowAddIndicatorGroupForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowAddIndicatorGroupForm.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowAddIndicatorGroupForm.java	2015-11-23 09:06:48 +0000
@@ -32,6 +32,7 @@
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
+import org.hisp.dhis.indicator.Indicator;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -72,7 +73,7 @@
     @Override
     public String execute()
     {
-        attributes = new ArrayList<>( attributeService.getIndicatorAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( Indicator.class ) );
         Collections.sort( attributes, AttributeSortOrderComparator.INSTANCE );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowUpdateIndicatorGroupFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowUpdateIndicatorGroupFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/ShowUpdateIndicatorGroupFormAction.java	2015-11-23 09:06:48 +0000
@@ -38,7 +38,11 @@
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.system.util.AttributeUtils;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Chau Thu Tran
@@ -115,7 +119,7 @@
 
         indicators = new ArrayList<>( indicatorGroup.getMembers() );
 
-        attributes = new ArrayList<>( attributeService.getIndicatorGroupAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( IndicatorGroup.class ) );
 
         attributeValues = AttributeUtils.getAttributeValueMap( indicatorGroup.getAttributeValues() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java	2015-06-16 10:59:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatortype/GetIndicatorTypeListAction.java	2015-11-23 09:06:48 +0000
@@ -28,20 +28,21 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.apache.commons.lang3.StringUtils.isNotBlank;
-
-import java.util.Collections;
-import java.util.List;
-
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorGroupSet;
 import org.hisp.dhis.indicator.IndicatorService;
 import org.hisp.dhis.indicator.IndicatorType;
 import org.hisp.dhis.paging.ActionPagingSupport;
 
+import java.util.Collections;
+import java.util.List;
+
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
+
 /**
  * @author Torgeir Lorange Ostby
  */
@@ -126,7 +127,7 @@
 
         groupSets = indicatorService.getCompulsoryIndicatorGroupSetsWithMembers();
 
-        attributes = attributeService.getIndicatorAttributes();
+        attributes = attributeService.getAttributes( Indicator.class );
 
         Collections.sort( indicatorTypes, IdentifiableObjectNameComparator.INSTANCE );
         Collections.sort( attributes, AttributeSortOrderComparator.INSTANCE );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/EditDataSetFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/EditDataSetFormAction.java	2015-11-02 04:27:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/EditDataSetFormAction.java	2015-11-23 09:06:48 +0000
@@ -28,12 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
@@ -52,10 +47,14 @@
 import org.hisp.dhis.user.UserGroup;
 import org.hisp.dhis.user.UserGroupService;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
- * @author mortenoh
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 public class EditDataSetFormAction
     implements Action
@@ -77,7 +76,7 @@
     {
         this.dataSetService = dataSetService;
     }
-    
+
     private UserGroupService userGroupService;
 
     public void setUserGroupService( UserGroupService userGroupService )
@@ -153,7 +152,7 @@
     }
 
     private List<DataElementCategoryCombo> categoryCombos = new ArrayList<>();
-    
+
     public List<DataElementCategoryCombo> getCategoryCombos()
     {
         return categoryCombos;
@@ -192,7 +191,7 @@
         userGroups = new ArrayList<>( userGroupService.getAllUserGroups() );
         categoryCombos = new ArrayList<>( categoryService.getAttributeCategoryCombos() );
         legendSets = new ArrayList<>( legendService.getAllLegendSets() );
-        
+
         if ( dataSetId != null )
         {
             dataSet = dataSetService.getDataSet( dataSetId, true, true, false );
@@ -202,7 +201,7 @@
             attributeValues = AttributeUtils.getAttributeValueMap( dataSet.getAttributeValues() );
         }
 
-        attributes = new ArrayList<>( attributeService.getDataSetAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( DataSet.class ) );
 
         Collections.sort( userGroups, IdentifiableObjectNameComparator.INSTANCE );
         Collections.sort( dataElements, IdentifiableObjectNameComparator.INSTANCE );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java	2015-03-27 19:20:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java	2015-11-23 09:06:48 +0000
@@ -28,14 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.system.util.ValidationUtils.coordinateIsValid;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
@@ -52,7 +45,13 @@
 import org.hisp.dhis.system.util.ValidationUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.hisp.dhis.system.util.ValidationUtils.coordinateIsValid;
 
 /**
  * @author Torgeir Lorange Ostby
@@ -72,7 +71,7 @@
 
     @Autowired
     private IdentifiableObjectManager idObjectManager;
-    
+
     @Autowired
     private AttributeService attributeService;
 
@@ -193,7 +192,7 @@
 
         groupSets = new ArrayList<>( organisationUnitGroupService.getCompulsoryOrganisationUnitGroupSetsWithMembers() );
 
-        attributes = new ArrayList<>( attributeService.getOrganisationUnitAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( OrganisationUnit.class ) );
 
         attributeValues = AttributeUtils.getAttributeValueMap( organisationUnit.getAttributeValues() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/ShowAddOrganisationUnitFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/ShowAddOrganisationUnitFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/ShowAddOrganisationUnitFormAction.java	2015-11-23 09:06:48 +0000
@@ -37,6 +37,7 @@
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -114,7 +115,7 @@
         groupSets = new ArrayList<>(
             organisationUnitGroupService.getCompulsoryOrganisationUnitGroupSetsWithMembers() );
 
-        attributes = new ArrayList<>( attributeService.getOrganisationUnitAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( OrganisationUnit.class ) );
 
         Collections.sort( dataSets, IdentifiableObjectNameComparator.INSTANCE );
         Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupAction.java	2015-11-23 09:06:48 +0000
@@ -28,12 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
@@ -42,7 +37,11 @@
 import org.hisp.dhis.oust.manager.SelectionTreeManager;
 import org.hisp.dhis.system.util.AttributeUtils;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Torgeir Lorange Ostby
@@ -130,7 +129,7 @@
 
         selectionTreeManager.setSelectedOrganisationUnits( organisationUnitGroup.getMembers() );
 
-        attributes = new ArrayList<>( attributeService.getOrganisationUnitGroupAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( OrganisationUnitGroup.class ) );
 
         attributeValues = AttributeUtils.getAttributeValueMap( organisationUnitGroup.getAttributeValues() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/ShowAddOrganisationUnitGroupFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/ShowAddOrganisationUnitGroupFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/ShowAddOrganisationUnitGroupFormAction.java	2015-11-23 09:06:48 +0000
@@ -32,6 +32,7 @@
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -69,7 +70,7 @@
     @Override
     public String execute()
     {
-        attributes = new ArrayList<>( attributeService.getOrganisationUnitGroupAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( OrganisationUnitGroup.class ) );
         Collections.sort( attributes, AttributeSortOrderComparator.INSTANCE );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/ShowAddOrganisationUnitGroupSetFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/ShowAddOrganisationUnitGroupSetFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/ShowAddOrganisationUnitGroupSetFormAction.java	2015-11-23 09:06:48 +0000
@@ -32,6 +32,7 @@
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -69,7 +70,7 @@
     @Override
     public String execute()
     {
-        attributes = new ArrayList<>( attributeService.getOrganisationUnitGroupSetAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( OrganisationUnitGroupSet.class ) );
         Collections.sort( attributes, AttributeSortOrderComparator.INSTANCE );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/ShowUpdateGroupSetFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/ShowUpdateGroupSetFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/ShowUpdateGroupSetFormAction.java	2015-11-23 09:06:48 +0000
@@ -28,12 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
@@ -41,10 +36,14 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
-
-import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.system.util.AttributeUtils;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * @author Lars Helge Overland
  */
@@ -122,7 +121,7 @@
 
         Collections.sort( selectedGroups, IdentifiableObjectNameComparator.INSTANCE );
 
-        attributes = new ArrayList<>( attributeService.getOrganisationUnitGroupSetAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( OrganisationUnitGroupSet.class ) );
 
         attributeValues = AttributeUtils.getAttributeValueMap( organisationUnitGroupSet.getAttributeValues() );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowAddProgramFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowAddProgramFormAction.java	2015-09-01 14:28:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowAddProgramFormAction.java	2015-11-23 09:06:48 +0000
@@ -28,12 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
@@ -52,7 +47,11 @@
 import org.hisp.dhis.user.UserGroupService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Abyot Asalefew Gizaw
@@ -100,7 +99,7 @@
 
     @Autowired
     private DataElementCategoryService categoryService;
-    
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -153,9 +152,9 @@
     {
         return attributeValues;
     }
-    
+
     private List<DataElementCategoryCombo> categoryCombos = new ArrayList<>();
-    
+
     public List<DataElementCategoryCombo> getCategoryCombos()
     {
         return categoryCombos;
@@ -185,8 +184,8 @@
         trackedEntities = trackedEntityService.getAllTrackedEntity();
         Collections.sort( trackedEntities, IdentifiableObjectNameComparator.INSTANCE );
 
-        attributes = attributeService.getProgramAttributes();
-        
+        attributes = attributeService.getAttributes( Program.class );
+
         categoryCombos = new ArrayList<>( categoryService.getAttributeCategoryCombos() );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowUpdateProgramFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowUpdateProgramFormAction.java	2015-11-02 04:27:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/program/ShowUpdateProgramFormAction.java	2015-11-23 09:06:48 +0000
@@ -28,12 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
@@ -43,8 +38,8 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
 import org.hisp.dhis.program.ProgramType;
-import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
 import org.hisp.dhis.relationship.RelationshipType;
 import org.hisp.dhis.relationship.RelationshipTypeService;
 import org.hisp.dhis.system.util.AttributeUtils;
@@ -56,7 +51,11 @@
 import org.hisp.dhis.user.UserGroupService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Chau Thu Tran
@@ -102,7 +101,7 @@
 
     @Autowired
     private AttributeService attributeService;
-    
+
     @Autowired
     private DataElementCategoryService categoryService;
 
@@ -257,8 +256,8 @@
         trackedEntities = trackedEntityService.getAllTrackedEntity();
         Collections.sort( trackedEntities, IdentifiableObjectNameComparator.INSTANCE );
 
-        attributes = attributeService.getProgramAttributes();
-        
+        attributes = attributeService.getAttributes( Program.class );
+
         categoryCombos = new ArrayList<>( categoryService.getAttributeCategoryCombos() );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/GetProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/GetProgramStageAction.java	2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/GetProgramStageAction.java	2015-11-23 09:06:48 +0000
@@ -28,12 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.period.PeriodService;
@@ -46,7 +41,11 @@
 import org.hisp.dhis.user.UserGroupService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Abyot Asalefew Gizaw
@@ -169,7 +168,7 @@
         userGroups = userGroupService.getAllUserGroups();
 
         attributeValues = AttributeUtils.getAttributeValueMap( programStage.getAttributeValues() );
-        attributes = attributeService.getProgramStageAttributes();
+        attributes = attributeService.getAttributes( ProgramStage.class );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageAction.java	2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageAction.java	2015-11-23 09:06:48 +0000
@@ -28,10 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
@@ -44,11 +41,14 @@
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.user.UserGroup;
 import org.hisp.dhis.user.UserGroupService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -171,10 +171,10 @@
 
         userGroups = userGroupService.getAllUserGroups();
 
-        constants = constantService.getAllConstants();        
+        constants = constantService.getAllConstants();
         Collections.sort( constants, IdentifiableObjectNameComparator.INSTANCE );
 
-        attributes = attributeService.getProgramStageAttributes();
+        attributes = attributeService.getAttributes( ProgramStage.class );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/ShowAddUpdateTrackedEntityAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/ShowAddUpdateTrackedEntityAction.java	2015-06-16 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentity/ShowAddUpdateTrackedEntityAction.java	2015-11-23 09:06:48 +0000
@@ -28,10 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.system.util.AttributeUtils;
@@ -39,7 +36,9 @@
 import org.hisp.dhis.trackedentity.TrackedEntityService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -103,7 +102,7 @@
             attributeValues = AttributeUtils.getAttributeValueMap( trackedEntity.getAttributeValues() );
         }
 
-        attributes = attributeService.getTrackedEntityAttributes();
+        attributes = attributeService.getAttributes( TrackedEntity.class );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddUpdateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddUpdateAttributeAction.java	2015-07-02 07:05:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/ShowAddUpdateAttributeAction.java	2015-11-23 09:06:48 +0000
@@ -28,11 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.legend.LegendService;
@@ -51,7 +47,10 @@
 import org.hisp.dhis.trackedentity.TrackedEntityService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Chau Thu Tran
@@ -172,7 +171,7 @@
         periodTypes = periodService.getAllPeriodTypes();
         optionSets = optionService.getAllOptionSets();
         legendSets = legendService.getAllLegendSets();
-        attributes = attributeService.getTrackedEntityAttributeAttributes();
+        attributes = attributeService.getAttributes( TrackedEntityAttribute.class );
         trackedEntities = trackedEntityService.getAllTrackedEntity();
 
         Collections.sort( optionSets );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java	2015-11-18 16:46:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/SetupTreeAction.java	2015-11-23 09:06:48 +0000
@@ -28,16 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.user.UserSettingService.KEY_DB_LOCALE;
-import static org.hisp.dhis.user.UserSettingService.KEY_UI_LOCALE;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
@@ -56,7 +47,15 @@
 import org.hisp.dhis.user.UserSettingService;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import static org.hisp.dhis.user.UserSettingService.KEY_DB_LOCALE;
+import static org.hisp.dhis.user.UserSettingService.KEY_UI_LOCALE;
 
 /**
  * @author Nguyen Hong Duc
@@ -113,7 +112,7 @@
 
     @Autowired
     private UserSettingService userSettingService;
-    
+
     @Autowired
     private SystemSettingManager systemSettingManager;
 
@@ -150,12 +149,12 @@
     }
 
     private List<UserGroup> userGroups;
-    
+
     public List<UserGroup> getUserGroups()
     {
         return userGroups;
     }
-    
+
     private List<DimensionalObject> dimensionConstraints;
 
     public List<DimensionalObject> getDimensionConstraints()
@@ -204,7 +203,7 @@
     {
         return attributeValues;
     }
-    
+
     private boolean allowInvite;
 
     public boolean isAllowInvite()
@@ -232,7 +231,7 @@
             {
                 selectionManager.clearSelectedOrganisationUnits();
             }
-            
+
             if ( user.hasDataViewOrganisationUnit() )
             {
                 selectionTreeManager.setSelectedOrganisationUnits( user.getDataViewOrganisationUnits() );
@@ -241,39 +240,39 @@
             {
                 selectionTreeManager.clearSelectedOrganisationUnits();
             }
-            
+
             userCredentials = user.getUserCredentials();
 
-            userAuthorityGroups = new ArrayList<>( userCredentials.getUserAuthorityGroups() );            
+            userAuthorityGroups = new ArrayList<>( userCredentials.getUserAuthorityGroups() );
             userService.canIssueFilter( userAuthorityGroups );
             Collections.sort( userAuthorityGroups );
 
             userGroups = new ArrayList<>( user.getGroups() );
             Collections.sort( userGroups );
-            
+
             dimensionConstraints = new ArrayList<>( userCredentials.getDimensionConstraints() );
             Collections.sort( dimensionConstraints );
-            
+
             attributeValues = AttributeUtils.getAttributeValueMap( user.getAttributeValues() );
-            
+
             currentLocale = (Locale) userSettingService.getUserSetting( KEY_UI_LOCALE, LocaleManager.DEFAULT_LOCALE, user );
-            
+
             currentLocaleDb = (Locale) userSettingService.getUserSetting( KEY_DB_LOCALE, null, user );
         }
         else
-        {            
+        {
             currentLocale = LocaleManager.DEFAULT_LOCALE;
         }
 
         availableLocales = localeManager.getAvailableLocales();
-        
+
         availableLocalesDb = i18nService.getAvailableLocales();
-        
-        attributes = new ArrayList<>( attributeService.getUserAttributes() );
+
+        attributes = new ArrayList<>( attributeService.getAttributes( User.class ) );
         Collections.sort( attributes, AttributeSortOrderComparator.INSTANCE );
-        
+
         allowInvite = systemSettingManager.emailEnabled();
-        
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/AddUserGroupFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/AddUserGroupFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/AddUserGroupFormAction.java	2015-11-23 09:06:48 +0000
@@ -28,16 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
+import org.hisp.dhis.user.UserGroup;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-import org.hisp.dhis.attribute.Attribute;
-import org.hisp.dhis.attribute.AttributeService;
-import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
-
-import com.opensymphony.xwork2.Action;
-
 public class AddUserGroupFormAction
     implements Action
 {
@@ -71,7 +71,7 @@
     public String execute()
         throws Exception
     {
-        attributes = new ArrayList<>( attributeService.getUserGroupAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( UserGroup.class ) );
         Collections.sort( attributes, AttributeSortOrderComparator.INSTANCE );
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/EditUserGroupFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/EditUserGroupFormAction.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/usergroup/EditUserGroupFormAction.java	2015-11-23 09:06:48 +0000
@@ -28,12 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeService;
 import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
@@ -43,7 +38,11 @@
 import org.hisp.dhis.user.UserGroupService;
 import org.hisp.dhis.user.comparator.UserComparator;
 
-import com.opensymphony.xwork2.Action;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author Lars Helge Overland
@@ -91,7 +90,7 @@
     {
         return groupMembers;
     }
-    
+
     private List<UserGroup> managedGroups = new ArrayList<>();
 
     public List<UserGroup> getManagedGroups()
@@ -131,10 +130,10 @@
         group = userGroupService.getUserGroup( userGroupId );
 
         groupMembers = new ArrayList<>( group.getMembers() );
-        
+
         managedGroups = new ArrayList<>( group.getManagedGroups() );
 
-        attributes = new ArrayList<>( attributeService.getUserGroupAttributes() );
+        attributes = new ArrayList<>( attributeService.getAttributes( UserGroup.class ) );
 
         attributeValues = AttributeUtils.getAttributeValueMap( group.getAttributeValues() );