dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38992
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19793: Analytics. Added support for disaggregation type of category option group set based dimensions.
------------------------------------------------------------
revno: 19793
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-08-19 07:58:26 -0400
message:
Analytics. Added support for disaggregation type of category option group set based dimensions.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSetStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryOptionGroupSetStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryOptionGroupStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOptionCombo.js
--
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/dataelement/CategoryOptionGroupSetStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSetStore.java 2015-03-08 14:57:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupSetStore.java 2015-08-19 11:58:26 +0000
@@ -28,9 +28,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.List;
+
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.GenericDimensionalObjectStore;
+/**
+ * @author Lars Helge Overland
+ */
public interface CategoryOptionGroupSetStore
extends GenericDimensionalObjectStore<CategoryOptionGroupSet>
{
+ List<CategoryOptionGroupSet> getCategoryOptionGroupSetsNoAcl( DataDimensionType dataDimensionType, boolean dataDimension );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupStore.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/CategoryOptionGroupStore.java 2015-08-19 11:58:26 +0000
@@ -30,10 +30,13 @@
import java.util.List;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.GenericNameableObjectStore;
public interface CategoryOptionGroupStore
extends GenericNameableObjectStore<CategoryOptionGroup>
{
List<CategoryOptionGroup> getCategoryOptionGroups( CategoryOptionGroupSet groupSet );
+
+ List<CategoryOptionGroup> getCategoryOptionGroupsNoAcl( DataDimensionType dataDimensionType, boolean dataDimension );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2015-06-24 10:36:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java 2015-08-19 11:58:26 +0000
@@ -678,7 +678,11 @@
List<CategoryOptionGroupSet> getCategoryOptionGroupSetsBetweenByName( int first, int max, String name );
List<CategoryOptionGroupSet> getAllCategoryOptionGroupSets();
-
+
+ List<CategoryOptionGroupSet> getDisaggregationCategoryOptionGroupSetsNoAcl();
+
+ List<CategoryOptionGroupSet> getAttributeCategoryOptionGroupSetsNoAcl();
+
CategoryOptionGroupSet getCategoryOptionGroupSetByName( String name );
int getCategoryOptionGroupSetCount();
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java 2015-08-05 15:53:57 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java 2015-08-19 11:58:26 +0000
@@ -227,7 +227,8 @@
"from datavalue dv " +
"left join _dataelementgroupsetstructure degs on dv.dataelementid=degs.dataelementid " +
"left join _organisationunitgroupsetstructure ougs on dv.sourceid=ougs.organisationunitid " +
- "left join _categoryoptiongroupsetstructure cogs on dv.attributeoptioncomboid=cogs.categoryoptioncomboid " +
+ "left join _categoryoptiongroupsetstructure cogs on dv.categoryoptioncomboid=cogs.categoryoptioncomboid " +
+ "left join _categoryoptiongroupsetstructure aogs on dv.attributeoptioncomboid=aogs.categoryoptioncomboid " +
"left join _categorystructure dcs on dv.categoryoptioncomboid=dcs.categoryoptioncomboid " +
"left join _categorystructure acs on dv.attributeoptioncomboid=acs.categoryoptioncomboid " +
"left join _orgunitstructure ous on dv.sourceid=ous.organisationunitid " +
@@ -286,22 +287,25 @@
{
List<String[]> columns = new ArrayList<>();
- Collection<DataElementGroupSet> dataElementGroupSets =
+ List<DataElementGroupSet> dataElementGroupSets =
idObjectManager.getDataDimensionsNoAcl( DataElementGroupSet.class );
- Collection<OrganisationUnitGroupSet> orgUnitGroupSets =
+ List<OrganisationUnitGroupSet> orgUnitGroupSets =
idObjectManager.getDataDimensionsNoAcl( OrganisationUnitGroupSet.class );
- Collection<CategoryOptionGroupSet> categoryOptionGroupSets =
- idObjectManager.getDataDimensionsNoAcl( CategoryOptionGroupSet.class );
-
- Collection<DataElementCategory> disaggregationCategories =
+ List<CategoryOptionGroupSet> disaggregationCategoryOptionGroupSets =
+ categoryService.getDisaggregationCategoryOptionGroupSetsNoAcl();
+
+ List<CategoryOptionGroupSet> attributeCategoryOptionGroupSets =
+ categoryService.getAttributeCategoryOptionGroupSetsNoAcl();
+
+ List<DataElementCategory> disaggregationCategories =
categoryService.getDisaggregationDataDimensionCategoriesNoAcl();
- Collection<DataElementCategory> attributeCategories =
+ List<DataElementCategory> attributeCategories =
categoryService.getAttributeDataDimensionCategoriesNoAcl();
- Collection<OrganisationUnitLevel> levels =
+ List<OrganisationUnitLevel> levels =
organisationUnitService.getOrganisationUnitLevels();
for ( DataElementGroupSet groupSet : dataElementGroupSets )
@@ -316,11 +320,17 @@
columns.add( col );
}
- for ( CategoryOptionGroupSet groupSet : categoryOptionGroupSets )
+ for ( CategoryOptionGroupSet groupSet : disaggregationCategoryOptionGroupSets )
{
String[] col = { quote( groupSet.getUid() ), "character(11)", "cogs." + quote( groupSet.getUid() ) };
columns.add( col );
}
+
+ for ( CategoryOptionGroupSet groupSet : attributeCategoryOptionGroupSets )
+ {
+ String[] col = { quote( groupSet.getUid() ), "character(11)", "aogs." + quote( groupSet.getUid() ) };
+ columns.add( col );
+ }
for ( DataElementCategory category : disaggregationCategories )
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2015-08-18 22:46:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2015-08-19 11:58:26 +0000
@@ -42,13 +42,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.common.DataDimensionType;
-import org.hisp.dhis.common.GenericDimensionalObjectStore;
import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.common.IdentifiableObjectUtils;
import org.hisp.dhis.common.IdentifiableProperty;
-import org.hisp.dhis.i18n.I18nService;
import org.hisp.dhis.commons.filter.Filter;
import org.hisp.dhis.commons.filter.FilterUtils;
+import org.hisp.dhis.i18n.I18nService;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.collect.Sets;
@@ -101,9 +100,9 @@
this.categoryOptionGroupStore = categoryOptionGroupStore;
}
- private GenericDimensionalObjectStore<CategoryOptionGroupSet> categoryOptionGroupSetStore;
+ private CategoryOptionGroupSetStore categoryOptionGroupSetStore;
- public void setCategoryOptionGroupSetStore( GenericDimensionalObjectStore<CategoryOptionGroupSet> categoryOptionGroupSetStore )
+ public void setCategoryOptionGroupSetStore( CategoryOptionGroupSetStore categoryOptionGroupSetStore )
{
this.categoryOptionGroupSetStore = categoryOptionGroupSetStore;
}
@@ -1067,6 +1066,18 @@
{
return categoryOptionGroupSetStore.getAll();
}
+
+ @Override
+ public List<CategoryOptionGroupSet> getDisaggregationCategoryOptionGroupSetsNoAcl()
+ {
+ return categoryOptionGroupSetStore.getCategoryOptionGroupSetsNoAcl( DataDimensionType.DISAGGREGATION, true );
+ }
+
+ @Override
+ public List<CategoryOptionGroupSet> getAttributeCategoryOptionGroupSetsNoAcl()
+ {
+ return categoryOptionGroupSetStore.getCategoryOptionGroupSetsNoAcl( DataDimensionType.ATTRIBUTE, true );
+ }
@Override
public CategoryOptionGroupSet getCategoryOptionGroupSetByName( String name )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryOptionGroupSetStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryOptionGroupSetStore.java 2015-03-08 14:57:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryOptionGroupSetStore.java 2015-08-19 11:58:26 +0000
@@ -28,12 +28,27 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.List;
+
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
import org.hisp.dhis.dataelement.CategoryOptionGroupSetStore;
+/**
+ * @author Lars Helge Overland
+ */
public class HibernateCategoryOptionGroupSetStore
extends HibernateIdentifiableObjectStore<CategoryOptionGroupSet>
implements CategoryOptionGroupSetStore
{
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<CategoryOptionGroupSet> getCategoryOptionGroupSetsNoAcl( DataDimensionType dataDimensionType, boolean dataDimension )
+ {
+ return getCriteria(
+ Restrictions.eq( "dataDimensionType", dataDimensionType ),
+ Restrictions.eq( "dataDimension", dataDimension ) ).list();
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryOptionGroupStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryOptionGroupStore.java 2015-07-15 09:45:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateCategoryOptionGroupStore.java 2015-08-19 11:58:26 +0000
@@ -31,6 +31,7 @@
import java.util.List;
import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.common.DataDimensionType;
import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
@@ -49,4 +50,13 @@
{
return getSharingCriteria( Restrictions.eq( "groupSet", groupSet ) ).list();
}
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public List<CategoryOptionGroup> getCategoryOptionGroupsNoAcl( DataDimensionType dataDimensionType, boolean dataDimension )
+ {
+ return getCriteria(
+ Restrictions.eq( "dataDimensionType", dataDimensionType ),
+ Restrictions.eq( "dataDimension", dataDimension ) ).list();
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-08-19 05:26:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-08-19 11:58:26 +0000
@@ -836,6 +836,8 @@
executeSql( "update dataelementcategory set datadimensiontype = 'ATTRIBUTE' where dimensiontype = 'attribute'" );
executeSql( "update dataelementcategory set datadimensiontype = 'DISAGGREGATION' where datadimensiontype is null" );
executeSql( "alter table dataelementcategory drop column dimensiontype" );
+ executeSql( "update categoryoptiongroupset set datadimensiontype = 'DISAGGREGATION' where datadimensiontype is null" );
+ executeSql( "update categoryoptiongroup set datadimensiontype = 'DISAGGREGATION' where datadimensiontype is null" );
oauth2();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOptionCombo.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOptionCombo.js 2015-08-18 22:46:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryOptionCombo.js 2015-08-19 11:58:26 +0000
@@ -30,10 +30,10 @@
dhis2.coc = {
clearAndSetAjaxSelect: function( type, clearSelected ) {
- var source = "../api/categories.json";
+ var source = '../api/categories.json';
if( type !== undefined ) {
- source += "?filter=dataDimensionType:eq:" + type;
+ source += '?filter=dataDimensionType:eq:' + type;
}
if( clearSelected ) {