dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16045
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5981: Removed unused classses
------------------------------------------------------------
revno: 5981
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-02-16 11:39:28 +0100
message:
Removed unused classses
removed:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/CategoryOptionCombo.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/DataElement.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/DataSet.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/DataSetLinks.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/Dxf.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/Link.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/OrgUnit.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/OrgUnitLinks.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/DataSetMapper.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilder.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilderImpl.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/OrgUnitMapper.java
dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf2/service/DataSetMappingTest.java
modified:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/StaXDataValueImportService.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-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/CategoryOptionCombo.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/CategoryOptionCombo.java 2011-09-12 09:13:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/CategoryOptionCombo.java 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.model;
-
-public class CategoryOptionCombo
- extends Link
-{
-}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/DataElement.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/DataElement.java 2011-09-12 09:13:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/DataElement.java 1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.model;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-
-public class DataElement extends Link
-{
- @XmlAttribute
- private String type;
-
- @XmlElementWrapper(name="categoryOptionCombos")
- @XmlElement(name="categoryOptionCombo")
- private List<CategoryOptionCombo> categoryOptionCombos;
-
- public String getType()
- {
- return type;
- }
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- public List<CategoryOptionCombo> getCategoryOptionCombos()
- {
- return categoryOptionCombos;
- }
-
- public void setCategoryOptionCombos( List<CategoryOptionCombo> categoryOptionCombos )
- {
- this.categoryOptionCombos = categoryOptionCombos;
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/DataSet.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/DataSet.java 2011-09-12 09:13:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/DataSet.java 1970-01-01 00:00:00 +0000
@@ -1,109 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.model;
-
-/*
- * Copyright (c) 2011, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-@XmlAccessorType( XmlAccessType.FIELD )
-public class DataSet extends Link
-{
- @XmlAttribute
- private String shortName;
-
- @XmlAttribute
- private String code;
-
- @XmlAttribute
- private String periodType;
-
- @XmlElementWrapper(name="dataElements")
- @XmlElement(name="dataElement")
- private List<DataElement> dataElements;
-
- @XmlElementWrapper(name="orgUnits")
- @XmlElement(name="orgUnit")
- private List<Link> orgUnitLinks;
-
- public String getShortName()
- {
- return shortName;
- }
-
- public void setShortName( String shortName )
- {
- this.shortName = shortName;
- }
-
- public String getCode()
- {
- return code;
- }
-
- public void setCode( String code )
- {
- this.code = code;
- }
-
- public String getPeriodType()
- {
- return periodType;
- }
-
- public void setPeriodType( String periodType )
- {
- this.periodType = periodType;
- }
-
- public List<DataElement> getDataElements()
- {
- return dataElements;
- }
-
- public void setDataElements( List<DataElement> dataElements )
- {
- this.dataElements = dataElements;
- }
-
- public List<Link> getOrgUnitLinks()
- {
- return orgUnitLinks;
- }
-
- public void setOrgUnitLinks( List<Link> orgUnitLinks )
- {
- this.orgUnitLinks = orgUnitLinks;
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/DataSetLinks.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/DataSetLinks.java 2011-09-12 09:13:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/DataSetLinks.java 1970-01-01 00:00:00 +0000
@@ -1,30 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.model;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class DataSetLinks
-{
- private List<Link> dataSet;
-
- public DataSetLinks()
- {
- }
-
- public DataSetLinks( List<Link> dataSet )
- {
- this.dataSet = dataSet;
- }
-
- public List<Link> getDataSet()
- {
- return dataSet;
- }
-
- public void setDataSet( List<Link> dataSet )
- {
- this.dataSet = dataSet;
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/Dxf.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/Dxf.java 2011-09-12 09:13:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/Dxf.java 1970-01-01 00:00:00 +0000
@@ -1,101 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.model;
-
-/*
- * Copyright (c) 2011, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-@XmlAccessorType( XmlAccessType.FIELD )
-public class Dxf
-{
- // ---------------------------------------------------------------------------
- // Element and attribute names
- // ---------------------------------------------------------------------------
-
- public static final String NAMESPACE_20 = "http://dhis2.org/schema/dxf/2.0";
-
- public static final String DXFROOT = "dxf";
-
- public static final String ATTRIBUTE_MINOR_VERSION = "minorVersion";
-
- public static final String ATTRIBUTE_EXPORTED = "exported";
-
- public static final String DATAVALUESETS = "dataValueSets";
-
- public static final String DATAVALUESET = "dataValueSet";
-
- public static final String MINOR_VERSION_10 = "1.0";
-
- @XmlElementWrapper( name="dataSets" )
- @XmlElement( name="dataSet" )
- private List<DataSet> dataSets;
-
- @XmlElementWrapper( name=DATAVALUESETS )
- @XmlElement( name="dataValueSet" )
- private List<DataValueSet> dataValueSets;
-
- @XmlElementWrapper( name="orgUnits" )
- @XmlElement( name="orgUnit" )
- private List<OrgUnit> orgUnits;
-
- public void setDataValueSets( List<DataValueSet> dataValueSets )
- {
- this.dataValueSets = dataValueSets;
- }
-
- public List<DataValueSet> getDataValueSets()
- {
- return dataValueSets;
- }
-
- public List<DataSet> getDataSets()
- {
- return dataSets;
- }
-
- public void setDataSets( List<DataSet> dataSets )
- {
- this.dataSets = dataSets;
- }
-
- public List<OrgUnit> getOrgUnits()
- {
- return orgUnits;
- }
-
- public void setOrgUnits( List<OrgUnit> orgUnits )
- {
- this.orgUnits = orgUnits;
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/Link.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/Link.java 2011-09-12 09:27:29 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/Link.java 1970-01-01 00:00:00 +0000
@@ -1,54 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.model;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-
-@XmlAccessorType( XmlAccessType.FIELD )
-public class Link
-{
- @XmlAttribute( name = "id", required = true )
- private String id;
-
- @XmlAttribute
- private String href;
-
- @XmlAttribute
- private String name;
-
- public String getId()
- {
- return id;
- }
-
- public void setId( String id )
- {
- this.id = id;
- }
-
- public String getHref()
- {
- return href;
- }
-
- public void setHref( String href )
- {
- this.href = href;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- @Override
- public String toString()
- {
- return "[id: " + id + ", href: " + href + ", name: " + name + "]";
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/OrgUnit.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/OrgUnit.java 2011-09-12 09:13:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/OrgUnit.java 1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.model;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class OrgUnit extends Link
-{
- private Link parent;
-
- @XmlElementWrapper(name="children")
- @XmlElement(name="orgUnit")
- private List<Link> children;
-
- @XmlElementWrapper(name="dataSets")
- @XmlElement(name="dataSet")
- private List<Link> dataSets;
-
- public List<Link> getDataSets()
- {
- return dataSets;
- }
-
- public void setDataSets( List<Link> dataSets )
- {
- this.dataSets = dataSets;
- }
-
- public List<Link> getChildren()
- {
- return children;
- }
-
- public void setChildren( List<Link> children )
- {
- this.children = children;
- }
-
- public Link getParent()
- {
- return parent;
- }
-
- public void setParent( Link parent )
- {
- this.parent = parent;
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/OrgUnitLinks.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/OrgUnitLinks.java 2011-09-12 09:13:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/model/OrgUnitLinks.java 1970-01-01 00:00:00 +0000
@@ -1,30 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.model;
-
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class OrgUnitLinks
-{
- private List<Link> orgUnit;
-
- public OrgUnitLinks()
- {
- }
-
- public OrgUnitLinks( List<Link> orgUnit )
- {
- this.orgUnit = orgUnit;
- }
-
- public List<Link> getOrgUnit()
- {
- return orgUnit;
- }
-
- public void setOrgUnit( List<Link> orgUnit )
- {
- this.orgUnit = orgUnit;
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/DataSetMapper.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/DataSetMapper.java 2011-11-22 15:48:30 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/DataSetMapper.java 1970-01-01 00:00:00 +0000
@@ -1,77 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.service;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.importexport.dxf2.model.CategoryOptionCombo;
-import org.hisp.dhis.importexport.dxf2.model.DataElement;
-import org.hisp.dhis.importexport.dxf2.model.DataSet;
-
-public class DataSetMapper
-{
- private LinkBuilder linkBuilder = new LinkBuilderImpl();
-
- public DataSet convert( org.hisp.dhis.dataset.DataSet dataSet )
- {
- DataSet dxfDataSet = new DataSet();
-
- dxfDataSet.setCode( dataSet.getCode() );
- dxfDataSet.setName( dataSet.getName() );
- dxfDataSet.setPeriodType( dataSet.getPeriodType().getName() );
- dxfDataSet.setShortName( dataSet.getShortName() );
- dxfDataSet.setId( dataSet.getUid() );
-
- dxfDataSet.setDataElements( getDataElements( dataSet.getDataElements() ) );
- dxfDataSet.setOrgUnitLinks( linkBuilder.getLinks( dataSet.getSources() ) );
-
- return dxfDataSet;
- }
-
- private List<DataElement> getDataElements( Collection<org.hisp.dhis.dataelement.DataElement> dataElements )
- {
- List<DataElement> dxfElements = new ArrayList<DataElement>();
-
- for ( org.hisp.dhis.dataelement.DataElement dataElement : dataElements )
- {
- dxfElements.add( getDataElement( dataElement ) );
- }
- return dxfElements;
- }
-
- private DataElement getDataElement( org.hisp.dhis.dataelement.DataElement dataElement )
- {
- DataElement dxfElement = new DataElement();
-
- dxfElement.setId( dataElement.getUid() );
- dxfElement.setName( dataElement.getName() );
- dxfElement.setType( dataElement.getType() );
-
- Set<DataElementCategoryOptionCombo> optionCombos = dataElement.getCategoryCombo().getOptionCombos();
-
- if ( optionCombos.size() > 1 )
- {
- List<CategoryOptionCombo> categoryOptionCombos = getOptionCombos( optionCombos );
-
- dxfElement.setCategoryOptionCombos( categoryOptionCombos );
- }
-
- return dxfElement;
- }
-
- private List<CategoryOptionCombo> getOptionCombos( Set<DataElementCategoryOptionCombo> optionCombos )
- {
- List<CategoryOptionCombo> dxfCombos = new ArrayList<CategoryOptionCombo>();
- for ( DataElementCategoryOptionCombo optionCombo : optionCombos )
- {
- CategoryOptionCombo dxfCombo = new CategoryOptionCombo();
- dxfCombo.setId( optionCombo.getUid() );
- dxfCombo.setName( optionCombo.getName() );
- dxfCombos.add( dxfCombo );
- }
-
- return dxfCombos;
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilder.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilder.java 2011-11-24 14:36:19 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilder.java 1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.service;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.importexport.dxf2.model.Link;
-
-public interface LinkBuilder
-{
- public List<Link> getLinks( Collection<? extends BaseIdentifiableObject> targets );
-
- public Link get( BaseIdentifiableObject target );
-}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilderImpl.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilderImpl.java 2011-11-25 11:00:15 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/LinkBuilderImpl.java 1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.service;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.hisp.dhis.common.BaseIdentifiableObject;
-import org.hisp.dhis.importexport.dxf2.model.Link;
-
-public class LinkBuilderImpl implements LinkBuilder
-{
- public List<Link> getLinks( Collection<? extends BaseIdentifiableObject> targets )
- {
- List<Link> links = new ArrayList<Link>();
-
- for ( BaseIdentifiableObject target : targets )
- {
- links.add( get( target ) );
- }
- return links;
- }
-
- public Link get( BaseIdentifiableObject target )
- {
- Link link = new Link();
-
- link.setName( target.getName() );
- link.setId( target.getUid() );
-
- return link;
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/OrgUnitMapper.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/OrgUnitMapper.java 2011-11-22 15:48:30 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/OrgUnitMapper.java 1970-01-01 00:00:00 +0000
@@ -1,31 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.service;
-
-import java.util.Set;
-
-import org.hisp.dhis.importexport.dxf2.model.OrgUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-
-public class OrgUnitMapper
-{
- private LinkBuilder linkBuilder = new LinkBuilderImpl();
-
- public OrgUnit get( OrganisationUnit unit )
- {
- OrgUnit dxfUnit = new OrgUnit();
-
- dxfUnit.setName( unit.getName() );
- dxfUnit.setId( unit.getUid() );
-
- OrganisationUnit parent = unit.getParent();
- if ( parent != null )
- dxfUnit.setParent( linkBuilder.get( parent ) );
-
- Set<OrganisationUnit> children = unit.getChildren();
- if ( children != null && !children.isEmpty() )
- dxfUnit.setChildren( linkBuilder.getLinks( children ) );
-
- dxfUnit.setDataSets( linkBuilder.getLinks( unit.getDataSets() ) );
-
- return dxfUnit;
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/StaXDataValueImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/StaXDataValueImportService.java 2012-01-06 09:42:17 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/StaXDataValueImportService.java 2012-02-16 10:39:28 +0000
@@ -52,7 +52,6 @@
import org.hisp.dhis.importexport.ImportException;
import org.hisp.dhis.importexport.ImportParams;
import org.hisp.dhis.importexport.dxf2.model.DataValueSet;
-import org.hisp.dhis.importexport.dxf2.model.Dxf;
import org.hisp.dhis.importexport.importer.DataValueImporter;
import org.hisp.dhis.jdbc.batchhandler.DataValueBatchHandler;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -96,6 +95,20 @@
public static final int DISPLAYCOUNT = 1000;
+ public static final String NAMESPACE_20 = "http://dhis2.org/schema/dxf/2.0";
+
+ public static final String DXFROOT = "dxf";
+
+ public static final String ATTRIBUTE_MINOR_VERSION = "minorVersion";
+
+ public static final String ATTRIBUTE_EXPORTED = "exported";
+
+ public static final String DATAVALUESETS = "dataValueSets";
+
+ public static final String DATAVALUESET = "dataValueSet";
+
+ public static final String MINOR_VERSION_10 = "1.0";
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -170,25 +183,25 @@
try
{
- if ( !reader.moveToStartElement( Dxf.DXFROOT, Dxf.DXFROOT ) )
+ if ( !reader.moveToStartElement( DXFROOT, DXFROOT ) )
{
throw new ImportException( NO_ROOT );
}
QName rootName = reader.getElementQName();
- params.setNamespace( defaultIfEmpty( rootName.getNamespaceURI(), Dxf.NAMESPACE_20 ) );
- String version = reader.getAttributeValue( Dxf.ATTRIBUTE_MINOR_VERSION );
- params.setMinorVersion( version != null ? version : Dxf.MINOR_VERSION_10 );
+ params.setNamespace( defaultIfEmpty( rootName.getNamespaceURI(), NAMESPACE_20 ) );
+ String version = reader.getAttributeValue( ATTRIBUTE_MINOR_VERSION );
+ params.setMinorVersion( version != null ? version : MINOR_VERSION_10 );
log.debug( String.format( "Importing %s minor version %s", rootName.getNamespaceURI(), version ) );
// move straight to the DataValue sets, we are not looking for metadata
- reader.moveToStartElement( Dxf.DATAVALUESETS );
+ reader.moveToStartElement( DATAVALUESETS );
Date timestamp = new Date();
- if ( !reader.isStartElement( Dxf.DATAVALUESETS ) )
+ if ( !reader.isStartElement( DATAVALUESETS ) )
{
throw new ImportException( NO_DATAVALUESETS );
}
@@ -199,11 +212,11 @@
do
{
// look for a DataValue set
- if ( !reader.isStartElement( Dxf.DATAVALUESET ) )
+ if ( !reader.isStartElement( DATAVALUESET ) )
{
try
{
- reader.moveToStartElement( Dxf.DATAVALUESET );
+ reader.moveToStartElement( DATAVALUESET );
}
catch ( java.util.NoSuchElementException ex )
{
=== removed file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf2/service/DataSetMappingTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf2/service/DataSetMappingTest.java 2011-02-25 04:16:18 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf2/service/DataSetMappingTest.java 1970-01-01 00:00:00 +0000
@@ -1,111 +0,0 @@
-package org.hisp.dhis.importexport.dxf2.service;
-
-/*
- * Copyright (c) 2011, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-
-import org.hisp.dhis.DhisTest;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.importexport.ImportException;
-import org.hisp.dhis.importexport.ImportParams;
-import org.hisp.dhis.importexport.ImportService;
-import org.hisp.dhis.importexport.ImportStrategy;
-import org.hisp.dhis.importexport.dxf2.model.DataSet;
-import org.hisp.dhis.importexport.util.ImportExportUtils;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * Stub test class...
- */
-public class DataSetMappingTest
- extends DhisTest
-{
-
- private static final String DATA_SET_UUID = "16B2299E-ECD6-46CF-A61F-817D350C180D";
-
- private ImportService importService;
-
- // -------------------------------------------------------------------------
- // Fixture
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest()
- throws JAXBException, IOException, ImportException
- {
- importService = (ImportService) getBean( "org.hisp.dhis.importexport.ImportService" );
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
- dataElementService = (DataElementService) getBean( DataElementService.ID );
- dataSetService = (DataSetService) getBean( DataSetService.ID );
- dataValueService = (DataValueService) getBean( DataValueService.ID );
-
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-
- InputStream is = classLoader.getResourceAsStream( "dxf2/base.xml" );
- ImportParams importParams = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false,
- false );
- importService.importData( importParams, is );
- is.close();
-
- }
-
- // -------------------------------------------------------------------------
- // Tests
- // -------------------------------------------------------------------------
-
- @Test @Ignore
- public void testJaxb()
- throws JAXBException, IOException
- {
- JAXBContext jc = JAXBContext.newInstance( DataSet.class );
- Marshaller u = jc.createMarshaller();
-
- StringWriter writer = new StringWriter();
- org.hisp.dhis.dataset.DataSet dataSet = dataSetService.getDataSet( DATA_SET_UUID );
- DataSet dxfDataSet = new DataSetMapper().convert( dataSet );
- u.marshal( dxfDataSet, writer );
-
- System.out.println( writer.toString() );
- }
-
- @Override
- protected boolean emptyDatabaseAfterTest()
- {
- return true;
- }
-}