=== added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/ChartStore.java 2016-03-15 07:24:23 +0000 @@ -0,0 +1,40 @@ +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 + */ +public interface ChartStore + extends AnalyticalObjectStore +{ + String ID = ChartStore.class.getName(); +} === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/document/DocumentStore.java 2016-03-15 07:24:23 +0000 @@ -0,0 +1,39 @@ +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 + */ +public interface DocumentStore + extends GenericIdentifiableObjectStore +{ +} === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/report/ReportStore.java 2016-03-15 07:24:23 +0000 @@ -0,0 +1,39 @@ +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 + */ +public interface ReportStore + extends GenericIdentifiableObjectStore +{ +} === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableStore.java 2016-03-15 07:24:23 +0000 @@ -0,0 +1,40 @@ +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 + */ +public interface ReportTableStore + extends AnalyticalObjectStore +{ + 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-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/QueryService.java 2016-03-15 07:24:23 +0000 @@ -54,7 +54,7 @@ * @param transformer ResultTransformer to use for mutating the result * @return Matching objects */ - List query( Query query, ResultTransformer transformer ); + List query( Query query, ResultTransformer transformer ); /** * Returns how many objects matches the given query. === added 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 1970-01-01 00:00:00 +0000 +++ 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 @@ -0,0 +1,106 @@ +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 + */ +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, List> 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 dataSets = manager.getAll( DataSet.class ); + List organisationUnits = manager.getAll( OrganisationUnit.class ); + List dataElements = manager.getAll( DataElement.class ); + List 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 === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/metadata_with_charts1.json 2016-03-15 07:24:23 +0000 @@ -0,0 +1,560 @@ +{ + "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" +} === added directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate' === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/hibernate/HibernateChartStore.java 2016-03-15 07:24:23 +0000 @@ -0,0 +1,42 @@ +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 + */ +public class HibernateChartStore + extends HibernateAnalyticalObjectStore + 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-01-06 14:25:55 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2016-03-15 07:24:23 +0000 @@ -28,30 +28,17 @@ * 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.UnivariateFunction; import org.apache.commons.math3.analysis.interpolation.SplineInterpolator; -import org.apache.commons.math3.analysis.UnivariateFunction; 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; @@ -112,8 +99,21 @@ 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,12 +141,8 @@ // Dependencies // ------------------------------------------------------------------------- - private AnalyticalObjectStore chartStore; - - public void setChartStore( AnalyticalObjectStore chartStore ) - { - this.chartStore = chartStore; - } + @Autowired + private ChartStore chartStore; private PeriodService periodService; @@ -189,14 +185,14 @@ { this.analyticsService = analyticsService; } - + private EventAnalyticsService eventAnalyticsService; - + public void setEventAnalyticsService( EventAnalyticsService eventAnalyticsService ) { this.eventAnalyticsService = eventAnalyticsService; } - + // ------------------------------------------------------------------------- // ChartService implementation // ------------------------------------------------------------------------- @@ -206,7 +202,7 @@ { return chartStore; } - + @Override public JFreeChart getJFreeChart( int id, I18nFormat format ) { @@ -591,7 +587,7 @@ { Number number = dataSet.getValue( 0, 0 ); ValueDataset valueDataSet = new DefaultValueDataset( number ); - + return getGaugeChart( chart, valueDataSet ); } else @@ -608,7 +604,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() ) ); @@ -683,22 +679,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 ); @@ -722,24 +718,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] ); @@ -749,11 +745,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; } @@ -761,18 +757,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 ); @@ -783,17 +779,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 valueMap = new HashMap<>(); - + if ( chart.isAnalyticsType( AnalyticsType.AGGREGATE ) ) { valueMap = analyticsService.getAggregatedDataValueMapping( chart, chart.getFormat() ); @@ -801,10 +797,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(); @@ -813,27 +809,27 @@ SimpleRegression regression = new SimpleRegression(); BaseAnalyticalObject.sortKeys( valueMap ); - + List seriez = new ArrayList<>( chart.series() ); List 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() ); @@ -864,7 +860,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. @@ -875,10 +871,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 ); } @@ -889,28 +885,28 @@ private List getSortedCategories( List categories, BaseChart chart, Map valueMap ) { NameableObject series = chart.series().get( 0 ); - + int sortOrder = chart.getSortOrder(); - + List> 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( category, (Double ) value, sortOrder ) ); + list.add( new NumericSortWrapper( category, (Double) value, sortOrder ) ); } } - + Collections.sort( list ); - + return NumericSortWrapper.getObjectList( list ); } - + // ------------------------------------------------------------------------- // CRUD operations // ------------------------------------------------------------------------- === added directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/hibernate' === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/hibernate/HibernateDocumentStore.java 2016-03-15 07:24:23 +0000 @@ -0,0 +1,42 @@ +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 + */ +public class HibernateDocumentStore + extends HibernateIdentifiableObjectStore + 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-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java 2016-03-15 07:24:23 +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,12 +47,8 @@ // Dependencies // ------------------------------------------------------------------------- - private GenericIdentifiableObjectStore documentStore; - - public void setDocumentStore( GenericIdentifiableObjectStore documentStore ) - { - this.documentStore = documentStore; - } + @Autowired + private DocumentStore documentStore; // ------------------------------------------------------------------------- // DocumentService implementation @@ -117,7 +113,7 @@ { return documentStore.getAllLikeName( name, first, max ); } - + @Override public List getDocumentsByUid( List uids ) { === added directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/hibernate' === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/hibernate/HibernateReportStore.java 2016-03-15 07:24:23 +0000 @@ -0,0 +1,42 @@ +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 + */ +public class HibernateReportStore + extends HibernateIdentifiableObjectStore + 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-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/report/impl/DefaultReportService.java 2016-03-15 07:24:23 +0000 @@ -28,30 +28,13 @@ * 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; @@ -64,14 +47,30 @@ 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 */ @@ -88,12 +87,8 @@ // Dependencies // ------------------------------------------------------------------------- - private GenericIdentifiableObjectStore reportStore; - - public void setReportStore( GenericIdentifiableObjectStore reportStore ) - { - this.reportStore = reportStore; - } + @Autowired + private ReportStore reportStore; private ReportTableService reportTableService; === added directory 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/hibernate' === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/hibernate/HibernateReportTableStore.java 2016-03-15 07:24:23 +0000 @@ -0,0 +1,42 @@ +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 + */ +public class HibernateReportTableStore + extends HibernateAnalyticalObjectStore + 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-08 15:34:53 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/META-INF/dhis/beans.xml 2016-03-15 07:24:23 +0000 @@ -6,7 +6,7 @@ - + @@ -22,14 +22,13 @@ - + - @@ -39,14 +38,13 @@ - + - @@ -58,15 +56,13 @@ - + - - - + @@ -178,9 +174,9 @@ - - - + + + @@ -210,7 +206,7 @@ - + @@ -222,7 +218,7 @@ - + === 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-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java 2016-03-15 07:24:23 +0000 @@ -28,18 +28,7 @@ * 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; @@ -52,6 +41,11 @@ 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$ @@ -59,9 +53,9 @@ public class ChartStoreTest extends DhisSpringTest { - @Resource(name="org.hisp.dhis.chart.ChartStore") - private GenericIdentifiableObjectStore chartStore; - + @Autowired + private ChartStore chartStore; + @Autowired private IndicatorService indicatorService; @@ -71,7 +65,6 @@ @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-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.java 2016-03-15 07:24:23 +0000 @@ -28,36 +28,30 @@ * 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 { - @Resource(name="org.hisp.dhis.document.DocumentStore") - private GenericIdentifiableObjectStore documentStore; - + @Autowired + private DocumentStore 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 ); @@ -67,7 +61,7 @@ public void testSaveGet() { int id = documentStore.save( documentA ); - + assertEquals( documentA, documentStore.get( id ) ); } @@ -76,15 +70,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 ) ); @@ -97,13 +91,13 @@ documentStore.save( documentA ); documentStore.save( documentB ); documentStore.save( documentC ); - + List actual = documentStore.getAll(); - + assertEquals( 3, actual.size() ); assertTrue( actual.contains( documentA ) ); assertTrue( actual.contains( documentB ) ); - assertTrue( actual.contains( documentC ) ); + assertTrue( actual.contains( documentC ) ); } @Test @@ -112,7 +106,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-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/report/ReportStoreTest.java 2016-03-15 07:24:23 +0000 @@ -28,34 +28,28 @@ * 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 { - @Resource(name="org.hisp.dhis.report.ReportStore") - private GenericStore reportStore; - + @Autowired + private ReportStore reportStore; + @Autowired private ReportTableService reportTableService; - + private ReportTable reportTableA; // ------------------------------------------------------------------------- @@ -80,10 +74,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 ) ); } @@ -93,22 +87,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() ); } @@ -118,13 +112,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 ) ); @@ -141,15 +135,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 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-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java 2016-03-15 07:24:23 +0000 @@ -28,18 +28,7 @@ * 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; @@ -57,6 +46,11 @@ 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$ @@ -64,8 +58,8 @@ public class ReportTableStoreTest extends DhisSpringTest { - @Resource( name = "org.hisp.dhis.reporttable.ReportTableStore" ) - private GenericIdentifiableObjectStore reportTableStore; + @Autowired + private ReportTableStore reportTableStore; @Autowired private DataElementService dataElementService; @@ -80,8 +74,8 @@ private PeriodService periodService; @Autowired - private OrganisationUnitService organisationUnitService ; - + private OrganisationUnitService organisationUnitService; + private IndicatorType indicatorType; private List dataElements; @@ -89,28 +83,28 @@ private List dataSets; private List periods; private List 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 @@ -120,69 +114,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 @@ -190,28 +184,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() ); @@ -229,22 +223,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 ) ); @@ -256,16 +250,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 reportTables = reportTableStore.getAll(); - + assertTrue( reportTables.contains( reportTableA ) ); assertTrue( reportTables.contains( reportTableB ) ); } @@ -275,16 +269,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() ); }