=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/csv/CsvImportService.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/csv/CsvImportService.java 2016-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/csv/CsvImportService.java 2016-02-02 06:34:22 +0000 @@ -32,13 +32,13 @@ import java.io.InputStream; import org.hisp.dhis.common.IdentifiableObject; -import org.hisp.dhis.dxf2.metadata.MetaData; +import org.hisp.dhis.dxf2.metadata.Metadata; /** * @author Lars Helge Overland */ public interface CsvImportService { - MetaData fromCsv( InputStream input, Class clazz ) + Metadata fromCsv( InputStream input, Class clazz ) throws IOException; } === modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/csv/DefaultCsvImportService.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/csv/DefaultCsvImportService.java 2016-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/csv/DefaultCsvImportService.java 2016-02-02 06:34:22 +0000 @@ -43,7 +43,7 @@ import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementDomain; import org.hisp.dhis.dataelement.DataElementGroup; -import org.hisp.dhis.dxf2.metadata.MetaData; +import org.hisp.dhis.dxf2.metadata.Metadata; import org.hisp.dhis.expression.Expression; import org.hisp.dhis.expression.ExpressionService; import org.hisp.dhis.expression.MissingValueStrategy; @@ -87,48 +87,48 @@ // ------------------------------------------------------------------------- @Override - public MetaData fromCsv( InputStream input, Class clazz ) + public Metadata fromCsv( InputStream input, Class clazz ) throws IOException { CsvReader reader = new CsvReader( input, Charset.forName( "UTF-8" ) ); reader.readRecord(); // Ignore first row - MetaData metaData = new MetaData(); + Metadata metadata = new Metadata(); if ( DataElement.class.equals( clazz ) ) { - metaData.setDataElements( dataElementsFromCsv( reader ) ); + metadata.setDataElements( dataElementsFromCsv( reader ) ); } else if ( DataElementGroup.class.equals( clazz ) ) { - metaData.setDataElementGroups( dataElementGroupsFromCsv( reader ) ); + metadata.setDataElementGroups( dataElementGroupsFromCsv( reader ) ); } else if ( DataElementCategoryOption.class.equals( clazz ) ) { - metaData.setCategoryOptions( categoryOptionsFromCsv( reader ) ); + metadata.setCategoryOptions( categoryOptionsFromCsv( reader ) ); } else if ( CategoryOptionGroup.class.equals( clazz ) ) { - metaData.setCategoryOptionGroups( categoryOptionGroupsFromCsv( reader ) ); + metadata.setCategoryOptionGroups( categoryOptionGroupsFromCsv( reader ) ); } else if ( OrganisationUnit.class.equals( clazz ) ) { - metaData.setOrganisationUnits( organisationUnitsFromCsv( reader ) ); + metadata.setOrganisationUnits( organisationUnitsFromCsv( reader ) ); } else if ( OrganisationUnitGroup.class.equals( clazz ) ) { - metaData.setOrganisationUnitGroups( organisationUnitGroupsFromCsv( reader ) ); + metadata.setOrganisationUnitGroups( organisationUnitGroupsFromCsv( reader ) ); } else if ( ValidationRule.class.equals( clazz ) ) { - metaData.setValidationRules( validationRulesFromCsv( reader ) ); + metadata.setValidationRules( validationRulesFromCsv( reader ) ); } else if ( OptionSet.class.equals( clazz ) ) { - setOptionSetsFromCsv( reader, metaData ); + setOptionSetsFromCsv( reader, metadata ); } - return metaData; + return metadata; } // ------------------------------------------------------------------------- @@ -378,7 +378,7 @@ *
  • option code
  • * */ - private void setOptionSetsFromCsv( CsvReader reader, MetaData metaData ) + private void setOptionSetsFromCsv( CsvReader reader, Metadata metadata ) throws IOException { ListMap nameOptionMap = new ListMap<>(); @@ -409,7 +409,7 @@ nameOptionMap.putValue( optionSet.getName(), option ); - metaData.getOptions().add( option ); + metadata.getOptions().add( option ); } } @@ -423,7 +423,7 @@ optionSet.setOptions( options ); - metaData.getOptionSets().add( optionSet ); + metadata.getOptionSets().add( optionSet ); } } === modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/DefaultGmlImportService.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/DefaultGmlImportService.java 2016-02-01 07:36:06 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/DefaultGmlImportService.java 2016-02-02 06:34:22 +0000 @@ -43,7 +43,7 @@ import org.hisp.dhis.common.MergeStrategy; import org.hisp.dhis.dxf2.common.ImportOptions; import org.hisp.dhis.dxf2.metadata.ImportService; -import org.hisp.dhis.dxf2.metadata.MetaData; +import org.hisp.dhis.dxf2.metadata.Metadata; import org.hisp.dhis.render.RenderService; import org.hisp.dhis.importexport.ImportStrategy; import org.hisp.dhis.organisationunit.FeatureType; @@ -134,8 +134,8 @@ if ( preProcessed.isSuccess && preProcessed.dxf2MetaData != null ) { - MetaData metaData = dxf2ToMetaData( preProcessed.dxf2MetaData ); - importService.importMetaData( userUid, metaData, importOptions, taskId ); + Metadata metadata = dxf2ToMetaData( preProcessed.dxf2MetaData ); + importService.importMetaData( userUid, metadata, importOptions, taskId ); } else { @@ -153,12 +153,12 @@ private PreProcessingResult preProcessGml( InputStream inputStream ) { InputStream dxfStream = null; - MetaData metaData = null; + Metadata metadata = null; try { dxfStream = transformGml( inputStream ); - metaData = renderService.fromXml( dxfStream, MetaData.class ); + metadata = renderService.fromXml( dxfStream, Metadata.class ); } catch ( IOException | TransformerException e ) { @@ -171,7 +171,7 @@ Map uidMap = Maps.newHashMap(), codeMap = Maps.newHashMap(), nameMap = Maps.newHashMap(); - matchAndFilterOnIdentifiers( metaData.getOrganisationUnits(), uidMap, codeMap, nameMap ); + matchAndFilterOnIdentifiers( metadata.getOrganisationUnits(), uidMap, codeMap, nameMap ); Map persistedUidMap = getMatchingPersistedOrgUnits( uidMap.keySet(), IdentifiableProperty.UID ); Map persistedCodeMap = getMatchingPersistedOrgUnits( codeMap.keySet(), IdentifiableProperty.CODE ); @@ -205,7 +205,7 @@ mergeNonGeoData( persisted, imported ); } - String dxf2MetaData = metaDataToDxf2( metaData ); + String dxf2MetaData = metaDataToDxf2( metadata ); if ( dxf2MetaData == null ) { @@ -303,14 +303,14 @@ } } - private String metaDataToDxf2( MetaData metaData ) + private String metaDataToDxf2( Metadata metadata ) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); String dxf2 = null; try { - renderService.toXml( baos, metaData ); + renderService.toXml( baos, metadata ); dxf2 = baos.toString(); } catch ( IOException e ) @@ -325,20 +325,20 @@ return dxf2; } - private MetaData dxf2ToMetaData( String dxf2Content ) + private Metadata dxf2ToMetaData( String dxf2Content ) { - MetaData metaData; + Metadata metadata; try { - metaData = renderService.fromXml( dxf2Content, MetaData.class ); + metadata = renderService.fromXml( dxf2Content, Metadata.class ); } catch ( IOException e ) { - metaData = new MetaData(); + metadata = new Metadata(); } - return metaData; + return metadata; } private String createNotifierErrorMessage( Throwable throwable ) === modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.java 2016-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.java 2016-02-02 06:34:22 +0000 @@ -98,17 +98,17 @@ //------------------------------------------------------------------------------------------------------- @Override - public MetaData getMetaData( Options options ) + public Metadata getMetaData( Options options ) { return getMetaData( options, null ); } @Override @SuppressWarnings("unchecked") - public MetaData getMetaData( Options options, TaskId taskId ) + public Metadata getMetaData( Options options, TaskId taskId ) { - MetaData metaData = new MetaData(); - metaData.setCreated( new Date() ); + Metadata metadata = new Metadata(); + metadata.setCreated( new Date() ); User user = currentUserService.getCurrentUser(); String username = currentUserService.getCurrentUsername(); @@ -160,7 +160,7 @@ notifier.notify( taskId, message ); } - ReflectionUtils.invokeSetterMethod( schema.getPlural(), metaData, new ArrayList<>( idObjects ) ); + ReflectionUtils.invokeSetterMethod( schema.getPlural(), metadata, new ArrayList<>( idObjects ) ); } log.info( "Export done at " + new Date() ); @@ -170,7 +170,7 @@ notifier.notify( taskId, NotificationLevel.INFO, "Export done", true ); } - return metaData; + return metadata; } //------------------------------------------------------------------------------------------------------- @@ -178,16 +178,16 @@ //------------------------------------------------------------------------------------------------------- @Override - public MetaData getFilteredMetaData( FilterOptions filterOptions ) throws IOException + public Metadata getFilteredMetaData( FilterOptions filterOptions ) throws IOException { return getFilteredMetaData( filterOptions, null ); } @Override - public MetaData getFilteredMetaData( FilterOptions filterOptions, TaskId taskId ) throws IOException + public Metadata getFilteredMetaData( FilterOptions filterOptions, TaskId taskId ) throws IOException { - MetaData metaData = new MetaData(); - metaData.setCreated( new Date() ); + Metadata metadata = new Metadata(); + metadata.setCreated( new Date() ); log.info( "User '" + currentUserService.getCurrentUsername() + "' started export at " + new Date() ); @@ -234,7 +234,7 @@ notifier.notify( taskId, message ); } - ReflectionUtils.invokeSetterMethod( identifiableObjectEntry.getKey(), metaData, identifiableObjectEntry.getValue() ); + ReflectionUtils.invokeSetterMethod( identifiableObjectEntry.getKey(), metadata, identifiableObjectEntry.getValue() ); } log.info( "Export done at " + new Date() ); @@ -244,7 +244,7 @@ notifier.notify( taskId, NotificationLevel.INFO, "Export done", true ); } - return metaData; + return metadata; } //------------------------------------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2016-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2016-02-02 06:34:22 +0000 @@ -116,25 +116,25 @@ } @Override - public ImportSummary importMetaData( String userUid, MetaData metaData, TaskId taskId ) - { - return importMetaData( userUid, metaData, ImportOptions.getDefaultImportOptions(), taskId ); - } - - @Override - public ImportSummary importMetaData( String userUid, MetaData metaData ) - { - return importMetaData( userUid, metaData, ImportOptions.getDefaultImportOptions() ); - } - - @Override - public ImportSummary importMetaData( String userUid, MetaData metaData, ImportOptions importOptions ) - { - return importMetaData( userUid, metaData, importOptions, null ); - } - - @Override - public ImportSummary importMetaData( String userUid, MetaData metaData, ImportOptions importOptions, TaskId taskId ) + public ImportSummary importMetaData( String userUid, Metadata metadata, TaskId taskId ) + { + return importMetaData( userUid, metadata, ImportOptions.getDefaultImportOptions(), taskId ); + } + + @Override + public ImportSummary importMetaData( String userUid, Metadata metadata ) + { + return importMetaData( userUid, metadata, ImportOptions.getDefaultImportOptions() ); + } + + @Override + public ImportSummary importMetaData( String userUid, Metadata metadata, ImportOptions importOptions ) + { + return importMetaData( userUid, metadata, importOptions, null ); + } + + @Override + public ImportSummary importMetaData( String userUid, Metadata metadata, ImportOptions importOptions, TaskId taskId ) { User user = userService.getUser( userUid ); String username = user != null ? user.getUsername() : null; @@ -152,7 +152,7 @@ for ( Schema schema : schemaService.getMetadataSchemas() ) { - Object value = ReflectionUtils.invokeGetterMethod( schema.getPlural(), metaData ); + Object value = ReflectionUtils.invokeGetterMethod( schema.getPlural(), metadata ); if ( value != null ) { === modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExportService.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExportService.java 2016-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExportService.java 2016-02-02 06:34:22 +0000 @@ -42,14 +42,14 @@ */ public interface ExportService { - MetaData getMetaData( Options options ); + Metadata getMetaData( Options options ); - MetaData getMetaData( Options options, TaskId taskId ); + Metadata getMetaData( Options options, TaskId taskId ); // @author Ovidiu Rosu - MetaData getFilteredMetaData( FilterOptions filterOptions ) throws IOException; + Metadata getFilteredMetaData( FilterOptions filterOptions ) throws IOException; - MetaData getFilteredMetaData( FilterOptions filterOptions, TaskId taskId ) throws IOException; + Metadata getFilteredMetaData( FilterOptions filterOptions, TaskId taskId ) throws IOException; List getFilters(); === modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportService.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportService.java 2016-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportService.java 2016-02-02 06:34:22 +0000 @@ -41,11 +41,11 @@ { ImportTypeSummary importObject( String userUid, T object, ImportOptions importOptions ); - ImportSummary importMetaData( String userUid, MetaData metaData ); - - ImportSummary importMetaData( String userUid, MetaData metaData, TaskId taskId ); - - ImportSummary importMetaData( String userUid, MetaData metaData, ImportOptions importOptions ); - - ImportSummary importMetaData( String userUid, MetaData metaData, ImportOptions importOptions, TaskId taskId ); + ImportSummary importMetaData( String userUid, Metadata metadata ); + + ImportSummary importMetaData( String userUid, Metadata metadata, TaskId taskId ); + + ImportSummary importMetaData( String userUid, Metadata metadata, ImportOptions importOptions ); + + ImportSummary importMetaData( String userUid, Metadata metadata, ImportOptions importOptions, TaskId taskId ); } === removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java' --- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java 2016-01-04 02:27:49 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java 1970-01-01 00:00:00 +0000 @@ -1,1246 +0,0 @@ -package org.hisp.dhis.dxf2.metadata; - -/* - * 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 com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import com.google.common.collect.Lists; -import org.hisp.dhis.attribute.Attribute; -import org.hisp.dhis.chart.Chart; -import org.hisp.dhis.color.Color; -import org.hisp.dhis.color.ColorSet; -import org.hisp.dhis.common.DimensionalObject; -import org.hisp.dhis.common.DxfNamespaces; -import org.hisp.dhis.common.NameableObject; -import org.hisp.dhis.common.filter.MetaDataFilter; -import org.hisp.dhis.constant.Constant; -import org.hisp.dhis.dashboard.Dashboard; -import org.hisp.dhis.dashboard.DashboardItem; -import org.hisp.dhis.dataapproval.DataApprovalLevel; -import org.hisp.dhis.dataapproval.DataApprovalWorkflow; -import org.hisp.dhis.dataelement.CategoryOptionGroup; -import org.hisp.dhis.dataelement.CategoryOptionGroupSet; -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.dataelement.DataElementCategory; -import org.hisp.dhis.dataelement.DataElementCategoryCombo; -import org.hisp.dhis.dataelement.DataElementCategoryOption; -import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; -import org.hisp.dhis.dataelement.DataElementGroup; -import org.hisp.dhis.dataelement.DataElementGroupSet; -import org.hisp.dhis.dataelement.DataElementOperand; -import org.hisp.dhis.dataset.DataSet; -import org.hisp.dhis.dataset.Section; -import org.hisp.dhis.document.Document; -import org.hisp.dhis.dxf2.events.event.Event; -import org.hisp.dhis.eventchart.EventChart; -import org.hisp.dhis.eventreport.EventReport; -import org.hisp.dhis.indicator.Indicator; -import org.hisp.dhis.indicator.IndicatorGroup; -import org.hisp.dhis.indicator.IndicatorGroupSet; -import org.hisp.dhis.indicator.IndicatorType; -import org.hisp.dhis.interpretation.Interpretation; -import org.hisp.dhis.legend.Legend; -import org.hisp.dhis.legend.LegendSet; -import org.hisp.dhis.mapping.Map; -import org.hisp.dhis.mapping.MapLayer; -import org.hisp.dhis.mapping.MapView; -import org.hisp.dhis.message.MessageConversation; -import org.hisp.dhis.option.Option; -import org.hisp.dhis.option.OptionSet; -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.organisationunit.OrganisationUnitGroup; -import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet; -import org.hisp.dhis.organisationunit.OrganisationUnitLevel; -import org.hisp.dhis.program.Program; -import org.hisp.dhis.program.ProgramIndicator; -import org.hisp.dhis.program.ProgramStage; -import org.hisp.dhis.program.ProgramStageDataElement; -import org.hisp.dhis.program.ProgramStageSection; -import org.hisp.dhis.program.ProgramTrackedEntityAttribute; -import org.hisp.dhis.program.ProgramValidation; -import org.hisp.dhis.programrule.ProgramRule; -import org.hisp.dhis.programrule.ProgramRuleAction; -import org.hisp.dhis.programrule.ProgramRuleVariable; -import org.hisp.dhis.relationship.RelationshipType; -import org.hisp.dhis.report.Report; -import org.hisp.dhis.reporttable.ReportTable; -import org.hisp.dhis.schema.Schema; -import org.hisp.dhis.sqlview.SqlView; -import org.hisp.dhis.trackedentity.TrackedEntity; -import org.hisp.dhis.trackedentity.TrackedEntityAttribute; -import org.hisp.dhis.trackedentity.TrackedEntityAttributeGroup; -import org.hisp.dhis.translation.Translation; -import org.hisp.dhis.user.User; -import org.hisp.dhis.user.UserAuthorityGroup; -import org.hisp.dhis.user.UserGroup; -import org.hisp.dhis.validation.ValidationCriteria; -import org.hisp.dhis.validation.ValidationRule; -import org.hisp.dhis.validation.ValidationRuleGroup; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * @author Morten Olav Hansen - */ -@JacksonXmlRootElement( localName = "metaData", namespace = DxfNamespaces.DXF_2_0 ) -public class MetaData -{ - private Date created; - - private List schemas = Lists.newArrayList(); - - private List attributes = new ArrayList<>(); - - private List dataApprovalLevels = new ArrayList<>(); - - private List dataApprovalWorkflows = new ArrayList<>(); - - private List documents = new ArrayList<>(); - - private List constants = new ArrayList<>(); - - private List users = new ArrayList<>(); - - private List userRoles = new ArrayList<>(); - - private List userGroups = new ArrayList<>(); - - private List messageConversations = new ArrayList<>(); - - private List interpretations = new ArrayList<>(); - - private List