dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #28818
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14455: Impl basic support for EventReport. Incorporated tracked entity attributes/data elements into the...
------------------------------------------------------------
revno: 14455
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-03-26 22:55:22 +0100
message:
Impl basic support for EventReport. Incorporated tracked entity attributes/data elements into the analytics solution. Impl basic persistence for EventReport. Introduced new link classes TrackedEntityAttributeDimension and TrackedEntityDataElementDimension.
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryFilter.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/
dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReportService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeDimension.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityDataElementDimension.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventreport/
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventreport/DefaultEventReportService.java
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttributeDimension.hbm.xml
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityDataElementDimension.hbm.xml
dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/eventreport/
dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/eventreport/EventReportServiceTest.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java
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/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java 2014-03-26 16:59:03 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java 2014-03-26 21:55:22 +0000
@@ -75,6 +75,8 @@
import org.hisp.dhis.period.RelativePeriodEnum;
import org.hisp.dhis.period.RelativePeriods;
import org.hisp.dhis.period.comparator.AscendingPeriodComparator;
+import org.hisp.dhis.trackedentity.TrackedEntityAttributeDimension;
+import org.hisp.dhis.trackedentity.TrackedEntityDataElementDimension;
import org.hisp.dhis.user.User;
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -134,6 +136,12 @@
@Scanned
protected List<CategoryOptionGroup> categoryOptionGroups = new ArrayList<CategoryOptionGroup>();
+ @Scanned
+ protected List<TrackedEntityAttributeDimension> attributeDimensions = new ArrayList<TrackedEntityAttributeDimension>();
+
+ @Scanned
+ protected List<TrackedEntityDataElementDimension> dataElementDimensions = new ArrayList<TrackedEntityDataElementDimension>();
+
protected boolean userOrganisationUnit;
protected boolean userOrganisationUnitChildren;
@@ -374,6 +382,38 @@
type = DimensionType.CATEGORYOPTION_GROUPSET;
}
+
+ // Tracked entity attribute
+
+ Map<String, TrackedEntityAttributeDimension> attributes = new HashMap<String, TrackedEntityAttributeDimension>();
+
+ for ( TrackedEntityAttributeDimension attribute : attributeDimensions )
+ {
+ attributes.put( attribute.getUid(), attribute );
+ }
+
+ if ( attributes.containsKey( dimension ) )
+ {
+ items.add( attributes.get( dimension ).getQueryFilter() );
+
+ type = DimensionType.TRACKED_ENTITY_ATTRIBUTE;
+ }
+
+ // Tracked entity data element
+
+ Map<String, TrackedEntityDataElementDimension> dataElements = new HashMap<String, TrackedEntityDataElementDimension>();
+
+ for ( TrackedEntityDataElementDimension dataElement : dataElementDimensions )
+ {
+ dataElements.put( dataElement.getUid(), dataElement );
+ }
+
+ if ( dataElements.containsKey( dimension ) )
+ {
+ items.add( dataElements.get( dimension ).getQueryFilter() );
+
+ type = DimensionType.TRACKED_ENTITY_DATAELEMENT;
+ }
}
IdentifiableObjectUtils.removeDuplicates( items );
@@ -547,6 +587,34 @@
{
objects.add( new BaseDimensionalObject( dimension, DimensionType.CATEGORYOPTION_GROUPSET, coGroupMap.get( dimension ) ) );
}
+
+ // Tracked entity attribute
+
+ Map<String, TrackedEntityAttributeDimension> attributes = new HashMap<String, TrackedEntityAttributeDimension>();
+
+ for ( TrackedEntityAttributeDimension attribute : attributeDimensions )
+ {
+ attributes.put( attribute.getUid(), attribute );
+ }
+
+ if ( attributes.containsKey( dimension ) )
+ {
+ objects.add( new BaseDimensionalObject( dimension, DimensionType.TRACKED_ENTITY_ATTRIBUTE, attributes.get( dimension ).getQueryFilterAsList() ) );
+ }
+
+ // Tracked entity data element
+
+ Map<String, TrackedEntityDataElementDimension> dataElements = new HashMap<String, TrackedEntityDataElementDimension>();
+
+ for ( TrackedEntityDataElementDimension dataElement : dataElementDimensions )
+ {
+ dataElements.put( dataElement.getUid(), dataElement );
+ }
+
+ if ( dataElements.containsKey( dimension ) )
+ {
+ objects.add( new BaseDimensionalObject( dimension, DimensionType.TRACKED_ENTITY_DATAELEMENT, attributes.get( dimension ).getQueryFilterAsList() ) );
+ }
}
return objects;
@@ -867,6 +935,26 @@
this.categoryOptionGroups = categoryOptionGroups;
}
+ public List<TrackedEntityAttributeDimension> getAttributeDimensions()
+ {
+ return attributeDimensions;
+ }
+
+ public void setAttributeDimensions( List<TrackedEntityAttributeDimension> attributeDimensions )
+ {
+ this.attributeDimensions = attributeDimensions;
+ }
+
+ public List<TrackedEntityDataElementDimension> getDataElementDimensions()
+ {
+ return dataElementDimensions;
+ }
+
+ public void setDataElementDimensions( List<TrackedEntityDataElementDimension> dataElementDimensions )
+ {
+ this.dataElementDimensions = dataElementDimensions;
+ }
+
@JsonProperty
@JsonView( {DetailedView.class, ExportView.class} )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
=== 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 2014-03-26 19:33:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseDimensionalObject.java 2014-03-26 21:55:22 +0000
@@ -62,6 +62,16 @@
*/
private List<NameableObject> items = new ArrayList<NameableObject>();
+ /**
+ * Operator. Applicable for events only.
+ */
+ private String operator;
+
+ /**
+ * Filter. Applicable for events only.
+ */
+ private String filter;
+
//--------------------------------------------------------------------------
// Constructors
//--------------------------------------------------------------------------
@@ -105,6 +115,16 @@
this.items = new ArrayList<NameableObject>( items );
}
+ public BaseDimensionalObject( String dimension, DimensionType dimensionType, String dimensionName, String displayName, String operator, String filter )
+ {
+ this.uid = dimension;
+ this.dimensionType = dimensionType;
+ this.dimensionName = dimensionName;
+ this.displayName = displayName;
+ this.operator = operator;
+ this.filter = filter;
+ }
+
// -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
@@ -181,6 +201,32 @@
this.items = items;
}
+ @JsonProperty
+ @JsonView( {DimensionalView.class} )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public String getOperator()
+ {
+ return operator;
+ }
+
+ public void setOperator( String operator )
+ {
+ this.operator = operator;
+ }
+
+ @JsonProperty
+ @JsonView( {DimensionalView.class} )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public String getFilter()
+ {
+ return filter;
+ }
+
+ public void setFilter( String filter )
+ {
+ this.filter = filter;
+ }
+
//--------------------------------------------------------------------------
// Supportive methods
//--------------------------------------------------------------------------
=== 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 2014-03-26 19:33:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/DimensionalObject.java 2014-03-26 21:55:22 +0000
@@ -91,4 +91,14 @@
boolean isAllItems();
boolean hasItems();
+
+ /**
+ * Gets the operator. Applicable for events only.
+ */
+ String getOperator();
+
+ /**
+ * Gets the filter. Applicable for events only.
+ */
+ String getFilter();
}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryFilter.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryFilter.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/QueryFilter.java 2014-03-26 21:55:22 +0000
@@ -0,0 +1,74 @@
+package org.hisp.dhis.common;
+
+/*
+ * Copyright (c) 2004-2014, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+* @author Lars Helge Overland
+*/
+public class QueryFilter
+ extends BaseNameableObject
+{
+ private String operator;
+
+ private String filter;
+
+ // -------------------------------------------------------------------------
+ // Constructor
+ // -------------------------------------------------------------------------
+
+ public QueryFilter( String operator, String filter )
+ {
+ this.operator = operator;
+ this.filter = filter;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public String getOperator()
+ {
+ return operator;
+ }
+
+ public void setOperator( String operator )
+ {
+ this.operator = operator;
+ }
+
+ public String getFilter()
+ {
+ return filter;
+ }
+
+ public void setFilter( String filter )
+ {
+ this.filter = filter;
+ }
+}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2014-03-26 21:55:22 +0000
@@ -28,15 +28,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import static org.hisp.dhis.dataset.DataSet.NO_EXPIRY;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import org.hisp.dhis.attribute.AttributeValue;
+import org.hisp.dhis.common.BaseDimensionalObject;
import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.common.BaseNameableObject;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.view.DetailedView;
@@ -47,12 +48,12 @@
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.YearlyPeriodType;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import static org.hisp.dhis.dataset.DataSet.NO_EXPIRY;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
/**
* A DataElement is a definition (meta-information about) of the entities that
@@ -71,7 +72,7 @@
*/
@JacksonXmlRootElement( localName = "dataElement", namespace = DxfNamespaces.DXF_2_0 )
public class DataElement
- extends BaseNameableObject
+ extends BaseDimensionalObject
{
public static final String[] I18N_PROPERTIES = { "name", "shortName", "description", "formName" };
=== added directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport'
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java 2014-03-26 21:55:22 +0000
@@ -0,0 +1,122 @@
+package org.hisp.dhis.eventreport;
+
+/*
+ * Copyright (c) 2004-2014, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.hisp.dhis.common.BaseAnalyticalObject;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.user.User;
+
+/**
+* @author Lars Helge Overland
+*/
+public class EventReport
+ extends BaseAnalyticalObject
+{
+ /**
+ * Dimensions to crosstabulate / use as columns.
+ */
+ private List<String> columnDimensions = new ArrayList<String>();
+
+ /**
+ * Dimensions to use as rows.
+ */
+ private List<String> rowDimensions = new ArrayList<String>();
+
+ /**
+ * Dimensions to use as filter.
+ */
+ private List<String> filterDimensions = new ArrayList<String>();
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ public EventReport()
+ {
+ }
+
+ public EventReport( String name )
+ {
+ this.name = name;
+ }
+
+ // -------------------------------------------------------------------------
+ // AnalyticalObject
+ // -------------------------------------------------------------------------
+
+ @Override
+ public void init( User user, Date date, OrganisationUnit organisationUnit, List<OrganisationUnit> organisationUnitsAtLevel,
+ List<OrganisationUnit> organisationUnitsInGroups, I18nFormat format )
+ {
+ }
+
+ @Override
+ public void populateAnalyticalProperties()
+ {
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public List<String> getColumnDimensions()
+ {
+ return columnDimensions;
+ }
+
+ public void setColumnDimensions( List<String> columnDimensions )
+ {
+ this.columnDimensions = columnDimensions;
+ }
+
+ public List<String> getRowDimensions()
+ {
+ return rowDimensions;
+ }
+
+ public void setRowDimensions( List<String> rowDimensions )
+ {
+ this.rowDimensions = rowDimensions;
+ }
+
+ public List<String> getFilterDimensions()
+ {
+ return filterDimensions;
+ }
+
+ public void setFilterDimensions( List<String> filterDimensions )
+ {
+ this.filterDimensions = filterDimensions;
+ }
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReportService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReportService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReportService.java 2014-03-26 21:55:22 +0000
@@ -0,0 +1,47 @@
+package org.hisp.dhis.eventreport;
+
+/*
+ * Copyright (c) 2004-2014, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.List;
+
+/**
+* @author Lars Helge Overland
+*/
+public interface EventReportService
+{
+ int saveEventReport( EventReport report );
+
+ void updateEventReport( EventReport report );
+
+ EventReport getEventReport( int id );
+
+ EventReport getEventReport( String uid );
+
+ List<EventReport> getAllEventReprots();
+}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2014-03-26 17:39:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java 2014-03-26 21:55:22 +0000
@@ -31,8 +31,8 @@
import java.util.Calendar;
import java.util.Date;
+import org.hisp.dhis.common.BaseDimensionalObject;
import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.common.BaseNameableObject;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.view.DetailedView;
@@ -52,7 +52,7 @@
*/
@JacksonXmlRootElement( localName = "trackedEntityAttribute", namespace = DxfNamespaces.DXF_2_0 )
public class TrackedEntityAttribute
- extends BaseNameableObject
+ extends BaseDimensionalObject
{
/**
* Determines if a de-serialized file is compatible with this class.
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeDimension.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeDimension.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttributeDimension.java 2014-03-26 21:55:22 +0000
@@ -0,0 +1,122 @@
+package org.hisp.dhis.trackedentity;
+
+/*
+ * Copyright (c) 2004-2014, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.common.QueryFilter;
+
+/**
+* @author Lars Helge Overland
+*/
+public class TrackedEntityAttributeDimension
+{
+ private int id;
+
+ private TrackedEntityAttribute attribute;
+
+ private String operator;
+
+ private String filter;
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ public TrackedEntityAttributeDimension()
+ {
+ }
+
+ // -------------------------------------------------------------------------
+ // Logic
+ // -------------------------------------------------------------------------
+
+ public String getUid()
+ {
+ return attribute != null ? attribute.getUid() : null;
+ }
+
+ public QueryFilter getQueryFilter()
+ {
+ return new QueryFilter( operator, filter );
+ }
+
+ public List<QueryFilter> getQueryFilterAsList()
+ {
+ List<QueryFilter> list = new ArrayList<QueryFilter>();
+ list.add( getQueryFilter() );
+ return list;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ public TrackedEntityAttribute getAttribute()
+ {
+ return attribute;
+ }
+
+ public void setAttribute( TrackedEntityAttribute attribute )
+ {
+ this.attribute = attribute;
+ }
+
+ public String getOperator()
+ {
+ return operator;
+ }
+
+ public void setOperator( String operator )
+ {
+ this.operator = operator;
+ }
+
+ public String getFilter()
+ {
+ return filter;
+ }
+
+ public void setFilter( String filter )
+ {
+ this.filter = filter;
+ }
+
+}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityDataElementDimension.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityDataElementDimension.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityDataElementDimension.java 2014-03-26 21:55:22 +0000
@@ -0,0 +1,123 @@
+package org.hisp.dhis.trackedentity;
+
+/*
+ * Copyright (c) 2004-2014, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.common.QueryFilter;
+import org.hisp.dhis.dataelement.DataElement;
+
+/**
+* @author Lars Helge Overland
+*/
+public class TrackedEntityDataElementDimension
+{
+ private int id;
+
+ private DataElement dataElement;
+
+ private String operator;
+
+ private String filter;
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ public TrackedEntityDataElementDimension()
+ {
+ }
+
+ // -------------------------------------------------------------------------
+ // Logic
+ // -------------------------------------------------------------------------
+
+ public String getUid()
+ {
+ return dataElement != null ? dataElement.getUid() : null;
+ }
+
+ public QueryFilter getQueryFilter()
+ {
+ return new QueryFilter( operator, filter );
+ }
+
+ public List<QueryFilter> getQueryFilterAsList()
+ {
+ List<QueryFilter> list = new ArrayList<QueryFilter>();
+ list.add( getQueryFilter() );
+ return list;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ public DataElement getDataElement()
+ {
+ return dataElement;
+ }
+
+ public void setDataElement( DataElement dataElement )
+ {
+ this.dataElement = dataElement;
+ }
+
+ public String getOperator()
+ {
+ return operator;
+ }
+
+ public void setOperator( String operator )
+ {
+ this.operator = operator;
+ }
+
+ public String getFilter()
+ {
+ return filter;
+ }
+
+ public void setFilter( String filter )
+ {
+ this.filter = filter;
+ }
+
+}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java 2014-03-26 18:14:37 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/dimension/DefaultDimensionService.java 2014-03-26 21:55:22 +0000
@@ -58,6 +58,9 @@
import org.hisp.dhis.period.RelativePeriods;
import org.hisp.dhis.sharing.SharingService;
import org.hisp.dhis.system.util.UniqueArrayList;
+import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
+import org.hisp.dhis.trackedentity.TrackedEntityAttributeDimension;
+import org.hisp.dhis.trackedentity.TrackedEntityDataElementDimension;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.springframework.beans.factory.annotation.Autowired;
@@ -136,7 +139,21 @@
{
return cogs;
}
-
+
+ TrackedEntityAttribute tea = identifiableObjectManager.get( TrackedEntityAttribute.class, uid );
+
+ if ( tea != null )
+ {
+ return tea;
+ }
+
+ DataElement de = identifiableObjectManager.get( DataElement.class, uid );
+
+ if ( de != null )
+ {
+ return de;
+ }
+
return null;
}
@@ -194,6 +211,20 @@
return DimensionType.CATEGORYOPTION_GROUPSET;
}
+ TrackedEntityAttribute tea = identifiableObjectManager.get( TrackedEntityAttribute.class, uid );
+
+ if ( tea != null )
+ {
+ return DimensionType.TRACKED_ENTITY_ATTRIBUTE;
+ }
+
+ DataElement de = identifiableObjectManager.get( DataElement.class, uid );
+
+ if ( de != null )
+ {
+ return DimensionType.TRACKED_ENTITY_DATAELEMENT;
+ }
+
final Map<String, DimensionType> dimObjectTypeMap = new HashMap<String, DimensionType>();
dimObjectTypeMap.put( DimensionalObject.DATA_X_DIM_ID, DimensionType.DATA_X );
@@ -390,6 +421,24 @@
{
object.getCategoryOptionGroups().addAll( identifiableObjectManager.getByUid( CategoryOptionGroup.class, uids ) );
}
+ else if ( TRACKED_ENTITY_ATTRIBUTE.equals( type ) )
+ {
+ TrackedEntityAttributeDimension attributeDimension = new TrackedEntityAttributeDimension();
+ attributeDimension.setAttribute( identifiableObjectManager.get( TrackedEntityAttribute.class, dimensionId ) );
+ attributeDimension.setOperator( dimension.getOperator() );
+ attributeDimension.setFilter( dimension.getFilter() );
+
+ object.getAttributeDimensions().add( attributeDimension );
+ }
+ else if ( TRACKED_ENTITY_DATAELEMENT.equals( type ) )
+ {
+ TrackedEntityDataElementDimension dataElementDimension = new TrackedEntityDataElementDimension();
+ dataElementDimension.setDataElement( identifiableObjectManager.get( DataElement.class, dimensionId ) );
+ dataElementDimension.setOperator( dimension.getOperator() );
+ dataElementDimension.setFilter( dimension.getFilter() );
+
+ object.getDataElementDimensions().add( dataElementDimension );
+ }
}
}
}
=== added directory 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventreport'
=== added file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventreport/DefaultEventReportService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventreport/DefaultEventReportService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/eventreport/DefaultEventReportService.java 2014-03-26 21:55:22 +0000
@@ -0,0 +1,78 @@
+package org.hisp.dhis.eventreport;
+
+/*
+ * Copyright (c) 2004-2014, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.List;
+
+import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+* @author Lars Helge Overland
+*/
+@Transactional
+public class DefaultEventReportService
+ implements EventReportService
+{
+ private HibernateIdentifiableObjectStore<EventReport> eventReportStore;
+
+ public void setEventReportStore( HibernateIdentifiableObjectStore<EventReport> eventReportStore )
+ {
+ this.eventReportStore = eventReportStore;
+ }
+
+ // -------------------------------------------------------------------------
+ // EventReportService implementation
+ // -------------------------------------------------------------------------
+
+ public int saveEventReport( EventReport report )
+ {
+ return eventReportStore.save( report );
+ }
+
+ public void updateEventReport( EventReport report )
+ {
+ eventReportStore.update( report );
+ }
+
+ public EventReport getEventReport( int id )
+ {
+ return eventReportStore.get( id );
+ }
+
+ public EventReport getEventReport( String uid )
+ {
+ return eventReportStore.getByUid( uid );
+ }
+
+ public List<EventReport> getAllEventReprots()
+ {
+ return eventReportStore.getAll();
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml 2014-03-26 14:01:14 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml 2014-03-26 21:55:22 +0000
@@ -132,6 +132,12 @@
<property name="sessionFactory" ref="sessionFactory" />
</bean>
+ <bean id="org.hisp.dhis.eventreport.EventReportStore"
+ class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
+ <property name="clazz" value="org.hisp.dhis.eventreport.EventReport" />
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
+
<!-- Service definitions -->
<bean id="org.hisp.dhis.program.ProgramDataEntryService" class="org.hisp.dhis.program.DefaultProgramDataEntryService">
@@ -382,6 +388,13 @@
value="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
+
+ <!-- EventReport -->
+
+ <bean id="org.hisp.dhis.eventreport.EventReportService"
+ class="org.hisp.dhis.eventreport.DefaultEventReportService">
+ <property name="eventReportStore" ref="org.hisp.dhis.eventreport.EventReportStore" />
+ </bean>
<!-- Startup -->
=== added directory 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport'
=== added file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml 2014-03-26 21:55:22 +0000
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+ >
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.eventreport.EventReport" table="eventreport">
+
+ <cache usage="read-write" />
+
+ <id name="id" column="eventreportid">
+ <generator class="native" />
+ </id>
+ &identifiableProperties;
+
+ <property name="name" column="name" not-null="true" unique="false" length="230" />
+
+ <list name="organisationUnits" table="eventreport_organisationunits">
+ <cache usage="read-write" />
+ <key column="eventreportid" foreign-key="fk_eventreport_organisationunits_eventreportid" />
+ <list-index column="sort_order" base="0" />
+ <many-to-many column="organisationunitid" class="org.hisp.dhis.organisationunit.OrganisationUnit"
+ foreign-key="fk_eventreport_organisationunits_organisationunitid" />
+ </list>
+
+ <list name="periods" table="eventreport_periods">
+ <cache usage="read-write" />
+ <key column="eventreportid" foreign-key="fk_eventreport_periods_eventreportid" />
+ <list-index column="sort_order" base="0" />
+ <many-to-many column="periodid" class="org.hisp.dhis.period.Period"
+ foreign-key="fk_eventreport_periods_periodid" />
+ </list>
+
+ <many-to-one name="relatives" unique="true" class="org.hisp.dhis.period.RelativePeriods" column="relativeperiodsid"
+ cascade="all-delete-orphan" foreign-key="fk_report_relativeperiodsid" />
+
+ <list name="organisationUnitLevels" table="eventreport_orgunitlevels">
+ <cache usage="read-write" />
+ <key column="eventreportid" foreign-key="fk_eventreport_orgunitlevels_eventreportid" />
+ <list-index column="sort_order" base="0" />
+ <element column="orgunitlevel" type="integer" />
+ </list>
+
+ <list name="itemOrganisationUnitGroups" table="eventreport_itemorgunitgroups">
+ <cache usage="read-write" />
+ <key column="eventreportid" foreign-key="fk_eventreport_itemorgunitunitgroups_eventreportid" />
+ <list-index column="sort_order" base="0" />
+ <many-to-many column="orgunitgroupid" class="org.hisp.dhis.organisationunit.OrganisationUnitGroup"
+ foreign-key="fk_eventreport_itemorgunitgroups_orgunitgroupid" />
+ </list>
+
+ <list name="attributeDimensions" table="eventreport_attributedimensions" cascade="all, delete-orphan">
+ <key column="eventreportid" foreign-key="fk_eventreport_attributedimensions_eventreportid" />
+ <list-index column="sort_order" base="0" />
+ <many-to-many column="trackedentityattributedimensionid" class="org.hisp.dhis.trackedentity.TrackedEntityAttributeDimension"
+ foreign-key="fk_eventreport_attributedimensions_attributedimensionid" />
+ </list>
+
+ <list name="dataElementDimensions" table="eventreport_dataelementdimensions" cascade="all, delete-orphan">
+ <key column="eventreportid" foreign-key="fk_eventreport_dataelementdimensions_eventreportid" />
+ <list-index column="sort_order" base="0" />
+ <many-to-many column="trackedentitydataelementdimensionid" class="org.hisp.dhis.trackedentity.TrackedEntityDataElementDimension"
+ foreign-key="fk_eventreport_dataelementdimensions_dataelementdimensionid" />
+ </list>
+
+ <property name="userOrganisationUnit" />
+
+ <property name="userOrganisationUnitChildren" />
+
+ <property name="userOrganisationUnitGrandChildren" />
+
+ <list name="columnDimensions" table="eventreport_columns">
+ <cache usage="read-write" />
+ <key column="eventreportid" foreign-key="fk_eventreport_columns_eventreportid" />
+ <list-index column="sort_order" base="0" />
+ <element type="string" column="dimension" />
+ </list>
+
+ <list name="rowDimensions" table="eventreport_rows">
+ <cache usage="read-write" />
+ <key column="eventreportid" foreign-key="fk_eventreport_rows_eventreportid" />
+ <list-index column="sort_order" base="0" />
+ <element type="string" column="dimension" />
+ </list>
+
+ <list name="filterDimensions" table="eventreport_filters">
+ <cache usage="read-write" />
+ <key column="eventreportid" foreign-key="fk_eventreport_filters_eventreportid" />
+ <list-index column="sort_order" base="0" />
+ <element type="string" column="dimension" />
+ </list>
+
+ <!-- Access properties -->
+ <property name="externalAccess" />
+
+ <many-to-one name="user" class="org.hisp.dhis.user.User" column="userid" foreign-key="fk_eventreport_userid" />
+
+ <property name="publicAccess" length="8" />
+
+ <set name="userGroupAccesses" table="eventreportusergroupaccesses">
+ <cache usage="read-write" />
+ <key column="eventreportid" />
+ <many-to-many class="org.hisp.dhis.user.UserGroupAccess" column="usergroupaccessid" unique="true" />
+ </set>
+
+ </class>
+</hibernate-mapping>
=== added file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttributeDimension.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttributeDimension.hbm.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttributeDimension.hbm.xml 2014-03-26 21:55:22 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.trackedentity.TrackedEntityAttributeDimension" table="trackedentityattributedimension">
+
+ <id name="id" column="trackedentityattributedimensionid">
+ <generator class="native" />
+ </id>
+
+ <many-to-one name="attribute" class="org.hisp.dhis.trackedentity.TrackedEntityAttribute"
+ column="trackedentityattributeid" foreign-key="fk_attributedimension_attributeid" />
+
+ <property name="operator" />
+
+ <property name="filter" />
+
+ </class>
+</hibernate-mapping>
=== added file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityDataElementDimension.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityDataElementDimension.hbm.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityDataElementDimension.hbm.xml 2014-03-26 21:55:22 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.trackedentity.TrackedEntityDataElementDimension" table="trackedentitydataelementdimension">
+
+ <id name="id" column="trackedentitydataelementdimensionid">
+ <generator class="native" />
+ </id>
+
+ <many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement"
+ column="dataelementid" foreign-key="fk_dataelementdimension_dataelementid" />
+
+ <property name="operator" />
+
+ <property name="filter" />
+
+ </class>
+</hibernate-mapping>
=== added directory 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/eventreport'
=== added file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/eventreport/EventReportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/eventreport/EventReportServiceTest.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/eventreport/EventReportServiceTest.java 2014-03-26 21:55:22 +0000
@@ -0,0 +1,61 @@
+package org.hisp.dhis.eventreport;
+
+/*
+ * Copyright (c) 2004-2014, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.DhisSpringTest;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import static org.junit.Assert.*;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class EventReportServiceTest
+ extends DhisSpringTest
+{
+ @Autowired
+ private EventReportService eventReportService;
+
+ @Test
+ public void testSaveGet()
+ {
+ EventReport erA = new EventReport( "erA" );
+ EventReport erB = new EventReport( "erB" );
+ EventReport erC = new EventReport( "erC" );
+
+ int idA = eventReportService.saveEventReport( erA );
+ int idB = eventReportService.saveEventReport( erB );
+ int idC = eventReportService.saveEventReport( erC );
+
+ assertEquals( "erA", eventReportService.getEventReport( idA ).getName() );
+ assertEquals( "erB", eventReportService.getEventReport( idB ).getName() );
+ assertEquals( "erC", eventReportService.getEventReport( idC ).getName() );
+ }
+}