dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22463
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10791: Made sure that dimensional service returns data dimensions only
------------------------------------------------------------
revno: 10791
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-05-10 10:28:01 +0200
message:
Made sure that dimensional service returns data dimensions only
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.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/common/BaseDimensionalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java 2013-05-08 22:56:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java 2013-05-10 08:28:01 +0000
@@ -44,7 +44,16 @@
public class BaseDimensionalObject
extends BaseIdentifiableObject implements DimensionalObject
{
+ /**
+ * The dimensional items for this dimension.
+ */
private List<IdentifiableObject> items = new ArrayList<IdentifiableObject>();
+
+ /**
+ * Indicates whether this object should be considered a data dimension. Assumes
+ * true by default.
+ */
+ private boolean dataDimension = true;
public BaseDimensionalObject()
{
@@ -85,4 +94,14 @@
{
this.items = items;
}
+
+ public boolean isDataDimension()
+ {
+ return dataDimension;
+ }
+
+ public void setDataDimension( boolean dataDimension )
+ {
+ this.dataDimension = dataDimension;
+ }
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java 2013-05-08 22:56:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java 2013-05-10 08:28:01 +0000
@@ -49,4 +49,6 @@
String getDimension();
List<IdentifiableObject> getItems();
+
+ boolean isDataDimension();
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2013-05-08 22:56:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java 2013-05-10 08:28:01 +0000
@@ -67,8 +67,6 @@
public static final String DEFAULT_NAME = "default";
- private boolean dataDimension;
-
private Concept concept;
@Scanned
@@ -213,19 +211,6 @@
// ------------------------------------------------------------------------
@JsonProperty
- @JsonView( { DetailedView.class, ExportView.class } )
- @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
- public boolean isDataDimension()
- {
- return dataDimension;
- }
-
- public void setDataDimension( boolean dataDimension )
- {
- this.dataDimension = dataDimension;
- }
-
- @JsonProperty
@JsonSerialize( contentAs = BaseIdentifiableObject.class )
@JsonView( {DetailedView.class, ExportView.class} )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java 2013-05-08 22:56:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultDimensionService.java 2013-05-10 08:28:01 +0000
@@ -34,6 +34,7 @@
import java.util.Map;
import org.hisp.dhis.dataelement.DataElementCategory;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,6 +48,9 @@
@Autowired
private IdentifiableObjectManager identifiableObjectManager;
+ @Autowired
+ private DataElementCategoryService categoryService;
+
@Override
public DimensionalObject getDimension( String uid )
{
@@ -115,7 +119,7 @@
{
Collection<DataElementGroupSet> degs = identifiableObjectManager.getAll( DataElementGroupSet.class );
Collection<OrganisationUnitGroupSet> ougs = identifiableObjectManager.getAll( OrganisationUnitGroupSet.class );
- Collection<DataElementCategory> dcs = identifiableObjectManager.getAll( DataElementCategory.class );
+ Collection<DataElementCategory> dcs = categoryService.getDataDimensionDataElementCategories();
final List<DimensionalObject> dimensions = new ArrayList<DimensionalObject>();