dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #43976
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22308: Revert 22305..22304
------------------------------------------------------------
revno: 22308
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-15 15:29:20 +0700
message:
Revert 22305..22304
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/DocumentStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableStore.java
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceFavoritesTest.java
dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/metadata_with_charts1.json
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/HibernateChartStore.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/hibernate/
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/hibernate/HibernateDocumentStore.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/hibernate/
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/hibernate/HibernateReportStore.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/hibernate/
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/hibernate/HibernateReportTableStore.java
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/QueryService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/report/ReportStoreTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.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
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartStore.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartStore.java 1970-01-01 00:00:00 +0000
@@ -1,40 +0,0 @@
-package org.hisp.dhis.chart;
-
-/*
- * Copyright (c) 2004-2016, 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.common.AnalyticalObjectStore;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public interface ChartStore
- extends AnalyticalObjectStore<Chart>
-{
- String ID = ChartStore.class.getName();
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/DocumentStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/DocumentStore.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/DocumentStore.java 1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
-package org.hisp.dhis.document;
-
-/*
- * Copyright (c) 2004-2016, 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.common.GenericIdentifiableObjectStore;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public interface DocumentStore
- extends GenericIdentifiableObjectStore<Document>
-{
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportStore.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportStore.java 1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
-package org.hisp.dhis.report;
-
-/*
- * Copyright (c) 2004-2016, 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.common.GenericIdentifiableObjectStore;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public interface ReportStore
- extends GenericIdentifiableObjectStore<Report>
-{
-}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableStore.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableStore.java 1970-01-01 00:00:00 +0000
@@ -1,40 +0,0 @@
-package org.hisp.dhis.reporttable;
-
-/*
- * Copyright (c) 2004-2016, 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.common.AnalyticalObjectStore;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public interface ReportTableStore
- extends AnalyticalObjectStore<ReportTable>
-{
- String ID = ReportTableStore.class.getName();
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/QueryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/QueryService.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/QueryService.java 2016-03-15 08:29:20 +0000
@@ -54,7 +54,7 @@
* @param transformer ResultTransformer to use for mutating the result
* @return Matching objects
*/
- List<? extends IdentifiableObject> query( Query query, ResultTransformer<?> transformer );
+ List<? extends IdentifiableObject> query( Query query, ResultTransformer transformer );
/**
* Returns how many objects matches the given query.
=== removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceFavoritesTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceFavoritesTest.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceFavoritesTest.java 1970-01-01 00:00:00 +0000
@@ -1,106 +0,0 @@
-package org.hisp.dhis.dxf2.metadata2.objectbundle;
-
-/*
- * Copyright (c) 2004-2016, 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.hisp.dhis.chart.Chart;
-import org.hisp.dhis.common.IdentifiableObject;
-import org.hisp.dhis.common.IdentifiableObjectManager;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.importexport.ImportStrategy;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.render.RenderFormat;
-import org.hisp.dhis.render.RenderService;
-import org.hisp.dhis.user.UserService;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.ClassPathResource;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class ObjectBundleServiceFavoritesTest
- extends DhisSpringTest
-{
- @Autowired
- private ObjectBundleService objectBundleService;
-
- @Autowired
- private IdentifiableObjectManager manager;
-
- @Autowired
- private RenderService _renderService;
-
- @Autowired
- private UserService _userService;
-
- @Override
- protected void setUpTest() throws Exception
- {
- renderService = _renderService;
- userService = _userService;
- }
-
- @Test
- @Ignore
- public void testCreateMetadataWithCharts1() throws IOException
- {
- Map<Class<? extends IdentifiableObject>, List<IdentifiableObject>> metadata = renderService.fromMetadata(
- new ClassPathResource( "dxf2/metadata_with_charts1.json" ).getInputStream(), RenderFormat.JSON );
-
- ObjectBundleParams params = new ObjectBundleParams();
- params.setObjectBundleMode( ObjectBundleMode.COMMIT );
- params.setImportMode( ImportStrategy.CREATE_AND_UPDATE );
- params.setObjects( metadata );
-
- ObjectBundle bundle = objectBundleService.create( params );
- ObjectBundleValidation validate = objectBundleService.validate( bundle );
- assertTrue( validate.getObjectErrorReports().isEmpty() );
- objectBundleService.commit( bundle );
-
- List<DataSet> dataSets = manager.getAll( DataSet.class );
- List<OrganisationUnit> organisationUnits = manager.getAll( OrganisationUnit.class );
- List<DataElement> dataElements = manager.getAll( DataElement.class );
- List<Chart> charts = manager.getAll( Chart.class );
-
- assertEquals( 2, dataSets.size() );
- assertEquals( 1, organisationUnits.size() );
- assertEquals( 4, dataElements.size() );
- assertEquals( 2, charts.size() );
- }
-}
\ No newline at end of file
=== removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/metadata_with_charts1.json'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/metadata_with_charts1.json 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/metadata_with_charts1.json 1970-01-01 00:00:00 +0000
@@ -1,560 +0,0 @@
-{
- "organisationUnitLevels": [
- {
- "lastUpdated": "2016-03-14T10:31:05.867+0000",
- "level": 1,
- "name": "Level 1",
- "id": "LEN4A8VwYz6",
- "created": "2016-03-14T10:31:05.866+0000"
- }
- ],
- "categoryOptionCombos": [
- {
- "categoryOptions": [
- {
- "id": "xYerKDKCefk"
- }
- ],
- "name": "default",
- "code": "default",
- "created": "2016-03-14T10:26:13.837+0000",
- "id": "HllvX50cXC0",
- "ignoreApproval": false,
- "categoryCombo": {
- "id": "bjDvmb4bfuf"
- },
- "lastUpdated": "2016-03-14T10:26:13.837+0000"
- }
- ],
- "categories": [
- {
- "dataDimensionType": "DISAGGREGATION",
- "name": "default",
- "categoryOptions": [
- {
- "id": "xYerKDKCefk"
- }
- ],
- "lastUpdated": "2016-03-14T10:26:14.040+0000",
- "publicAccess": "--------",
- "dataDimension": true,
- "code": "default",
- "created": "2016-03-14T10:26:13.834+0000",
- "userGroupAccesses": [ ],
- "id": "GLevLNI9wkl"
- }
- ],
- "dataElements": [
- {
- "zeroIsSignificant": false,
- "domainType": "AGGREGATE",
- "created": "2016-03-14T10:28:24.014+0000",
- "code": "DataElementCodeA",
- "aggregationType": "SUM",
- "lastUpdated": "2016-03-14T10:28:24.019+0000",
- "name": "DataElementA",
- "userGroupAccesses": [ ],
- "attributeValues": [ ],
- "user": {
- "id": "M5zQapPyTZI"
- },
- "id": "L5kP66sGI1q",
- "aggregationLevels": [ ],
- "categoryCombo": {
- "id": "bjDvmb4bfuf"
- },
- "publicAccess": "rw------",
- "shortName": "DataElementShortA",
- "valueType": "NUMBER"
- },
- {
- "name": "DataElementB",
- "aggregationLevels": [ ],
- "attributeValues": [ ],
- "userGroupAccesses": [ ],
- "user": {
- "id": "M5zQapPyTZI"
- },
- "id": "c6CtsJCClHn",
- "valueType": "NUMBER",
- "shortName": "DataElementShortB",
- "publicAccess": "rw------",
- "categoryCombo": {
- "id": "bjDvmb4bfuf"
- },
- "zeroIsSignificant": false,
- "domainType": "AGGREGATE",
- "created": "2016-03-14T10:28:44.117+0000",
- "code": "DataElementCodeB",
- "lastUpdated": "2016-03-14T10:28:44.118+0000",
- "aggregationType": "SUM"
- },
- {
- "code": "DataElementCodeC",
- "created": "2016-03-14T10:29:04.513+0000",
- "aggregationType": "SUM",
- "lastUpdated": "2016-03-14T10:29:04.516+0000",
- "zeroIsSignificant": false,
- "domainType": "AGGREGATE",
- "aggregationLevels": [ ],
- "attributeValues": [ ],
- "userGroupAccesses": [ ],
- "id": "qjHP8fHrPtp",
- "user": {
- "id": "M5zQapPyTZI"
- },
- "shortName": "DataElementShortC",
- "valueType": "NUMBER",
- "categoryCombo": {
- "id": "bjDvmb4bfuf"
- },
- "publicAccess": "rw------",
- "name": "DataElementC"
- },
- {
- "name": "DataElementD",
- "categoryCombo": {
- "id": "bjDvmb4bfuf"
- },
- "publicAccess": "rw------",
- "shortName": "DataElementShortD",
- "valueType": "NUMBER",
- "userGroupAccesses": [ ],
- "attributeValues": [ ],
- "user": {
- "id": "M5zQapPyTZI"
- },
- "id": "QvcHWEhvyJz",
- "aggregationLevels": [ ],
- "domainType": "AGGREGATE",
- "zeroIsSignificant": false,
- "aggregationType": "SUM",
- "lastUpdated": "2016-03-14T10:29:20.649+0000",
- "created": "2016-03-14T10:29:20.647+0000",
- "code": "DataElementCodeD"
- }
- ],
- "charts": [
- {
- "id": "LR06Bqu0Rur",
- "organisationUnitGroups": [ ],
- "categoryOptionGroups": [ ],
- "regression": false,
- "dataElementGroups": [ ],
- "organisationUnits": [
- {
- "id": "Ku3wiLhVBkw"
- }
- ],
- "categoryDimensions": [ ],
- "dataDimensionItems": [
- {
- "dataElement": {
- "id": "L5kP66sGI1q"
- },
- "dataDimensionItemType": "AGGREGATE_DATA_ELEMENT"
- },
- {
- "dataDimensionItemType": "AGGREGATE_DATA_ELEMENT",
- "dataElement": {
- "id": "c6CtsJCClHn"
- }
- }
- ],
- "itemOrganisationUnitGroups": [ ],
- "created": "2016-03-14T10:54:15.592+0000",
- "externalAccess": false,
- "hideSubtitle": false,
- "periods": [ ],
- "userOrganisationUnitGrandChildren": false,
- "relativePeriods": {
- "last12Months": false,
- "monthsThisYear": false,
- "lastWeek": false,
- "thisMonth": false,
- "last5Years": false,
- "thisFinancialYear": false,
- "last6Months": true,
- "last4Quarters": false,
- "quartersLastYear": false,
- "last6BiMonths": false,
- "lastMonth": false,
- "last3Months": false,
- "lastQuarter": false,
- "monthsLastYear": false,
- "lastSixMonth": false,
- "lastBimonth": false,
- "lastFinancialYear": false,
- "thisQuarter": false,
- "last2SixMonths": false,
- "thisWeek": false,
- "thisYear": false,
- "lastYear": false,
- "last52Weeks": false,
- "quartersThisYear": false,
- "last4Weeks": false,
- "last12Weeks": false,
- "thisSixMonth": false,
- "thisBimonth": false,
- "last5FinancialYears": false
- },
- "filterDimensions": [
- "ou"
- ],
- "aggregationType": "DEFAULT",
- "hideEmptyRows": false,
- "completedOnly": false,
- "organisationUnitLevels": [ ],
- "user": {
- "id": "M5zQapPyTZI"
- },
- "userGroupAccesses": [ ],
- "hideLegend": false,
- "sortOrder": 0,
- "hideTitle": false,
- "publicAccess": "rw------",
- "type": "COLUMN",
- "series": "dx",
- "name": "ChartA",
- "showData": true,
- "category": "pe",
- "lastUpdated": "2016-03-14T10:54:15.593+0000",
- "userOrganisationUnitChildren": false,
- "userOrganisationUnit": false
- },
- {
- "hideSubtitle": false,
- "externalAccess": false,
- "created": "2016-03-14T10:54:39.655+0000",
- "periods": [ ],
- "relativePeriods": {
- "last4Quarters": false,
- "last6BiMonths": false,
- "lastMonth": false,
- "quartersLastYear": false,
- "last3Months": false,
- "lastQuarter": false,
- "monthsLastYear": false,
- "lastSixMonth": false,
- "last2SixMonths": false,
- "lastBimonth": false,
- "lastFinancialYear": false,
- "thisQuarter": false,
- "thisWeek": false,
- "lastYear": false,
- "thisYear": false,
- "last12Months": false,
- "monthsThisYear": false,
- "lastWeek": true,
- "thisMonth": false,
- "last5Years": false,
- "thisFinancialYear": false,
- "last6Months": false,
- "last4Weeks": false,
- "last12Weeks": false,
- "thisSixMonth": false,
- "thisBimonth": false,
- "last5FinancialYears": false,
- "last52Weeks": false,
- "quartersThisYear": false
- },
- "userOrganisationUnitGrandChildren": false,
- "aggregationType": "DEFAULT",
- "filterDimensions": [
- "ou"
- ],
- "hideEmptyRows": false,
- "completedOnly": false,
- "organisationUnitGroups": [ ],
- "id": "y6lH8sHglwg",
- "categoryOptionGroups": [ ],
- "regression": false,
- "organisationUnits": [
- {
- "id": "Ku3wiLhVBkw"
- }
- ],
- "dataElementGroups": [ ],
- "itemOrganisationUnitGroups": [ ],
- "dataDimensionItems": [
- {
- "dataElement": {
- "id": "qjHP8fHrPtp"
- },
- "dataDimensionItemType": "AGGREGATE_DATA_ELEMENT"
- },
- {
- "dataDimensionItemType": "AGGREGATE_DATA_ELEMENT",
- "dataElement": {
- "id": "QvcHWEhvyJz"
- }
- }
- ],
- "categoryDimensions": [ ],
- "category": "pe",
- "lastUpdated": "2016-03-14T10:54:39.655+0000",
- "userOrganisationUnitChildren": false,
- "userOrganisationUnit": false,
- "userGroupAccesses": [ ],
- "organisationUnitLevels": [ ],
- "user": {
- "id": "M5zQapPyTZI"
- },
- "hideTitle": false,
- "sortOrder": 0,
- "hideLegend": false,
- "publicAccess": "rw------",
- "type": "COLUMN",
- "name": "ChartB",
- "series": "dx",
- "showData": true
- }
- ],
- "organisationUnits": [
- {
- "name": "Country",
- "uuid": "7077b124-4e48-4f3c-adf8-e654eb7876a4",
- "description": "",
- "created": "2016-03-14T10:26:44.419+0000",
- "attributeValues": [ ],
- "user": {
- "id": "M5zQapPyTZI"
- },
- "id": "Ku3wiLhVBkw",
- "path": "/Ku3wiLhVBkw",
- "featureType": "NONE",
- "lastUpdated": "2016-03-14T10:26:44.434+0000",
- "openingDate": "2016-03-14",
- "shortName": "Country"
- }
- ],
- "userRoles": [
- {
- "lastUpdated": "2016-03-14T10:26:27.162+0000",
- "publicAccess": "--------",
- "programs": [ ],
- "code": "Superuser",
- "created": "2016-03-14T10:26:27.162+0000",
- "userGroupAccesses": [ ],
- "id": "yrB6vc5Ip3r",
- "dataSets": [ ],
- "description": "Superuser",
- "name": "Superuser",
- "authorities": [
- "F_TRACKED_ENTITY_INSTANCE_SEARCH_IN_ALL_ORGUNITS",
- "ALL",
- "F_USERGROUP_MANAGING_RELATIONSHIPS_ADD",
- "F_REPORTTABLE_PUBLIC_ADD",
- "F_TRACKED_ENTITY_INSTANCE_DELETE",
- "F_USER_GROUPS_READ_ONLY_ADD_MEMBERS",
- "F_MAP_PUBLIC_ADD",
- "F_USER_ADD_WITHIN_MANAGED_GROUP",
- "F_TRACKED_ENTITY_INSTANCE_SEARCH",
- "F_PROGRAM_ENROLLMENT",
- "F_REPORTTABLE_EXTERNAL",
- "F_SQLVIEW_EXTERNAL",
- "F_GIS_ADMIN",
- "F_REPLICATE_USER",
- "F_INSERT_CUSTOM_JS_CSS",
- "F_DASHBOARD_PUBLIC_ADD",
- "F_METADATA_IMPORT",
- "F_CHART_PUBLIC_ADD",
- "F_VIEW_UNAPPROVED_DATA",
- "F_CHART_EXTERNAL",
- "F_USERGROUP_MANAGING_RELATIONSHIPS_VIEW",
- "F_METADATA_EXPORT",
- "F_PROGRAM_UNENROLLMENT",
- "F_APPROVE_DATA",
- "F_ACCEPT_DATA_LOWER_LEVELS",
- "F_TRACKED_ENTITY_INSTANCE_ADD",
- "F_USERGROUP_PUBLIC_ADD",
- "F_OAUTH2_CLIENT_MANAGE",
- "F_TRACKED_ENTITY_DATAVALUE_ADD",
- "F_PROGRAM_DASHBOARD_CONFIG_ADMIN",
- "F_MAP_EXTERNAL",
- "F_APPROVE_DATA_LOWER_LEVELS",
- "F_TRACKED_ENTITY_DATAVALUE_DELETE"
- ]
- }
- ],
- "categoryOptions": [
- {
- "shortName": "default",
- "lastUpdated": "2016-03-14T10:26:13.843+0000",
- "publicAccess": "--------",
- "code": "default",
- "userGroupAccesses": [ ],
- "attributeValues": [ ],
- "id": "xYerKDKCefk",
- "created": "2016-03-14T10:26:13.821+0000",
- "organisationUnits": [ ],
- "name": "default"
- }
- ],
- "trackedEntities": [
- {
- "lastUpdated": "2016-03-13T17:00:00.000+0000",
- "description": "Person",
- "name": "Person",
- "code": "Person",
- "attributeValues": [ ],
- "created": "2016-03-13T17:00:00.000+0000",
- "id": "MCPQUTHX1Ze"
- }
- ],
- "users": [
- {
- "surname": "admin",
- "code": "admin",
- "created": "2016-03-14T10:26:27.141+0000",
- "id": "M5zQapPyTZI",
- "attributeValues": [ ],
- "lastUpdated": "2016-03-14T10:27:40.595+0000",
- "organisationUnits": [
- {
- "id": "Ku3wiLhVBkw"
- }
- ],
- "firstName": "admin",
- "userCredentials": {
- "created": "2016-03-14T10:26:27.177+0000",
- "code": "admin",
- "invitation": false,
- "externalAuth": false,
- "lastUpdated": "2016-03-14T10:27:40.592+0000",
- "passwordLastUpdated": "2016-03-14T10:26:27.178+0000",
- "catDimensionConstraints": [ ],
- "username": "admin",
- "disabled": false,
- "selfRegistered": false,
- "user": {
- "id": "M5zQapPyTZI"
- },
- "id": "Wzwcfu5Wwvx",
- "lastLogin": "2016-03-14T10:26:27.177+0000",
- "cogsDimensionConstraints": [ ],
- "userRoles": [
- {
- "id": "yrB6vc5Ip3r"
- }
- ],
- "userInfo": {
- "id": "M5zQapPyTZI"
- }
- },
- "dataViewOrganisationUnits": [
- {
- "id": "Ku3wiLhVBkw"
- }
- ],
- "teiSearchOrganisationUnits": [ ]
- }
- ],
- "categoryCombos": [
- {
- "name": "default",
- "skipTotal": false,
- "dataDimensionType": "DISAGGREGATION",
- "userGroupAccesses": [ ],
- "created": "2016-03-14T10:26:13.836+0000",
- "id": "bjDvmb4bfuf",
- "code": "default",
- "lastUpdated": "2016-03-14T10:26:13.839+0000",
- "categories": [
- {
- "id": "GLevLNI9wkl"
- }
- ],
- "publicAccess": "--------"
- }
- ],
- "dataSets": [
- {
- "code": "DataSetCodeA",
- "created": "2016-03-14T10:29:58.832+0000",
- "version": 0,
- "periodType": "Monthly",
- "fieldCombinationRequired": false,
- "lastUpdated": "2016-03-14T10:30:54.761+0000",
- "mobile": false,
- "dataElementDecoration": false,
- "noValueRequiresComment": false,
- "indicators": [ ],
- "attributeValues": [ ],
- "id": "EhbRc6ME5fb",
- "userGroupAccesses": [ ],
- "user": {
- "id": "M5zQapPyTZI"
- },
- "validCompleteOnly": false,
- "openFuturePeriods": 0,
- "expiryDays": 0,
- "publicAccess": "rw------",
- "skipOffline": false,
- "dataElements": [
- {
- "id": "c6CtsJCClHn"
- },
- {
- "id": "L5kP66sGI1q"
- }
- ],
- "shortName": "DataSetShortA",
- "timelyDays": 0,
- "renderAsTabs": false,
- "organisationUnits": [
- {
- "id": "Ku3wiLhVBkw"
- }
- ],
- "name": "DataSetA",
- "notifyCompletingUser": false,
- "renderHorizontally": false,
- "compulsoryDataElementOperands": [ ]
- },
- {
- "notifyCompletingUser": false,
- "compulsoryDataElementOperands": [ ],
- "renderHorizontally": false,
- "timelyDays": 0,
- "renderAsTabs": false,
- "organisationUnits": [
- {
- "id": "Ku3wiLhVBkw"
- }
- ],
- "name": "DataSetB",
- "skipOffline": false,
- "expiryDays": 0,
- "publicAccess": "rw------",
- "shortName": "DataSetShortB",
- "dataElements": [
- {
- "id": "QvcHWEhvyJz"
- },
- {
- "id": "qjHP8fHrPtp"
- }
- ],
- "attributeValues": [ ],
- "id": "kS0QOOZbxEe",
- "userGroupAccesses": [ ],
- "user": {
- "id": "M5zQapPyTZI"
- },
- "validCompleteOnly": false,
- "openFuturePeriods": 0,
- "mobile": false,
- "dataElementDecoration": false,
- "indicators": [ ],
- "noValueRequiresComment": false,
- "lastUpdated": "2016-03-14T10:31:00.598+0000",
- "code": "DataSetCodeB",
- "created": "2016-03-14T10:29:58.832+0000",
- "version": 0,
- "periodType": "Monthly",
- "fieldCombinationRequired": false
- }
- ],
- "date": "2016-03-14T10:55:35.567+0000"
-}
=== removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate'
=== removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/HibernateChartStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/HibernateChartStore.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/HibernateChartStore.java 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-package org.hisp.dhis.chart.hibernate;
-
-/*
- * Copyright (c) 2004-2016, 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.chart.Chart;
-import org.hisp.dhis.chart.ChartStore;
-import org.hisp.dhis.common.hibernate.HibernateAnalyticalObjectStore;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class HibernateChartStore
- extends HibernateAnalyticalObjectStore<Chart>
- implements ChartStore
-{
-}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2016-03-15 08:29:20 +0000
@@ -28,17 +28,30 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.common.DimensionalObject.DIMENSION_SEP;
+import static org.hisp.dhis.commons.collection.ListUtils.getArray;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Font;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.commons.math3.exception.MathRuntimeException;
+import org.apache.commons.math3.analysis.interpolation.SplineInterpolator;
import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.interpolation.SplineInterpolator;
import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator;
-import org.apache.commons.math3.exception.MathRuntimeException;
import org.apache.commons.math3.stat.regression.SimpleRegression;
import org.hisp.dhis.analytics.AnalyticsService;
import org.hisp.dhis.analytics.event.EventAnalyticsService;
import org.hisp.dhis.chart.BaseChart;
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.chart.ChartService;
-import org.hisp.dhis.chart.ChartStore;
import org.hisp.dhis.chart.ChartType;
import org.hisp.dhis.common.AnalyticalObjectStore;
import org.hisp.dhis.common.AnalyticsType;
@@ -99,21 +112,8 @@
import org.jfree.data.general.ValueDataset;
import org.jfree.ui.RectangleInsets;
import org.jfree.util.TableOrder;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import java.awt.*;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import static org.hisp.dhis.common.DimensionalObject.DIMENSION_SEP;
-import static org.hisp.dhis.commons.collection.ListUtils.getArray;
-
/**
* @author Lars Helge Overland
*/
@@ -141,8 +141,12 @@
// Dependencies
// -------------------------------------------------------------------------
- @Autowired
- private ChartStore chartStore;
+ private AnalyticalObjectStore<Chart> chartStore;
+
+ public void setChartStore( AnalyticalObjectStore<Chart> chartStore )
+ {
+ this.chartStore = chartStore;
+ }
private PeriodService periodService;
@@ -185,14 +189,14 @@
{
this.analyticsService = analyticsService;
}
-
+
private EventAnalyticsService eventAnalyticsService;
-
+
public void setEventAnalyticsService( EventAnalyticsService eventAnalyticsService )
{
this.eventAnalyticsService = eventAnalyticsService;
}
-
+
// -------------------------------------------------------------------------
// ChartService implementation
// -------------------------------------------------------------------------
@@ -202,7 +206,7 @@
{
return chartStore;
}
-
+
@Override
public JFreeChart getJFreeChart( int id, I18nFormat format )
{
@@ -587,7 +591,7 @@
{
Number number = dataSet.getValue( 0, 0 );
ValueDataset valueDataSet = new DefaultValueDataset( number );
-
+
return getGaugeChart( chart, valueDataSet );
}
else
@@ -604,7 +608,7 @@
JFreeChart jFreeChart = new JFreeChart( chart.getName(), TITLE_FONT, plot, !chart.isHideLegend() );
setBasicConfig( jFreeChart, chart );
-
+
if ( chart.isTargetLine() )
{
plot.addRangeMarker( getMarker( chart.getTargetLineValue(), chart.getTargetLineLabel() ) );
@@ -679,22 +683,22 @@
CategoryAxis xAxis = plot.getDomainAxis();
xAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 );
-
+
return stackedBarChart;
}
-
+
private JFreeChart getMultiplePieChart( BaseChart chart, CategoryDataset[] dataSets )
{
JFreeChart multiplePieChart = ChartFactory.createMultiplePieChart( chart.getName(), dataSets[0], TableOrder.BY_ROW,
!chart.isHideLegend(), false, false );
setBasicConfig( multiplePieChart, chart );
-
+
if ( multiplePieChart.getLegend() != null )
{
multiplePieChart.getLegend().setItemFont( SUB_TITLE_FONT );
}
-
+
MultiplePiePlot multiplePiePlot = (MultiplePiePlot) multiplePieChart.getPlot();
JFreeChart pieChart = multiplePiePlot.getPieChart();
pieChart.setBackgroundPaint( COLOR_TRANSPARENT );
@@ -718,24 +722,24 @@
return multiplePieChart;
}
-
+
private JFreeChart getGaugeChart( BaseChart chart, ValueDataset dataSet )
{
MeterPlot meterPlot = new MeterPlot( dataSet );
meterPlot.setUnits( "" );
meterPlot.setRange( new Range( 0.0d, 100d ) );
-
+
for ( int i = 0; i < 10; i++ )
{
double start = i * 10;
double end = start + 10;
String label = String.valueOf( start );
-
+
meterPlot.addInterval( new MeterInterval( label, new Range( start, end ), COLOR_LIGHT_GRAY, null, COLOR_LIGHT_GRAY ) );
}
-
- meterPlot.setMeterAngle( 180 );
+
+ meterPlot.setMeterAngle(180);
meterPlot.setDialBackgroundPaint( COLOR_LIGHT_GRAY );
meterPlot.setDialShape( DialShape.CHORD );
meterPlot.setNeedlePaint( COLORS[0] );
@@ -745,11 +749,11 @@
meterPlot.setTickPaint( COLOR_LIGHTER_GRAY );
meterPlot.setValueFont( TITLE_FONT );
meterPlot.setValuePaint( Color.BLACK );
-
+
JFreeChart meterChart = new JFreeChart( chart.getName(), meterPlot );
setBasicConfig( meterChart, chart );
meterChart.removeLegend();
-
+
return meterChart;
}
@@ -757,18 +761,18 @@
* Sets basic configuration including title font, subtitle, background paint and
* anti-alias on the given JFreeChart.
*/
- private void setBasicConfig( JFreeChart jFreeChart, BaseChart chart )
+ private void setBasicConfig( JFreeChart jFreeChart, BaseChart chart)
{
jFreeChart.getTitle().setFont( TITLE_FONT );
-
+
jFreeChart.setBackgroundPaint( COLOR_TRANSPARENT );
jFreeChart.setAntiAlias( true );
-
+
if ( !chart.isHideTitle() )
{
jFreeChart.addSubtitle( getSubTitle( chart ) );
}
-
+
Plot plot = jFreeChart.getPlot();
plot.setBackgroundPaint( COLOR_TRANSPARENT );
plot.setOutlinePaint( COLOR_TRANSPARENT );
@@ -779,17 +783,17 @@
TextTitle textTitle = new TextTitle();
String title = chart.hasTitle() ? chart.getTitle() : chart.generateTitle();
-
+
textTitle.setFont( SUB_TITLE_FONT );
textTitle.setText( title );
-
+
return textTitle;
}
private CategoryDataset[] getCategoryDataSet( BaseChart chart )
{
Map<String, Object> valueMap = new HashMap<>();
-
+
if ( chart.isAnalyticsType( AnalyticsType.AGGREGATE ) )
{
valueMap = analyticsService.getAggregatedDataValueMapping( chart, chart.getFormat() );
@@ -797,10 +801,10 @@
else if ( chart.isAnalyticsType( AnalyticsType.EVENT ) )
{
Grid grid = eventAnalyticsService.getAggregatedEventData( chart, chart.getFormat() );
-
+
chart.setDataItemGrid( grid );
-
- valueMap = GridUtils.getMetaValueMapping( grid, (grid.getWidth() - 1) );
+
+ valueMap = GridUtils.getMetaValueMapping( grid, ( grid.getWidth() - 1 ) );
}
DefaultCategoryDataset regularDataSet = new DefaultCategoryDataset();
@@ -809,27 +813,27 @@
SimpleRegression regression = new SimpleRegression();
BaseAnalyticalObject.sortKeys( valueMap );
-
+
List<NameableObject> seriez = new ArrayList<>( chart.series() );
List<NameableObject> categories = new ArrayList<>( chart.category() );
-
+
if ( chart.hasSortOrder() )
{
categories = getSortedCategories( categories, chart, valueMap );
}
-
+
for ( NameableObject series : seriez )
{
double categoryIndex = 0;
-
+
for ( NameableObject category : categories )
{
categoryIndex++;
String key = getKey( series, category, chart.getAnalyticsType() );
-
+
Object object = valueMap.get( key );
-
+
Number value = object != null && object instanceof Number ? (Number) object : null;
regularDataSet.addValue( value, series.getShortName(), category.getShortName() );
@@ -860,7 +864,7 @@
return new CategoryDataset[]{ regularDataSet, regressionDataSet };
}
-
+
/**
* Creates a key based on the given input. Sorts the key on its components
* to remove significance of column order.
@@ -871,10 +875,10 @@
// Replace potential operand separator with dimension separator
- key = AnalyticsType.AGGREGATE.equals( analyticsType ) ? key.replace( DataElementOperand.SEPARATOR, DIMENSION_SEP ) : key;
-
+ key = AnalyticsType.AGGREGATE.equals( analyticsType ) ? key.replace( DataElementOperand.SEPARATOR, DIMENSION_SEP ) : key;
+
// TODO fix issue with keys including -.
-
+
return BaseAnalyticalObject.sortKey( key );
}
@@ -885,28 +889,28 @@
private List<NameableObject> getSortedCategories( List<NameableObject> categories, BaseChart chart, Map<String, Object> valueMap )
{
NameableObject series = chart.series().get( 0 );
-
+
int sortOrder = chart.getSortOrder();
-
+
List<NumericSortWrapper<NameableObject>> list = new ArrayList<>();
-
+
for ( NameableObject category : categories )
{
String key = getKey( series, category, chart.getAnalyticsType() );
-
+
Object value = valueMap.get( key );
-
+
if ( value != null && value instanceof Number )
{
- list.add( new NumericSortWrapper<NameableObject>( category, (Double) value, sortOrder ) );
+ list.add( new NumericSortWrapper<NameableObject>( category, (Double ) value, sortOrder ) );
}
}
-
+
Collections.sort( list );
-
+
return NumericSortWrapper.getObjectList( list );
}
-
+
// -------------------------------------------------------------------------
// CRUD operations
// -------------------------------------------------------------------------
=== removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/hibernate'
=== removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/hibernate/HibernateDocumentStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/hibernate/HibernateDocumentStore.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/hibernate/HibernateDocumentStore.java 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-package org.hisp.dhis.document.hibernate;
-
-/*
- * Copyright (c) 2004-2016, 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.common.hibernate.HibernateIdentifiableObjectStore;
-import org.hisp.dhis.document.Document;
-import org.hisp.dhis.document.DocumentStore;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class HibernateDocumentStore
- extends HibernateIdentifiableObjectStore<Document>
- implements DocumentStore
-{
-}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java 2016-03-15 08:29:20 +0000
@@ -28,16 +28,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.List;
+
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.document.Document;
import org.hisp.dhis.document.DocumentService;
-import org.hisp.dhis.document.DocumentStore;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
-import java.util.List;
-
/**
* @author Lars Helge Overland
+ * @version $Id$
*/
@Transactional
public class DefaultDocumentService
@@ -47,8 +47,12 @@
// Dependencies
// -------------------------------------------------------------------------
- @Autowired
- private DocumentStore documentStore;
+ private GenericIdentifiableObjectStore<Document> documentStore;
+
+ public void setDocumentStore( GenericIdentifiableObjectStore<Document> documentStore )
+ {
+ this.documentStore = documentStore;
+ }
// -------------------------------------------------------------------------
// DocumentService implementation
@@ -113,7 +117,7 @@
{
return documentStore.getAllLikeName( name, first, max );
}
-
+
@Override
public List<Document> getDocumentsByUid( List<String> uids )
{
=== removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/hibernate'
=== removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/hibernate/HibernateReportStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/hibernate/HibernateReportStore.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/hibernate/HibernateReportStore.java 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-package org.hisp.dhis.report.hibernate;
-
-/*
- * Copyright (c) 2004-2016, 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.common.hibernate.HibernateIdentifiableObjectStore;
-import org.hisp.dhis.report.Report;
-import org.hisp.dhis.report.ReportStore;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class HibernateReportStore
- extends HibernateIdentifiableObjectStore<Report>
- implements ReportStore
-{
-}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java 2016-03-15 08:29:20 +0000
@@ -28,13 +28,30 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.common.IdentifiableObjectUtils.getIdentifiers;
+import static org.hisp.dhis.commons.util.TextUtils.getCommaDelimitedString;
+
+import java.io.OutputStream;
+import java.io.Writer;
+import java.nio.charset.StandardCharsets;
+import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.sql.DataSource;
+
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
+
import org.apache.commons.io.IOUtils;
import org.apache.velocity.VelocityContext;
import org.hisp.dhis.calendar.Calendar;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.common.Grid;
import org.hisp.dhis.common.IdentifiableObjectUtils;
import org.hisp.dhis.commons.util.Encoder;
@@ -47,30 +64,14 @@
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.report.ReportService;
-import org.hisp.dhis.report.ReportStore;
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.reporttable.ReportTableService;
import org.hisp.dhis.system.util.DateUtils;
import org.hisp.dhis.system.util.JRExportUtils;
import org.hisp.dhis.system.velocity.VelocityManager;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.datasource.DataSourceUtils;
import org.springframework.transaction.annotation.Transactional;
-import javax.sql.DataSource;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.nio.charset.StandardCharsets;
-import java.sql.Connection;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.hisp.dhis.common.IdentifiableObjectUtils.getIdentifiers;
-import static org.hisp.dhis.commons.util.TextUtils.getCommaDelimitedString;
-
/**
* @author Lars Helge Overland
*/
@@ -87,8 +88,12 @@
// Dependencies
// -------------------------------------------------------------------------
- @Autowired
- private ReportStore reportStore;
+ private GenericIdentifiableObjectStore<Report> reportStore;
+
+ public void setReportStore( GenericIdentifiableObjectStore<Report> reportStore )
+ {
+ this.reportStore = reportStore;
+ }
private ReportTableService reportTableService;
=== removed directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/hibernate'
=== removed file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/hibernate/HibernateReportTableStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/hibernate/HibernateReportTableStore.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/hibernate/HibernateReportTableStore.java 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
-package org.hisp.dhis.reporttable.hibernate;
-
-/*
- * Copyright (c) 2004-2016, 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.common.hibernate.HibernateAnalyticalObjectStore;
-import org.hisp.dhis.reporttable.ReportTable;
-import org.hisp.dhis.reporttable.ReportTableStore;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class HibernateReportTableStore
- extends HibernateAnalyticalObjectStore<ReportTable>
- implements ReportTableStore
-{
-}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2016-03-15 08:29:20 +0000
@@ -6,7 +6,7 @@
<!-- ReportTable -->
- <bean id="org.hisp.dhis.reporttable.ReportTableStore" class="org.hisp.dhis.reporttable.hibernate.HibernateReportTableStore">
+ <bean id="org.hisp.dhis.reporttable.ReportTableStore" class="org.hisp.dhis.common.hibernate.HibernateAnalyticalObjectStore">
<property name="clazz" value="org.hisp.dhis.reporttable.ReportTable" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
@@ -22,13 +22,14 @@
<!-- Report -->
- <bean id="org.hisp.dhis.report.ReportStore" class="org.hisp.dhis.report.hibernate.HibernateReportStore">
+ <bean id="org.hisp.dhis.report.ReportStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.hisp.dhis.report.Report" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.hisp.dhis.report.ReportService" class="org.hisp.dhis.report.impl.DefaultReportService">
+ <property name="reportStore" ref="org.hisp.dhis.report.ReportStore" />
<property name="reportTableService" ref="org.hisp.dhis.reporttable.ReportTableService" />
<property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
@@ -38,13 +39,14 @@
<!-- Chart -->
- <bean id="org.hisp.dhis.chart.ChartStore" class="org.hisp.dhis.chart.hibernate.HibernateChartStore">
+ <bean id="org.hisp.dhis.chart.ChartStore" class="org.hisp.dhis.common.hibernate.HibernateAnalyticalObjectStore">
<property name="clazz" value="org.hisp.dhis.chart.Chart" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.hisp.dhis.chart.ChartService" class="org.hisp.dhis.chart.impl.DefaultChartService">
+ <property name="chartStore" ref="org.hisp.dhis.chart.ChartStore" />
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
<property name="minMaxDataElementService" ref="org.hisp.dhis.minmax.MinMaxDataElementService" />
@@ -56,13 +58,15 @@
<!-- Document -->
- <bean id="org.hisp.dhis.document.DocumentStore" class="org.hisp.dhis.document.hibernate.HibernateDocumentStore">
+ <bean id="org.hisp.dhis.document.DocumentStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.hisp.dhis.document.Document" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
- <bean id="org.hisp.dhis.document.DocumentService" class="org.hisp.dhis.document.impl.DefaultDocumentService" />
+ <bean id="org.hisp.dhis.document.DocumentService" class="org.hisp.dhis.document.impl.DefaultDocumentService">
+ <property name="documentStore" ref="org.hisp.dhis.document.DocumentStore" />
+ </bean>
<!-- DataSetCompleteness -->
@@ -174,9 +178,9 @@
<entry key="analyticsLast3YearsTask" value-ref="analyticsLast3YearsTask" />
<entry key="monitoringLastDayTask" value-ref="monitoringLastDayTask" />
<entry key="dataSynchTask" value-ref="dataSynchTask" />
- <entry key="smsSchedulerTask" value-ref="smsSchedulerTask" />
- <entry key="sendScheduledMessageTask" value-ref="sendScheduledMessageTask" />
- <entry key="sendScheduledMessageTaskNow" value-ref="sendScheduledMessageTaskNow" />
+ <entry key="smsSchedulerTask" value-ref="smsSchedulerTask" />
+ <entry key="sendScheduledMessageTask" value-ref="sendScheduledMessageTask" />
+ <entry key="sendScheduledMessageTaskNow" value-ref="sendScheduledMessageTaskNow" />
</map>
</property>
</bean>
@@ -206,7 +210,7 @@
</list>
</property>
</bean>
-
+
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" ref="org.hisp.dhis.system.startup.StartupRoutineExecutor" />
<property name="targetMethod" value="addStartupRoutines" />
@@ -218,7 +222,7 @@
</list>
</property>
</bean>
-
+
<!-- DeletionHandler -->
<bean id="org.hisp.dhis.report.ReportDeletionHandler" class="org.hisp.dhis.report.ReportDeletionHandler">
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java 2016-03-15 08:29:20 +0000
@@ -28,7 +28,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+
import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.indicator.IndicatorType;
@@ -41,11 +52,6 @@
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.*;
-
/**
* @author Lars Helge Overland
* @version $Id$
@@ -53,9 +59,9 @@
public class ChartStoreTest
extends DhisSpringTest
{
- @Autowired
- private ChartStore chartStore;
-
+ @Resource(name="org.hisp.dhis.chart.ChartStore")
+ private GenericIdentifiableObjectStore<Chart> chartStore;
+
@Autowired
private IndicatorService indicatorService;
@@ -65,6 +71,7 @@
@Autowired
private OrganisationUnitService organisationUnitService;
+
private Indicator indicatorA;
private Indicator indicatorB;
private Indicator indicatorC;
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.java 2016-03-15 08:29:20 +0000
@@ -28,30 +28,36 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.List;
-
-import static org.junit.Assert.*;
/**
* @author Lars Helge Overland
+ * @version $Id$
*/
public class DocumentStoreTest
extends DhisSpringTest
{
- @Autowired
- private DocumentStore documentStore;
-
+ @Resource(name="org.hisp.dhis.document.DocumentStore")
+ private GenericIdentifiableObjectStore<Document> documentStore;
+
private Document documentA;
private Document documentB;
private Document documentC;
-
+
@Override
public void setUpTest()
- {
+ {
documentA = new Document( "DocumentA", "UrlA", true, null );
documentB = new Document( "DocumentB", "UrlB", true, null );
documentC = new Document( "DocumentC", "UrlC", false, null );
@@ -61,7 +67,7 @@
public void testSaveGet()
{
int id = documentStore.save( documentA );
-
+
assertEquals( documentA, documentStore.get( id ) );
}
@@ -70,15 +76,15 @@
{
int idA = documentStore.save( documentA );
int idB = documentStore.save( documentB );
-
+
assertNotNull( documentStore.get( idA ) );
assertNotNull( documentStore.get( idB ) );
-
+
documentStore.delete( documentA );
-
+
assertNull( documentStore.get( idA ) );
assertNotNull( documentStore.get( idB ) );
-
+
documentStore.delete( documentB );
assertNull( documentStore.get( idA ) );
@@ -91,13 +97,13 @@
documentStore.save( documentA );
documentStore.save( documentB );
documentStore.save( documentC );
-
+
List<Document> actual = documentStore.getAll();
-
+
assertEquals( 3, actual.size() );
assertTrue( actual.contains( documentA ) );
assertTrue( actual.contains( documentB ) );
- assertTrue( actual.contains( documentC ) );
+ assertTrue( actual.contains( documentC ) );
}
@Test
@@ -106,7 +112,7 @@
documentStore.save( documentA );
documentStore.save( documentB );
documentStore.save( documentC );
-
+
assertEquals( documentA, documentStore.getByName( "DocumentA" ) );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/report/ReportStoreTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/report/ReportStoreTest.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/report/ReportStoreTest.java 2016-03-15 08:29:20 +0000
@@ -28,28 +28,34 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.common.GenericStore;
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.reporttable.ReportTableService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.List;
-
-import static org.junit.Assert.*;
-
/**
* @author Lars Helge Overland
*/
public class ReportStoreTest
extends DhisSpringTest
{
- @Autowired
- private ReportStore reportStore;
-
+ @Resource(name="org.hisp.dhis.report.ReportStore")
+ private GenericStore<Report> reportStore;
+
@Autowired
private ReportTableService reportTableService;
-
+
private ReportTable reportTableA;
// -------------------------------------------------------------------------
@@ -74,10 +80,10 @@
{
Report reportA = new Report( "ReportA", ReportType.JASPER_REPORT_TABLE, "DesignA", reportTableA );
Report reportB = new Report( "ReportB", ReportType.JASPER_REPORT_TABLE, "DesignB", reportTableA );
-
+
int idA = reportStore.save( reportA );
int idB = reportStore.save( reportB );
-
+
assertEquals( reportA, reportStore.get( idA ) );
assertEquals( reportB, reportStore.get( idB ) );
}
@@ -87,22 +93,22 @@
{
Report reportA = new Report( "ReportA", ReportType.JASPER_REPORT_TABLE, "DesignA", reportTableA );
Report reportB = new Report( "ReportB", ReportType.JASPER_REPORT_TABLE, "DesignB", reportTableA );
-
+
int idA = reportStore.save( reportA );
int idB = reportStore.save( reportB );
-
+
assertEquals( reportA, reportStore.get( idA ) );
assertEquals( reportB, reportStore.get( idB ) );
-
+
reportA.setDesignContent( "UpdatedDesignA" );
reportB.setDesignContent( "UpdatedDesignB" );
-
+
int updatedIdA = reportStore.save( reportA );
int updatedIdB = reportStore.save( reportB );
-
+
assertEquals( idA, updatedIdA );
assertEquals( idB, updatedIdB );
-
+
assertEquals( "UpdatedDesignA", reportStore.get( updatedIdA ).getDesignContent() );
assertEquals( "UpdatedDesignB", reportStore.get( updatedIdB ).getDesignContent() );
}
@@ -112,13 +118,13 @@
{
Report reportA = new Report( "ReportA", ReportType.JASPER_REPORT_TABLE, "DesignA", reportTableA );
Report reportB = new Report( "ReportB", ReportType.JASPER_REPORT_TABLE, "DesignB", reportTableA );
-
+
int idA = reportStore.save( reportA );
int idB = reportStore.save( reportB );
-
+
assertNotNull( reportStore.get( idA ) );
assertNotNull( reportStore.get( idB ) );
-
+
reportStore.delete( reportA );
assertNull( reportStore.get( idA ) );
@@ -135,15 +141,15 @@
{
Report reportA = new Report( "ReportA", ReportType.JASPER_REPORT_TABLE, "DesignA", reportTableA );
Report reportB = new Report( "ReportB", ReportType.JASPER_REPORT_TABLE, "DesignB", reportTableA );
-
+
reportStore.save( reportA );
reportStore.save( reportB );
-
+
List<Report> reports = reportStore.getAll();
-
+
assertNotNull( reports );
assertEquals( 2, reports.size() );
assertTrue( reports.contains( reportA ) );
- assertTrue( reports.contains( reportB ) );
+ assertTrue( reports.contains( reportB ) );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java 2016-03-15 07:24:23 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java 2016-03-15 08:29:20 +0000
@@ -28,7 +28,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+
import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
@@ -46,11 +57,6 @@
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.*;
-
/**
* @author Lars Helge Overland
* @version $Id$
@@ -58,8 +64,8 @@
public class ReportTableStoreTest
extends DhisSpringTest
{
- @Autowired
- private ReportTableStore reportTableStore;
+ @Resource( name = "org.hisp.dhis.reporttable.ReportTableStore" )
+ private GenericIdentifiableObjectStore<ReportTable> reportTableStore;
@Autowired
private DataElementService dataElementService;
@@ -74,8 +80,8 @@
private PeriodService periodService;
@Autowired
- private OrganisationUnitService organisationUnitService;
-
+ private OrganisationUnitService organisationUnitService ;
+
private IndicatorType indicatorType;
private List<DataElement> dataElements;
@@ -83,28 +89,28 @@
private List<DataSet> dataSets;
private List<Period> periods;
private List<OrganisationUnit> units;
-
+
private PeriodType periodType;
private DataElement dataElementA;
private DataElement dataElementB;
-
+
private Indicator indicatorA;
private Indicator indicatorB;
-
+
private DataSet dataSetA;
private DataSet dataSetB;
-
+
private Period periodA;
private Period periodB;
-
+
private OrganisationUnit unitA;
private OrganisationUnit unitB;
private RelativePeriods relativesA;
private RelativePeriods relativesB;
private RelativePeriods relativesC;
-
+
@Override
public void setUpTest()
throws Exception
@@ -114,69 +120,69 @@
dataSets = new ArrayList<>();
periods = new ArrayList<>();
units = new ArrayList<>();
-
+
indicatorType = createIndicatorType( 'A' );
-
+
indicatorService.addIndicatorType( indicatorType );
-
+
periodType = PeriodType.getPeriodTypeByName( MonthlyPeriodType.NAME );
dataElementA = createDataElement( 'A' );
dataElementB = createDataElement( 'B' );
-
+
dataElementService.addDataElement( dataElementA );
dataElementService.addDataElement( dataElementB );
-
+
dataElements.add( dataElementA );
dataElements.add( dataElementB );
-
+
indicatorA = createIndicator( 'A', indicatorType );
indicatorB = createIndicator( 'B', indicatorType );
-
+
indicatorService.addIndicator( indicatorA );
indicatorService.addIndicator( indicatorB );
-
+
indicators.add( indicatorA );
indicators.add( indicatorB );
-
+
dataSetA = createDataSet( 'A', periodType );
dataSetB = createDataSet( 'B', periodType );
-
+
dataSetService.addDataSet( dataSetA );
dataSetService.addDataSet( dataSetB );
-
+
dataSets.add( dataSetA );
dataSets.add( dataSetB );
-
+
periodA = createPeriod( periodType, getDate( 2000, 1, 1 ), getDate( 2000, 1, 31 ) );
periodB = createPeriod( periodType, getDate( 2000, 2, 1 ), getDate( 2000, 2, 28 ) );
-
+
periodService.addPeriod( periodA );
periodService.addPeriod( periodB );
-
+
periods.add( periodA );
- periods.add( periodB );
+ periods.add( periodB );
unitA = createOrganisationUnit( 'A' );
- unitB = createOrganisationUnit( 'B' );
-
+ unitB = createOrganisationUnit( 'B' );
+
organisationUnitService.addOrganisationUnit( unitA );
organisationUnitService.addOrganisationUnit( unitB );
-
+
units.add( unitA );
units.add( unitB );
- relativesA = new RelativePeriods();
+ relativesA = new RelativePeriods();
relativesA.setLastMonth( true );
relativesA.setThisYear( true );
- relativesB = new RelativePeriods();
+ relativesB = new RelativePeriods();
relativesB.setLastMonth( true );
relativesB.setThisYear( true );
- relativesC = new RelativePeriods();
+ relativesC = new RelativePeriods();
relativesC.setLastMonth( true );
- relativesC.setThisYear( true );
+ relativesC.setThisYear( true );
}
@Test
@@ -184,28 +190,28 @@
{
ReportTable reportTableA = new ReportTable( "Immunization",
new ArrayList<>(), indicators, new ArrayList<>(), periods, units,
- true, true, false, relativesA, null, "january_2000" );
+ true, true, false, relativesA, null, "january_2000" );
ReportTable reportTableB = new ReportTable( "Prescriptions",
dataElements, new ArrayList<>(), new ArrayList<>(), periods, units,
false, false, true, relativesB, null, "january_2000" );
ReportTable reportTableC = new ReportTable( "Assualt",
new ArrayList<>(), new ArrayList<>(), dataSets, periods, units,
false, false, true, relativesC, null, "january_2000" );
-
+
int idA = reportTableStore.save( reportTableA );
int idB = reportTableStore.save( reportTableB );
int idC = reportTableStore.save( reportTableC );
-
+
reportTableA = reportTableStore.get( idA );
reportTableB = reportTableStore.get( idB );
reportTableC = reportTableStore.get( idC );
-
+
assertEquals( "Immunization", reportTableA.getName() );
assertEquals( indicators, reportTableA.getIndicators() );
assertEquals( periods, reportTableA.getPeriods() );
assertEquals( units, reportTableA.getOrganisationUnits() );
assertEquals( relativesA, reportTableA.getRelatives() );
-
+
assertEquals( "Prescriptions", reportTableB.getName() );
assertEquals( dataElements, reportTableB.getDataElements() );
assertEquals( periods, reportTableB.getPeriods() );
@@ -223,22 +229,22 @@
{
ReportTable reportTableA = new ReportTable( "Immunization",
new ArrayList<>(), indicators, new ArrayList<>(), periods, units,
- true, true, false, relativesA, null, "january_2000" );
+ true, true, false, relativesA, null, "january_2000" );
ReportTable reportTableB = new ReportTable( "Prescriptions",
dataElements, new ArrayList<>(), new ArrayList<>(), periods, units,
false, false, true, relativesB, null, "january_2000" );
-
+
int idA = reportTableStore.save( reportTableA );
int idB = reportTableStore.save( reportTableB );
-
+
assertNotNull( reportTableStore.get( idA ) );
assertNotNull( reportTableStore.get( idB ) );
-
+
reportTableStore.delete( reportTableA );
assertNull( reportTableStore.get( idA ) );
assertNotNull( reportTableStore.get( idB ) );
-
+
reportTableStore.delete( reportTableB );
assertNull( reportTableStore.get( idA ) );
@@ -250,16 +256,16 @@
{
ReportTable reportTableA = new ReportTable( "Immunization",
new ArrayList<>(), indicators, new ArrayList<>(), periods, units,
- true, true, false, relativesA, null, "january_2000" );
+ true, true, false, relativesA, null, "january_2000" );
ReportTable reportTableB = new ReportTable( "Prescriptions",
dataElements, new ArrayList<>(), new ArrayList<>(), periods, units,
false, false, true, relativesB, null, "january_2000" );
-
+
reportTableStore.save( reportTableA );
reportTableStore.save( reportTableB );
-
+
List<ReportTable> reportTables = reportTableStore.getAll();
-
+
assertTrue( reportTables.contains( reportTableA ) );
assertTrue( reportTables.contains( reportTableB ) );
}
@@ -269,16 +275,16 @@
{
ReportTable reportTableA = new ReportTable( "Immunization",
new ArrayList<>(), indicators, new ArrayList<>(), periods, units,
- true, true, false, relativesA, null, "january_2000" );
+ true, true, false, relativesA, null, "january_2000" );
ReportTable reportTableB = new ReportTable( "Prescriptions",
dataElements, new ArrayList<>(), new ArrayList<>(), periods, units,
false, false, true, relativesB, null, "january_2000" );
-
+
reportTableStore.save( reportTableA );
reportTableStore.save( reportTableB );
-
+
ReportTable receivedReportTableA = reportTableStore.getByName( "Immunization" );
-
+
assertNotNull( receivedReportTableA );
assertEquals( reportTableA.getName(), receivedReportTableA.getName() );
}