dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #16772
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6464: minor changes
------------------------------------------------------------
revno: 6464
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-04-02 19:23:48 +0200
message:
minor changes
added:
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/IdScheme.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportOptions.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportService.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportStrategy.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportConflict.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportSummary.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DXF2.java
dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.java
dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.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
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2012-03-27 17:38:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java 2012-04-02 17:23:48 +0000
@@ -114,7 +114,7 @@
@JsonProperty( value = "internalId" )
@JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
- @JacksonXmlProperty( isAttribute = true, namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( isAttribute = true )
public int getId()
{
return id;
@@ -126,7 +126,7 @@
}
@JsonProperty( value = "id" )
- @JacksonXmlProperty( isAttribute = true, namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( isAttribute = true )
public String getUid()
{
return uid;
@@ -139,7 +139,7 @@
@JsonProperty
@JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
- @JacksonXmlProperty( isAttribute = true, namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( isAttribute = true )
public String getCode()
{
return code;
@@ -152,7 +152,7 @@
@JsonProperty
@JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
- @JacksonXmlProperty( isAttribute = true, namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( isAttribute = true )
public String getName()
{
return name;
@@ -165,7 +165,7 @@
@JsonProperty
@JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
- @JacksonXmlProperty( isAttribute = true, namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( isAttribute = true )
public Date getLastUpdated()
{
return lastUpdated;
@@ -229,10 +229,10 @@
* @param objects the NameableObjects to put in the map
* @return the map
*/
- public static Map<String, Integer> getCodeMap( Collection<? extends BaseNameableObject> objects )
+ public static Map<String, Integer> getCodeMap( Collection<? extends BaseIdentifiableObject> objects )
{
Map<String, Integer> map = new HashMap<String, Integer>();
- for ( NameableObject object : objects )
+ for ( BaseIdentifiableObject object : objects )
{
String code = object.getCode();
int internalId = object.getId();
@@ -241,4 +241,36 @@
}
return map;
}
+
+ /**
+ * Get a map of names to internal identifiers
+ *
+ * @param objects the NameableObjects to put in the map
+ * @return the map
+ */
+ public static Map<String, Integer> getNameMap( Collection<? extends BaseIdentifiableObject> objects )
+ {
+ Map<String, Integer> map = new HashMap<String, Integer>();
+ for ( BaseIdentifiableObject object : objects )
+ {
+ String name = object.getName();
+ int internalId = object.getId();
+
+ map.put( name, internalId );
+ }
+ return map;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "IdentifiableObject{" +
+ "id=" + id +
+ ", uid='" + uid + '\'' +
+ ", code='" + code + '\'' +
+ ", name='" + name + '\'' +
+ ", lastUpdated=" + lastUpdated +
+ ", displayName='" + displayName + '\'' +
+ '}';
+ }
}
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2012-04-01 12:17:55 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2012-04-02 17:23:48 +0000
@@ -187,19 +187,19 @@
if ( dataElement == null )
{
- summary.getNoneExistingIdentifiers().add( new ImportConflict( DataElement.class.getSimpleName(), dataValue.getDataElement() ) );
+ summary.getConflicts().add( new ImportConflict( DataElement.class.getSimpleName(), dataValue.getDataElement() ) );
continue;
}
if ( period == null )
{
- summary.getNoneExistingIdentifiers().add( new ImportConflict( Period.class.getSimpleName(), dataValue.getPeriod() ) );
+ summary.getConflicts().add( new ImportConflict( Period.class.getSimpleName(), dataValue.getPeriod() ) );
continue;
}
if ( orgUnit == null )
{
- summary.getNoneExistingIdentifiers().add( new ImportConflict( OrganisationUnit.class.getSimpleName(), dataValue.getOrgUnit() ) );
+ summary.getConflicts().add( new ImportConflict( OrganisationUnit.class.getSimpleName(), dataValue.getOrgUnit() ) );
continue;
}
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportConflict.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportConflict.java 2012-03-29 09:59:05 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportConflict.java 2012-04-02 17:23:48 +0000
@@ -35,7 +35,7 @@
public class ImportConflict
{
private String object;
-
+
private String value;
public ImportConflict( String object, String value )
@@ -43,9 +43,9 @@
this.object = object;
this.value = value;
}
-
+
@JsonProperty
- @JacksonXmlProperty( isAttribute=true )
+ @JacksonXmlProperty( isAttribute = true )
public String getObject()
{
return object;
@@ -57,7 +57,7 @@
}
@JsonProperty
- @JacksonXmlProperty( isAttribute=true )
+ @JacksonXmlProperty( isAttribute = true )
public String getValue()
{
return value;
@@ -67,4 +67,13 @@
{
this.value = value;
}
+
+ @Override
+ public String toString()
+ {
+ return "ImportConflict{" +
+ "object='" + object + '\'' +
+ ", value='" + value + '\'' +
+ '}';
+ }
}
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java 2012-03-29 12:02:12 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java 2012-04-02 17:23:48 +0000
@@ -35,11 +35,11 @@
public class ImportCount
{
private String object;
-
+
private int imports;
-
+
private int updates;
-
+
private int ignores;
public ImportCount( String object, int imports, int updates, int ignores )
@@ -49,9 +49,9 @@
this.updates = updates;
this.ignores = ignores;
}
-
+
@JsonProperty
- @JacksonXmlProperty( isAttribute=true )
+ @JacksonXmlProperty( isAttribute = true )
public String getObject()
{
return object;
@@ -63,7 +63,7 @@
}
@JsonProperty
- @JacksonXmlProperty( isAttribute=true )
+ @JacksonXmlProperty( isAttribute = true )
public int getImports()
{
return imports;
@@ -75,7 +75,7 @@
}
@JsonProperty
- @JacksonXmlProperty( isAttribute=true )
+ @JacksonXmlProperty( isAttribute = true )
public int getUpdates()
{
return updates;
@@ -87,7 +87,7 @@
}
@JsonProperty
- @JacksonXmlProperty( isAttribute=true )
+ @JacksonXmlProperty( isAttribute = true )
public int getIgnores()
{
return ignores;
@@ -96,5 +96,16 @@
public void setIgnores( int ignores )
{
this.ignores = ignores;
- }
+ }
+
+ @Override
+ public String toString()
+ {
+ return "ImportCount{" +
+ "object='" + object + '\'' +
+ ", imports=" + imports +
+ ", updates=" + updates +
+ ", ignores=" + ignores +
+ '}';
+ }
}
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportSummary.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportSummary.java 2012-03-29 16:45:18 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportSummary.java 2012-04-02 17:23:48 +0000
@@ -27,27 +27,27 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-import java.util.List;
-
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 java.util.ArrayList;
+import java.util.List;
+
@JacksonXmlRootElement( localName = "importSummary" )
public class ImportSummary
{
private List<ImportCount> counts = new ArrayList<ImportCount>();
- private List<ImportConflict> noneExistingIdentifiers = new ArrayList<ImportConflict>();
-
+ private List<ImportConflict> conflicts = new ArrayList<ImportConflict>();
+
private String dataSetComplete;
-
+
public void increaseImportCount( Class<?> clazz )
{
}
-
+
@JsonProperty
@JacksonXmlElementWrapper
@JacksonXmlProperty
@@ -64,14 +64,14 @@
@JsonProperty
@JacksonXmlElementWrapper
@JacksonXmlProperty
- public List<ImportConflict> getNoneExistingIdentifiers()
+ public List<ImportConflict> getConflicts()
{
- return noneExistingIdentifiers;
+ return conflicts;
}
- public void setNoneExistingIdentifiers( List<ImportConflict> noneExistingIdentifiers )
+ public void setConflicts( List<ImportConflict> conflicts )
{
- this.noneExistingIdentifiers = noneExistingIdentifiers;
+ this.conflicts = conflicts;
}
@JsonProperty
@@ -85,4 +85,14 @@
{
this.dataSetComplete = dataSetComplete;
}
+
+ @Override
+ public String toString()
+ {
+ return "ImportSummary{" +
+ "counts=" + counts +
+ ", noneExistingIdentifiers=" + conflicts +
+ ", dataSetComplete='" + dataSetComplete + '\'' +
+ '}';
+ }
}
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DXF2.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DXF2.java 2012-03-30 10:53:18 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DXF2.java 2012-04-02 17:23:48 +0000
@@ -63,8 +63,8 @@
import org.hisp.dhis.validation.ValidationRule;
import org.hisp.dhis.validation.ValidationRuleGroup;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -72,547 +72,590 @@
@JacksonXmlRootElement( localName = "dxf2", namespace = Dxf2Namespace.NAMESPACE )
public class DXF2
{
- private List<Attribute> attributeTypes = new ArrayList<Attribute>();
-
- private List<User> users = new ArrayList<User>();
-
- private List<UserAuthorityGroup> userAuthorityGroups = new ArrayList<UserAuthorityGroup>();
-
- private List<UserGroup> userGroups = new ArrayList<UserGroup>();
-
- private List<MessageConversation> messageConversations = new ArrayList<MessageConversation>();
-
- private List<DataElement> dataElements = new ArrayList<DataElement>();
-
- private List<OptionSet> optionSets = new ArrayList<OptionSet>();
-
- private List<DataElementGroup> dataElementGroups = new ArrayList<DataElementGroup>();
-
- private List<DataElementGroupSet> dataElementGroupSets = new ArrayList<DataElementGroupSet>();
-
- private List<Concept> concepts = new ArrayList<Concept>();
-
- private List<DataElementCategory> categories = new ArrayList<DataElementCategory>();
-
- private List<DataElementCategoryOption> categoryOptions = new ArrayList<DataElementCategoryOption>();
-
- private List<DataElementCategoryCombo> categoryCombos = new ArrayList<DataElementCategoryCombo>();
-
- private List<DataElementCategoryOptionCombo> categoryOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
-
- private List<Indicator> indicators = new ArrayList<Indicator>();
-
- private List<IndicatorGroup> indicatorGroups = new ArrayList<IndicatorGroup>();
-
- private List<IndicatorGroupSet> indicatorGroupSets = new ArrayList<IndicatorGroupSet>();
-
- private List<IndicatorType> indicatorTypes = new ArrayList<IndicatorType>();
-
- private List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
-
- private List<OrganisationUnitGroup> organisationUnitGroups = new ArrayList<OrganisationUnitGroup>();
-
- private List<OrganisationUnitGroupSet> organisationUnitGroupSets = new ArrayList<OrganisationUnitGroupSet>();
-
- private List<OrganisationUnitLevel> organisationUnitLevels = new ArrayList<OrganisationUnitLevel>();
-
- private List<DataSet> dataSets = new ArrayList<DataSet>();
-
- private List<ValidationRule> validationRules = new ArrayList<ValidationRule>();
-
- private List<ValidationRuleGroup> validationRuleGroups = new ArrayList<ValidationRuleGroup>();
-
- private List<SqlView> sqlViews = new ArrayList<SqlView>();
-
- private List<Chart> charts = new ArrayList<Chart>();
-
- private List<Report> reports = new ArrayList<Report>();
-
- private List<ReportTable> reportTables = new ArrayList<ReportTable>();
-
- private List<Document> documents = new ArrayList<Document>();
-
- private List<Constant> constants = new ArrayList<Constant>();
-
- private List<MapView> maps = new ArrayList<MapView>();
-
- private List<MapLegend> mapLegends = new ArrayList<MapLegend>();
-
- private List<MapLegendSet> mapLegendSets = new ArrayList<MapLegendSet>();
-
- private List<MapLayer> mapLayers = new ArrayList<MapLayer>();
-
- private List<DataDictionary> dataDictionaries = new ArrayList<DataDictionary>();
+ private Set<Attribute> attributeTypes = new HashSet<Attribute>();
+
+ private Set<User> users = new HashSet<User>();
+
+ private Set<UserAuthorityGroup> userAuthorityGroups = new HashSet<UserAuthorityGroup>();
+
+ private Set<UserGroup> userGroups = new HashSet<UserGroup>();
+
+ private Set<MessageConversation> messageConversations = new HashSet<MessageConversation>();
+
+ private Set<DataElement> dataElements = new HashSet<DataElement>();
+
+ private Set<OptionSet> optionSets = new HashSet<OptionSet>();
+
+ private Set<DataElementGroup> dataElementGroups = new HashSet<DataElementGroup>();
+
+ private Set<DataElementGroupSet> dataElementGroupSets = new HashSet<DataElementGroupSet>();
+
+ private Set<Concept> concepts = new HashSet<Concept>();
+
+ private Set<DataElementCategory> categories = new HashSet<DataElementCategory>();
+
+ private Set<DataElementCategoryOption> categoryOptions = new HashSet<DataElementCategoryOption>();
+
+ private Set<DataElementCategoryCombo> categoryCombos = new HashSet<DataElementCategoryCombo>();
+
+ private Set<DataElementCategoryOptionCombo> categoryOptionCombos = new HashSet<DataElementCategoryOptionCombo>();
+
+ private Set<Indicator> indicators = new HashSet<Indicator>();
+
+ private Set<IndicatorGroup> indicatorGroups = new HashSet<IndicatorGroup>();
+
+ private Set<IndicatorGroupSet> indicatorGroupSets = new HashSet<IndicatorGroupSet>();
+
+ private Set<IndicatorType> indicatorTypes = new HashSet<IndicatorType>();
+
+ private Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
+
+ private Set<OrganisationUnitGroup> organisationUnitGroups = new HashSet<OrganisationUnitGroup>();
+
+ private Set<OrganisationUnitGroupSet> organisationUnitGroupSets = new HashSet<OrganisationUnitGroupSet>();
+
+ private Set<OrganisationUnitLevel> organisationUnitLevels = new HashSet<OrganisationUnitLevel>();
+
+ private Set<DataSet> dataSets = new HashSet<DataSet>();
+
+ private Set<ValidationRule> validationRules = new HashSet<ValidationRule>();
+
+ private Set<ValidationRuleGroup> validationRuleGroups = new HashSet<ValidationRuleGroup>();
+
+ private Set<SqlView> sqlViews = new HashSet<SqlView>();
+
+ private Set<Chart> charts = new HashSet<Chart>();
+
+ private Set<Report> reports = new HashSet<Report>();
+
+ private Set<ReportTable> reportTables = new HashSet<ReportTable>();
+
+ private Set<Document> documents = new HashSet<Document>();
+
+ private Set<Constant> constants = new HashSet<Constant>();
+
+ private Set<MapView> maps = new HashSet<MapView>();
+
+ private Set<MapLegend> mapLegends = new HashSet<MapLegend>();
+
+ private Set<MapLegendSet> mapLegendSets = new HashSet<MapLegendSet>();
+
+ private Set<MapLayer> mapLayers = new HashSet<MapLayer>();
+
+ private Set<DataDictionary> dataDictionaries = new HashSet<DataDictionary>();
public DXF2()
{
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "attributeTypes" )
- @JacksonXmlProperty( localName = "attributeType" )
- public List<Attribute> getAttributeTypes()
+ @JacksonXmlElementWrapper( localName = "attributeTypes", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "attributeType", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<Attribute> getAttributeTypes()
{
return attributeTypes;
}
- public void setAttributeTypes( List<Attribute> attributeTypes )
+ public void setAttributeTypes( Set<Attribute> attributeTypes )
{
this.attributeTypes = attributeTypes;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "users" )
- @JacksonXmlProperty( localName = "user" )
- public List<User> getUsers()
+ @JacksonXmlElementWrapper( localName = "users", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "user", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<User> getUsers()
{
return users;
}
- public void setUsers( List<User> users )
+ public void setUsers( Set<User> users )
{
this.users = users;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "userAuthorityGroups" )
- @JacksonXmlProperty( localName = "userAuthorityGroup" )
- public List<UserAuthorityGroup> getUserAuthorityGroups()
+ @JacksonXmlElementWrapper( localName = "userAuthorityGroups", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "userAuthorityGroup", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<UserAuthorityGroup> getUserAuthorityGroups()
{
return userAuthorityGroups;
}
- public void setUserAuthorityGroups( List<UserAuthorityGroup> userAuthorityGroups )
+ public void setUserAuthorityGroups( Set<UserAuthorityGroup> userAuthorityGroups )
{
this.userAuthorityGroups = userAuthorityGroups;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "userGroups" )
- @JacksonXmlProperty( localName = "userGroup" )
- public List<UserGroup> getUserGroups()
+ @JacksonXmlElementWrapper( localName = "userGroups", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "userGroup", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<UserGroup> getUserGroups()
{
return userGroups;
}
- public void setUserGroups( List<UserGroup> userGroups )
+ public void setUserGroups( Set<UserGroup> userGroups )
{
this.userGroups = userGroups;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "messageConversations" )
- @JacksonXmlProperty( localName = "messageConversation" )
- public List<MessageConversation> getMessageConversations()
+ @JacksonXmlElementWrapper( localName = "messageConversations", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "messageConversation", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<MessageConversation> getMessageConversations()
{
return messageConversations;
}
- public void setMessageConversations( List<MessageConversation> messageConversations )
+ public void setMessageConversations( Set<MessageConversation> messageConversations )
{
this.messageConversations = messageConversations;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "dataElements" )
- @JacksonXmlProperty( localName = "dataElement" )
- public List<DataElement> getDataElements()
+ @JacksonXmlElementWrapper( localName = "dataElements", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "dataElement", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<DataElement> getDataElements()
{
return dataElements;
}
- public void setDataElements( List<DataElement> dataElements )
+ public void setDataElements( Set<DataElement> dataElements )
{
this.dataElements = dataElements;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "optionSets" )
- @JacksonXmlProperty( localName = "optionSet" )
- public List<OptionSet> getOptionSets()
+ @JacksonXmlElementWrapper( localName = "optionSets", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "optionSet", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<OptionSet> getOptionSets()
{
return optionSets;
}
- public void setOptionSets( List<OptionSet> optionSets )
+ public void setOptionSets( Set<OptionSet> optionSets )
{
this.optionSets = optionSets;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "dataElementGroups" )
- @JacksonXmlProperty( localName = "dataElementGroup" )
- public List<DataElementGroup> getDataElementGroups()
+ @JacksonXmlElementWrapper( localName = "dataElementGroups", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "dataElementGroup", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<DataElementGroup> getDataElementGroups()
{
return dataElementGroups;
}
- public void setDataElementGroups( List<DataElementGroup> dataElementGroups )
+ public void setDataElementGroups( Set<DataElementGroup> dataElementGroups )
{
this.dataElementGroups = dataElementGroups;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "dataElementGroupSets" )
- @JacksonXmlProperty( localName = "dataElementGroupSet" )
- public List<DataElementGroupSet> getDataElementGroupSets()
+ @JacksonXmlElementWrapper( localName = "dataElementGroupSets", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "dataElementGroupSet", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<DataElementGroupSet> getDataElementGroupSets()
{
return dataElementGroupSets;
}
- public void setDataElementGroupSets( List<DataElementGroupSet> dataElementGroupSets )
+ public void setDataElementGroupSets( Set<DataElementGroupSet> dataElementGroupSets )
{
this.dataElementGroupSets = dataElementGroupSets;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "concepts" )
- @JacksonXmlProperty( localName = "concept" )
- public List<Concept> getConcepts()
+ @JacksonXmlElementWrapper( localName = "concepts", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "concept", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<Concept> getConcepts()
{
return concepts;
}
- public void setConcepts( List<Concept> concepts )
+ public void setConcepts( Set<Concept> concepts )
{
this.concepts = concepts;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "categories" )
- @JacksonXmlProperty( localName = "category" )
- public List<DataElementCategory> getCategories()
+ @JacksonXmlElementWrapper( localName = "categories", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "category", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<DataElementCategory> getCategories()
{
return categories;
}
- public void setCategories( List<DataElementCategory> categories )
+ public void setCategories( Set<DataElementCategory> categories )
{
this.categories = categories;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "categoryOptions" )
- @JacksonXmlProperty( localName = "categoryOption" )
- public List<DataElementCategoryOption> getCategoryOptions()
+ @JacksonXmlElementWrapper( localName = "categoryOptions", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "categoryOption", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<DataElementCategoryOption> getCategoryOptions()
{
return categoryOptions;
}
- public void setCategoryOptions( List<DataElementCategoryOption> categoryOptions )
+ public void setCategoryOptions( Set<DataElementCategoryOption> categoryOptions )
{
this.categoryOptions = categoryOptions;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "categoryCombos" )
- @JacksonXmlProperty( localName = "categoryCombo" )
- public List<DataElementCategoryCombo> getCategoryCombos()
+ @JacksonXmlElementWrapper( localName = "categoryCombos", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "categoryCombo", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<DataElementCategoryCombo> getCategoryCombos()
{
return categoryCombos;
}
- public void setCategoryCombos( List<DataElementCategoryCombo> categoryCombos )
+ public void setCategoryCombos( Set<DataElementCategoryCombo> categoryCombos )
{
this.categoryCombos = categoryCombos;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "categoryOptionCombos" )
- @JacksonXmlProperty( localName = "categoryOptionCombo" )
- public List<DataElementCategoryOptionCombo> getCategoryOptionCombos()
+ @JacksonXmlElementWrapper( localName = "categoryOptionCombos", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "categoryOptionCombo", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<DataElementCategoryOptionCombo> getCategoryOptionCombos()
{
return categoryOptionCombos;
}
- public void setCategoryOptionCombos( List<DataElementCategoryOptionCombo> categoryOptionCombos )
+ public void setCategoryOptionCombos( Set<DataElementCategoryOptionCombo> categoryOptionCombos )
{
this.categoryOptionCombos = categoryOptionCombos;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "indicators" )
- @JacksonXmlProperty( localName = "indicator" )
- public List<Indicator> getIndicators()
+ @JacksonXmlElementWrapper( localName = "indicators", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "indicator", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<Indicator> getIndicators()
{
return indicators;
}
- public void setIndicators( List<Indicator> indicators )
+ public void setIndicators( Set<Indicator> indicators )
{
this.indicators = indicators;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "indicatorGroups" )
- @JacksonXmlProperty( localName = "indicatorGroup" )
- public List<IndicatorGroup> getIndicatorGroups()
+ @JacksonXmlElementWrapper( localName = "indicatorGroups", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "indicatorGroup", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<IndicatorGroup> getIndicatorGroups()
{
return indicatorGroups;
}
- public void setIndicatorGroups( List<IndicatorGroup> indicatorGroups )
+ public void setIndicatorGroups( Set<IndicatorGroup> indicatorGroups )
{
this.indicatorGroups = indicatorGroups;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "indicatorGroupSets" )
- @JacksonXmlProperty( localName = "indicatorGroupSet" )
- public List<IndicatorGroupSet> getIndicatorGroupSets()
+ @JacksonXmlElementWrapper( localName = "indicatorGroupSets", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "indicatorGroupSet", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<IndicatorGroupSet> getIndicatorGroupSets()
{
return indicatorGroupSets;
}
- public void setIndicatorGroupSets( List<IndicatorGroupSet> indicatorGroupSets )
+ public void setIndicatorGroupSets( Set<IndicatorGroupSet> indicatorGroupSets )
{
this.indicatorGroupSets = indicatorGroupSets;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "indicatorTypes" )
- @JacksonXmlProperty( localName = "indicatorType" )
- public List<IndicatorType> getIndicatorTypes()
+ @JacksonXmlElementWrapper( localName = "indicatorTypes", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "indicatorType", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<IndicatorType> getIndicatorTypes()
{
return indicatorTypes;
}
- public void setIndicatorTypes( List<IndicatorType> indicatorTypes )
+ public void setIndicatorTypes( Set<IndicatorType> indicatorTypes )
{
this.indicatorTypes = indicatorTypes;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "organisationUnits" )
- @JacksonXmlProperty( localName = "organisationUnit" )
- public List<OrganisationUnit> getOrganisationUnits()
+ @JacksonXmlElementWrapper( localName = "organisationUnits", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "organisationUnit", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<OrganisationUnit> getOrganisationUnits()
{
return organisationUnits;
}
- public void setOrganisationUnits( List<OrganisationUnit> organisationUnits )
+ public void setOrganisationUnits( Set<OrganisationUnit> organisationUnits )
{
this.organisationUnits = organisationUnits;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "organisationUnitGroups" )
- @JacksonXmlProperty( localName = "organisationUnitGroup" )
- public List<OrganisationUnitGroup> getOrganisationUnitGroups()
+ @JacksonXmlElementWrapper( localName = "organisationUnitGroups", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "organisationUnitGroup", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<OrganisationUnitGroup> getOrganisationUnitGroups()
{
return organisationUnitGroups;
}
- public void setOrganisationUnitGroups( List<OrganisationUnitGroup> organisationUnitGroups )
+ public void setOrganisationUnitGroups( Set<OrganisationUnitGroup> organisationUnitGroups )
{
this.organisationUnitGroups = organisationUnitGroups;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "organisationUnitGroupSets" )
- @JacksonXmlProperty( localName = "organisationUnitGroupSet" )
- public List<OrganisationUnitGroupSet> getOrganisationUnitGroupSets()
+ @JacksonXmlElementWrapper( localName = "organisationUnitGroupSets", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "organisationUnitGroupSet", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<OrganisationUnitGroupSet> getOrganisationUnitGroupSets()
{
return organisationUnitGroupSets;
}
- public void setOrganisationUnitGroupSets( List<OrganisationUnitGroupSet> organisationUnitGroupSets )
+ public void setOrganisationUnitGroupSets( Set<OrganisationUnitGroupSet> organisationUnitGroupSets )
{
this.organisationUnitGroupSets = organisationUnitGroupSets;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "organisationUnitLevels" )
- @JacksonXmlProperty( localName = "organisationUnitLevel" )
- public List<OrganisationUnitLevel> getOrganisationUnitLevels()
+ @JacksonXmlElementWrapper( localName = "organisationUnitLevels", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "organisationUnitLevel", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<OrganisationUnitLevel> getOrganisationUnitLevels()
{
return organisationUnitLevels;
}
- public void setOrganisationUnitLevels( List<OrganisationUnitLevel> organisationUnitLevels )
+ public void setOrganisationUnitLevels( Set<OrganisationUnitLevel> organisationUnitLevels )
{
this.organisationUnitLevels = organisationUnitLevels;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "dataSets" )
- @JacksonXmlProperty( localName = "dataSet" )
- public List<DataSet> getDataSets()
+ @JacksonXmlElementWrapper( localName = "dataSets", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "dataSet", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<DataSet> getDataSets()
{
return dataSets;
}
- public void setDataSets( List<DataSet> dataSets )
+ public void setDataSets( Set<DataSet> dataSets )
{
this.dataSets = dataSets;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "validationRules" )
- @JacksonXmlProperty( localName = "validationRule" )
- public List<ValidationRule> getValidationRules()
+ @JacksonXmlElementWrapper( localName = "validationRules", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "validationRule", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<ValidationRule> getValidationRules()
{
return validationRules;
}
- public void setValidationRules( List<ValidationRule> validationRules )
+ public void setValidationRules( Set<ValidationRule> validationRules )
{
this.validationRules = validationRules;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "validationRuleGroups" )
- @JacksonXmlProperty( localName = "validationRuleGroup" )
- public List<ValidationRuleGroup> getValidationRuleGroups()
+ @JacksonXmlElementWrapper( localName = "validationRuleGroups", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "validationRuleGroup", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<ValidationRuleGroup> getValidationRuleGroups()
{
return validationRuleGroups;
}
- public void setValidationRuleGroups( List<ValidationRuleGroup> validationRuleGroups )
+ public void setValidationRuleGroups( Set<ValidationRuleGroup> validationRuleGroups )
{
this.validationRuleGroups = validationRuleGroups;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "sqlViews" )
- @JacksonXmlProperty( localName = "sqlView" )
- public List<SqlView> getSqlViews()
+ @JacksonXmlElementWrapper( localName = "sqlViews", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "sqlView", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<SqlView> getSqlViews()
{
return sqlViews;
}
- public void setSqlViews( List<SqlView> sqlViews )
+ public void setSqlViews( Set<SqlView> sqlViews )
{
this.sqlViews = sqlViews;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "charts" )
- @JacksonXmlProperty( localName = "chart" )
- public List<Chart> getCharts()
+ @JacksonXmlElementWrapper( localName = "charts", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "chart", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<Chart> getCharts()
{
return charts;
}
- public void setCharts( List<Chart> charts )
+ public void setCharts( Set<Chart> charts )
{
this.charts = charts;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "reports" )
- @JacksonXmlProperty( localName = "report" )
- public List<Report> getReports()
+ @JacksonXmlElementWrapper( localName = "reports", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "report", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<Report> getReports()
{
return reports;
}
- public void setReports( List<Report> reports )
+ public void setReports( Set<Report> reports )
{
this.reports = reports;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "reportTables" )
- @JacksonXmlProperty( localName = "reportTable" )
- public List<ReportTable> getReportTables()
+ @JacksonXmlElementWrapper( localName = "reportTables", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "reportTable", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<ReportTable> getReportTables()
{
return reportTables;
}
- public void setReportTables( List<ReportTable> reportTables )
+ public void setReportTables( Set<ReportTable> reportTables )
{
this.reportTables = reportTables;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "documents" )
- @JacksonXmlProperty( localName = "document" )
- public List<Document> getDocuments()
+ @JacksonXmlElementWrapper( localName = "documents", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "document", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<Document> getDocuments()
{
return documents;
}
- public void setDocuments( List<Document> documents )
+ public void setDocuments( Set<Document> documents )
{
this.documents = documents;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "constants" )
- @JacksonXmlProperty( localName = "constant" )
- public List<Constant> getConstants()
+ @JacksonXmlElementWrapper( localName = "constants", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "constant", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<Constant> getConstants()
{
return constants;
}
- public void setConstants( List<Constant> constants )
+ public void setConstants( Set<Constant> constants )
{
this.constants = constants;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "maps" )
- @JacksonXmlProperty( localName = "map" )
- public List<MapView> getMaps()
+ @JacksonXmlElementWrapper( localName = "maps", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "map", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<MapView> getMaps()
{
return maps;
}
- public void setMaps( List<MapView> maps )
+ public void setMaps( Set<MapView> maps )
{
this.maps = maps;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "mapLegends" )
- @JacksonXmlProperty( localName = "mapLegend" )
- public List<MapLegend> getMapLegends()
+ @JacksonXmlElementWrapper( localName = "mapLegends", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "mapLegend", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<MapLegend> getMapLegends()
{
return mapLegends;
}
- public void setMapLegends( List<MapLegend> mapLegends )
+ public void setMapLegends( Set<MapLegend> mapLegends )
{
this.mapLegends = mapLegends;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "mapLegendSets" )
- @JacksonXmlProperty( localName = "mapLegendSet" )
- public List<MapLegendSet> getMapLegendSets()
+ @JacksonXmlElementWrapper( localName = "mapLegendSets", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "mapLegendSet", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<MapLegendSet> getMapLegendSets()
{
return mapLegendSets;
}
- public void setMapLegendSets( List<MapLegendSet> mapLegendSets )
+ public void setMapLegendSets( Set<MapLegendSet> mapLegendSets )
{
this.mapLegendSets = mapLegendSets;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "mapLayers" )
- @JacksonXmlProperty( localName = "mapLayer" )
- public List<MapLayer> getMapLayers()
+ @JacksonXmlElementWrapper( localName = "mapLayers", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "mapLayer", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<MapLayer> getMapLayers()
{
return mapLayers;
}
- public void setMapLayers( List<MapLayer> mapLayers )
+ public void setMapLayers( Set<MapLayer> mapLayers )
{
this.mapLayers = mapLayers;
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "dataDictionaries" )
- @JacksonXmlProperty( localName = "dataDictionary" )
- public List<DataDictionary> getDataDictionaries()
+ @JacksonXmlElementWrapper( localName = "dataDictionaries", namespace = Dxf2Namespace.NAMESPACE )
+ @JacksonXmlProperty( localName = "dataDictionary", namespace = Dxf2Namespace.NAMESPACE )
+ public Set<DataDictionary> getDataDictionaries()
{
return dataDictionaries;
}
- public void setDataDictionaries( List<DataDictionary> dataDictionaries )
+ public void setDataDictionaries( Set<DataDictionary> dataDictionaries )
{
this.dataDictionaries = dataDictionaries;
}
+
+ @Override
+ public String toString()
+ {
+ return "DXF2{" +
+ "attributeTypes=" + attributeTypes.size() +
+ ", users=" + users.size() +
+ ", userAuthorityGroups=" + userAuthorityGroups.size() +
+ ", userGroups=" + userGroups.size() +
+ ", messageConversations=" + messageConversations.size() +
+ ", dataElements=" + dataElements.size() +
+ ", optionSets=" + optionSets.size() +
+ ", dataElementGroups=" + dataElementGroups.size() +
+ ", dataElementGroupSets=" + dataElementGroupSets.size() +
+ ", concepts=" + concepts.size() +
+ ", categories=" + categories.size() +
+ ", categoryOptions=" + categoryOptions.size() +
+ ", categoryCombos=" + categoryCombos.size() +
+ ", categoryOptionCombos=" + categoryOptionCombos.size() +
+ ", indicators=" + indicators.size() +
+ ", indicatorGroups=" + indicatorGroups.size() +
+ ", indicatorGroupSets=" + indicatorGroupSets.size() +
+ ", indicatorTypes=" + indicatorTypes.size() +
+ ", organisationUnits=" + organisationUnits.size() +
+ ", organisationUnitGroups=" + organisationUnitGroups.size() +
+ ", organisationUnitGroupSets=" + organisationUnitGroupSets.size() +
+ ", organisationUnitLevels=" + organisationUnitLevels.size() +
+ ", dataSets=" + dataSets.size() +
+ ", validationRules=" + validationRules.size() +
+ ", validationRuleGroups=" + validationRuleGroups.size() +
+ ", sqlViews=" + sqlViews.size() +
+ ", charts=" + charts.size() +
+ ", reports=" + reports.size() +
+ ", reportTables=" + reportTables.size() +
+ ", documents=" + documents.size() +
+ ", constants=" + constants.size() +
+ ", maps=" + maps.size() +
+ ", mapLegends=" + mapLegends.size() +
+ ", mapLegendSets=" + mapLegendSets.size() +
+ ", mapLayers=" + mapLayers.size() +
+ ", dataDictionaries=" + dataDictionaries.size() +
+ '}';
+ }
}
=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.java 2012-04-01 12:24:57 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.java 2012-04-02 17:23:48 +0000
@@ -27,8 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.ArrayList;
-
import org.hisp.dhis.attribute.Attribute;
import org.hisp.dhis.attribute.AttributeService;
import org.hisp.dhis.chart.Chart;
@@ -39,58 +37,36 @@
import org.hisp.dhis.constant.ConstantService;
import org.hisp.dhis.datadictionary.DataDictionary;
import org.hisp.dhis.datadictionary.DataDictionaryService;
-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.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementGroupSet;
-import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.*;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.document.Document;
import org.hisp.dhis.document.DocumentService;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorGroup;
-import org.hisp.dhis.indicator.IndicatorGroupSet;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.indicator.IndicatorType;
-import org.hisp.dhis.mapping.MapLayer;
-import org.hisp.dhis.mapping.MapLegend;
-import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MapView;
-import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.indicator.*;
+import org.hisp.dhis.mapping.*;
import org.hisp.dhis.option.OptionService;
import org.hisp.dhis.option.OptionSet;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
-import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.organisationunit.*;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.report.ReportService;
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.reporttable.ReportTableService;
import org.hisp.dhis.sqlview.SqlView;
import org.hisp.dhis.sqlview.SqlViewService;
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserAuthorityGroup;
-import org.hisp.dhis.user.UserGroup;
-import org.hisp.dhis.user.UserGroupService;
-import org.hisp.dhis.user.UserService;
+import org.hisp.dhis.user.*;
import org.hisp.dhis.validation.ValidationRule;
import org.hisp.dhis.validation.ValidationRuleGroup;
import org.hisp.dhis.validation.ValidationRuleService;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashSet;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
-@Component
+@Service
public class DefaultExportService
implements ExportService
{
@@ -167,177 +143,177 @@
if ( exportOptions.isAttributeTypes() )
{
- dxf2.setAttributeTypes( new ArrayList<Attribute>( attributeService.getAllAttributes() ) );
+ dxf2.setAttributeTypes( new HashSet<Attribute>( attributeService.getAllAttributes() ) );
}
if ( exportOptions.isUsers() )
{
- dxf2.setUsers( new ArrayList<User>( userService.getAllUsers() ) );
+ dxf2.setUsers( new HashSet<User>( userService.getAllUsers() ) );
}
if ( exportOptions.isUserAuthorityGroups() )
{
- dxf2.setUserAuthorityGroups( new ArrayList<UserAuthorityGroup>( userService.getAllUserAuthorityGroups() ) );
+ dxf2.setUserAuthorityGroups( new HashSet<UserAuthorityGroup>( userService.getAllUserAuthorityGroups() ) );
}
if ( exportOptions.isUserGroups() )
{
- dxf2.setUserGroups( new ArrayList<UserGroup>( userGroupService.getAllUserGroups() ) );
+ dxf2.setUserGroups( new HashSet<UserGroup>( userGroupService.getAllUserGroups() ) );
}
if ( exportOptions.isConstants() )
{
- dxf2.setConstants( new ArrayList<Constant>( constantService.getAllConstants() ) );
+ dxf2.setConstants( new HashSet<Constant>( constantService.getAllConstants() ) );
}
if ( exportOptions.isConcepts() )
{
- dxf2.setConcepts( new ArrayList<Concept>( conceptService.getAllConcepts() ) );
+ dxf2.setConcepts( new HashSet<Concept>( conceptService.getAllConcepts() ) );
}
if ( exportOptions.isDataElements() )
{
- dxf2.setDataElements( new ArrayList<DataElement>( dataElementService.getAllDataElements() ) );
+ dxf2.setDataElements( new HashSet<DataElement>( dataElementService.getAllDataElements() ) );
}
if ( exportOptions.isOptionSets() )
{
- dxf2.setOptionSets( new ArrayList<OptionSet>( optionService.getAllOptionSets() ) );
+ dxf2.setOptionSets( new HashSet<OptionSet>( optionService.getAllOptionSets() ) );
}
if ( exportOptions.isDataElementGroups() )
{
- dxf2.setDataElementGroups( new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() ) );
+ dxf2.setDataElementGroups( new HashSet<DataElementGroup>( dataElementService.getAllDataElementGroups() ) );
}
if ( exportOptions.isDataElementGroupSets() )
{
- dxf2.setDataElementGroupSets( new ArrayList<DataElementGroupSet>( dataElementService.getAllDataElementGroupSets() ) );
+ dxf2.setDataElementGroupSets( new HashSet<DataElementGroupSet>( dataElementService.getAllDataElementGroupSets() ) );
}
if ( exportOptions.isCategories() )
{
- dxf2.setCategories( new ArrayList<DataElementCategory>( dataElementCategoryService.getAllDataElementCategories() ) );
+ dxf2.setCategories( new HashSet<DataElementCategory>( dataElementCategoryService.getAllDataElementCategories() ) );
}
if ( exportOptions.isCategoryOptions() )
{
- dxf2.setCategoryOptions( new ArrayList<DataElementCategoryOption>( dataElementCategoryService.getAllDataElementCategoryOptions() ) );
+ dxf2.setCategoryOptions( new HashSet<DataElementCategoryOption>( dataElementCategoryService.getAllDataElementCategoryOptions() ) );
}
if ( exportOptions.isCategoryCombos() )
{
- dxf2.setCategoryCombos( new ArrayList<DataElementCategoryCombo>( dataElementCategoryService.getAllDataElementCategoryCombos() ) );
+ dxf2.setCategoryCombos( new HashSet<DataElementCategoryCombo>( dataElementCategoryService.getAllDataElementCategoryCombos() ) );
}
if ( exportOptions.isCategoryOptionCombos() )
{
- dxf2.setCategoryOptionCombos( new ArrayList<DataElementCategoryOptionCombo>( dataElementCategoryService.getAllDataElementCategoryOptionCombos() ) );
+ dxf2.setCategoryOptionCombos( new HashSet<DataElementCategoryOptionCombo>( dataElementCategoryService.getAllDataElementCategoryOptionCombos() ) );
}
if ( exportOptions.isIndicators() )
{
- dxf2.setIndicators( new ArrayList<Indicator>( indicatorService.getAllIndicators() ) );
+ dxf2.setIndicators( new HashSet<Indicator>( indicatorService.getAllIndicators() ) );
}
if ( exportOptions.isIndicatorGroups() )
{
- dxf2.setIndicatorGroups( new ArrayList<IndicatorGroup>( indicatorService.getAllIndicatorGroups() ) );
+ dxf2.setIndicatorGroups( new HashSet<IndicatorGroup>( indicatorService.getAllIndicatorGroups() ) );
}
if ( exportOptions.isIndicatorGroupSets() )
{
- dxf2.setIndicatorGroupSets( new ArrayList<IndicatorGroupSet>( indicatorService.getAllIndicatorGroupSets() ) );
+ dxf2.setIndicatorGroupSets( new HashSet<IndicatorGroupSet>( indicatorService.getAllIndicatorGroupSets() ) );
}
if ( exportOptions.isIndicatorTypes() )
{
- dxf2.setIndicatorTypes( new ArrayList<IndicatorType>( indicatorService.getAllIndicatorTypes() ) );
+ dxf2.setIndicatorTypes( new HashSet<IndicatorType>( indicatorService.getAllIndicatorTypes() ) );
}
if ( exportOptions.isOrganisationUnits() )
{
- dxf2.setOrganisationUnits( new ArrayList<OrganisationUnit>( organisationUnitService.getAllOrganisationUnits() ) );
+ dxf2.setOrganisationUnits( new HashSet<OrganisationUnit>( organisationUnitService.getAllOrganisationUnits() ) );
}
if ( exportOptions.isOrganisationUnitLevels() )
{
- dxf2.setOrganisationUnitLevels( new ArrayList<OrganisationUnitLevel>( organisationUnitService.getOrganisationUnitLevels() ) );
+ dxf2.setOrganisationUnitLevels( new HashSet<OrganisationUnitLevel>( organisationUnitService.getOrganisationUnitLevels() ) );
}
if ( exportOptions.isOrganisationUnitGroups() )
{
- dxf2.setOrganisationUnitGroups( new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getAllOrganisationUnitGroups() ) );
+ dxf2.setOrganisationUnitGroups( new HashSet<OrganisationUnitGroup>( organisationUnitGroupService.getAllOrganisationUnitGroups() ) );
}
if ( exportOptions.isOrganisationUnitGroupSets() )
{
- dxf2.setOrganisationUnitGroupSets( new ArrayList<OrganisationUnitGroupSet>( organisationUnitGroupService.getAllOrganisationUnitGroupSets() ) );
+ dxf2.setOrganisationUnitGroupSets( new HashSet<OrganisationUnitGroupSet>( organisationUnitGroupService.getAllOrganisationUnitGroupSets() ) );
}
if ( exportOptions.isDataSets() )
{
- dxf2.setDataSets( new ArrayList<DataSet>( dataSetService.getAllDataSets() ) );
+ dxf2.setDataSets( new HashSet<DataSet>( dataSetService.getAllDataSets() ) );
}
if ( exportOptions.isValidationRules() )
{
- dxf2.setValidationRules( new ArrayList<ValidationRule>( validationRuleService.getAllValidationRules() ) );
+ dxf2.setValidationRules( new HashSet<ValidationRule>( validationRuleService.getAllValidationRules() ) );
}
if ( exportOptions.isValidationRuleGroups() )
{
- dxf2.setValidationRuleGroups( new ArrayList<ValidationRuleGroup>( validationRuleService.getAllValidationRuleGroups() ) );
+ dxf2.setValidationRuleGroups( new HashSet<ValidationRuleGroup>( validationRuleService.getAllValidationRuleGroups() ) );
}
if ( exportOptions.isSqlViews() )
{
- dxf2.setSqlViews( new ArrayList<SqlView>( sqlViewService.getAllSqlViews() ) );
+ dxf2.setSqlViews( new HashSet<SqlView>( sqlViewService.getAllSqlViews() ) );
}
if ( exportOptions.isDocuments() )
{
- dxf2.setDocuments( new ArrayList<Document>( documentService.getAllDocuments() ) );
+ dxf2.setDocuments( new HashSet<Document>( documentService.getAllDocuments() ) );
}
if ( exportOptions.isReportTables() )
{
- dxf2.setReportTables( new ArrayList<ReportTable>( reportTableService.getAllReportTables() ) );
+ dxf2.setReportTables( new HashSet<ReportTable>( reportTableService.getAllReportTables() ) );
}
if ( exportOptions.isReports() )
{
- dxf2.setReports( new ArrayList<Report>( reportService.getAllReports() ) );
+ dxf2.setReports( new HashSet<Report>( reportService.getAllReports() ) );
}
if ( exportOptions.isCharts() )
{
- dxf2.setCharts( new ArrayList<Chart>( chartService.getAllCharts() ) );
+ dxf2.setCharts( new HashSet<Chart>( chartService.getAllCharts() ) );
}
if ( exportOptions.isMaps() )
{
- dxf2.setMaps( new ArrayList<MapView>( mappingService.getAllMapViews() ) );
+ dxf2.setMaps( new HashSet<MapView>( mappingService.getAllMapViews() ) );
}
if ( exportOptions.isMapLegends() )
{
- dxf2.setMapLegends( new ArrayList<MapLegend>( mappingService.getAllMapLegends() ) );
+ dxf2.setMapLegends( new HashSet<MapLegend>( mappingService.getAllMapLegends() ) );
}
if ( exportOptions.isMapLegendSets() )
{
- dxf2.setMapLegendSets( new ArrayList<MapLegendSet>( mappingService.getAllMapLegendSets() ) );
+ dxf2.setMapLegendSets( new HashSet<MapLegendSet>( mappingService.getAllMapLegendSets() ) );
}
if ( exportOptions.isMapLayers() )
{
- dxf2.setMapLayers( new ArrayList<MapLayer>( mappingService.getAllMapLayers() ) );
+ dxf2.setMapLayers( new HashSet<MapLayer>( mappingService.getAllMapLayers() ) );
}
if ( exportOptions.isDataDictionaries() )
{
- dxf2.setDataDictionaries( new ArrayList<DataDictionary>( dataDictionaryService.getAllDataDictionaries() ) );
+ dxf2.setDataDictionaries( new HashSet<DataDictionary>( dataDictionaryService.getAllDataDictionaries() ) );
}
return dxf2;
=== added file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2012-04-02 17:23:48 +0000
@@ -0,0 +1,151 @@
+package org.hisp.dhis.dxf2.metadata;
+
+/*
+ * Copyright (c) 2012, 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.attribute.AttributeService;
+import org.hisp.dhis.chart.ChartService;
+import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.NameableObject;
+import org.hisp.dhis.concept.ConceptService;
+import org.hisp.dhis.constant.Constant;
+import org.hisp.dhis.constant.ConstantService;
+import org.hisp.dhis.datadictionary.DataDictionaryService;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.document.DocumentService;
+import org.hisp.dhis.dxf2.importsummary.ImportConflict;
+import org.hisp.dhis.dxf2.importsummary.ImportSummary;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.report.ReportService;
+import org.hisp.dhis.reporttable.ReportTableService;
+import org.hisp.dhis.sqlview.SqlViewService;
+import org.hisp.dhis.user.UserGroupService;
+import org.hisp.dhis.user.UserService;
+import org.hisp.dhis.validation.ValidationRuleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Transactional
+@Service
+public class DefaultImportService
+ implements ImportService
+{
+ //-------------------------------------------------------------------------------------------------------
+ // Dependencies
+ //-------------------------------------------------------------------------------------------------------
+/*
+ @Autowired
+ private AttributeService attributeService;
+
+ @Autowired
+ private UserService userService;
+
+ @Autowired
+ private UserGroupService userGroupService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private OptionService optionService;
+
+ @Autowired
+ private ConceptService conceptService;
+
+ @Autowired
+ private DataElementCategoryService dataElementCategoryService;
+
+ @Autowired
+ private IndicatorService indicatorService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private ValidationRuleService validationRuleService;
+
+ @Autowired
+ private SqlViewService sqlViewService;
+
+ @Autowired
+ private ChartService chartService;
+
+ @Autowired
+ private ReportService reportService;
+
+ @Autowired
+ private ReportTableService reportTableService;
+
+ @Autowired
+ private DocumentService documentService;
+
+ @Autowired
+ private ConstantService constantService;
+
+ @Autowired
+ private MappingService mappingService;
+
+ @Autowired
+ private DataDictionaryService dataDictionaryService;
+*/
+
+ //-------------------------------------------------------------------------------------------------------
+ // ImportService Implementation
+ //-------------------------------------------------------------------------------------------------------
+
+ @Override
+ public ImportSummary importDxf2( DXF2 dxf2 )
+ {
+ return importDxf2WithImportOptions( dxf2, ImportOptions.getDefaultImportOptions() );
+ }
+
+ @Override
+ public ImportSummary importDxf2WithImportOptions( DXF2 dxf2, ImportOptions importOptions )
+ {
+ return new ImportSummary();
+ }
+}
=== added file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/IdScheme.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/IdScheme.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/IdScheme.java 2012-04-02 17:23:48 +0000
@@ -0,0 +1,89 @@
+package org.hisp.dhis.dxf2.metadata;
+
+/*
+ * Copyright (c) 2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class IdScheme
+{
+ public static String UID_SCHEME = "uid";
+ public static String CODE_SCHEME = "code";
+ public static String NAME_SCHEME = "name";
+
+ private String scheme;
+
+ private boolean uidScheme;
+
+ private boolean codeScheme;
+
+ private boolean nameScheme;
+
+ public static IdScheme getDefaultIdScheme()
+ {
+ return new IdScheme( IdScheme.UID_SCHEME );
+ }
+
+ public IdScheme( String scheme )
+ {
+ setScheme( scheme );
+ }
+
+ public String getScheme()
+ {
+ return scheme;
+ }
+
+ public void setScheme( String scheme )
+ {
+ this.scheme = scheme;
+
+ if ( scheme != null )
+ {
+ uidScheme = scheme.equals( IdScheme.UID_SCHEME );
+ codeScheme = scheme.equals( IdScheme.CODE_SCHEME );
+ nameScheme = scheme.equals( IdScheme.NAME_SCHEME );
+ }
+ }
+
+ public boolean isUidScheme()
+ {
+ return uidScheme;
+ }
+
+ public boolean isCodeScheme()
+ {
+ return codeScheme;
+ }
+
+ public boolean isNameScheme()
+ {
+ return nameScheme;
+ }
+}
=== added file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportOptions.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportOptions.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportOptions.java 2012-04-02 17:23:48 +0000
@@ -0,0 +1,91 @@
+package org.hisp.dhis.dxf2.metadata;
+
+/*
+ * Copyright (c) 2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class ImportOptions
+{
+ private boolean dryRun = false;
+
+ private IdScheme idScheme = IdScheme.getDefaultIdScheme();
+
+ private ImportStrategy importStrategy;
+
+ private static ImportOptions defaultImportOptions = new ImportOptions( IdScheme.getDefaultIdScheme(),
+ ImportStrategy.getDefaultImportStrategy() );
+
+ public static ImportOptions getDefaultImportOptions()
+ {
+ return defaultImportOptions;
+ }
+
+ public ImportOptions()
+ {
+ this.idScheme = IdScheme.getDefaultIdScheme();
+ this.importStrategy = ImportStrategy.getDefaultImportStrategy();
+ }
+
+ public ImportOptions( IdScheme idScheme, ImportStrategy importStrategy )
+ {
+ this.idScheme = idScheme;
+ this.importStrategy = importStrategy;
+ }
+
+ public boolean isDryRun()
+ {
+ return dryRun;
+ }
+
+ public void setDryRun( boolean dryRun )
+ {
+ this.dryRun = dryRun;
+ }
+
+ public IdScheme getIdScheme()
+ {
+ return idScheme;
+ }
+
+ public void setIdScheme( IdScheme idScheme )
+ {
+ this.idScheme = idScheme;
+ }
+
+ public ImportStrategy getImportStrategy()
+ {
+ return importStrategy;
+ }
+
+ public void setImportStrategy( ImportStrategy importStrategy )
+ {
+ this.importStrategy = importStrategy;
+ }
+}
=== added file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportService.java 2012-04-02 17:23:48 +0000
@@ -0,0 +1,42 @@
+package org.hisp.dhis.dxf2.metadata;
+
+/*
+ * Copyright (c) 2012, 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.dxf2.importsummary.ImportSummary;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Service
+public interface ImportService
+{
+ ImportSummary importDxf2( DXF2 dxf2 );
+
+ ImportSummary importDxf2WithImportOptions( DXF2 dxf2, ImportOptions importOptions );
+}
=== added file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportStrategy.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportStrategy.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportStrategy.java 2012-04-02 17:23:48 +0000
@@ -0,0 +1,89 @@
+package org.hisp.dhis.dxf2.metadata;
+
+/*
+ * Copyright (c) 2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class ImportStrategy
+{
+ public static String NEW_AND_UPDATES_STRATEGY = "newAndUpdates";
+ public static String UPDATES_STRATEGY = "updates";
+ public static String NEW_STRATEGY = "new";
+
+ private String strategy;
+
+ private boolean newAndUpdatesStrategy;
+
+ private boolean updatesStrategy;
+
+ private boolean newStrategy;
+
+ public static ImportStrategy getDefaultImportStrategy()
+ {
+ return new ImportStrategy( ImportStrategy.NEW_AND_UPDATES_STRATEGY );
+ }
+
+ public ImportStrategy( String strategy )
+ {
+ setStrategy( strategy );
+ }
+
+ public String getStrategy()
+ {
+ return strategy;
+ }
+
+ public void setStrategy( String strategy )
+ {
+ this.strategy = strategy;
+
+ if ( strategy != null )
+ {
+ newAndUpdatesStrategy = strategy.equals( ImportStrategy.NEW_AND_UPDATES_STRATEGY );
+ updatesStrategy = strategy.equals( ImportStrategy.UPDATES_STRATEGY );
+ newStrategy = strategy.equals( ImportStrategy.NEW_STRATEGY );
+ }
+ }
+
+ public boolean isNewAndUpdatesStrategy()
+ {
+ return newAndUpdatesStrategy;
+ }
+
+ public boolean isUpdatesStrategy()
+ {
+ return updatesStrategy;
+ }
+
+ public boolean isNewStrategy()
+ {
+ return newStrategy;
+ }
+}
=== modified file 'dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml 2012-04-01 12:04:14 +0000
+++ dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml 2012-04-02 17:23:48 +0000
@@ -9,6 +9,6 @@
class="org.hisp.dhis.dxf2.datavalueset.DefaultDataValueSetService" />
<bean id="org.hisp.dhis.dxf2.datavalueset.DataValueSetStore"
- class="org.hisp.dhis.dxf2.datavalueset.SpringDataValueSetStore" />
+ class="org.hisp.dhis.dxf2.datavalueset.SpringDataValueSetStore" />
</beans>
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml 2011-11-03 01:02:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml 2012-04-02 17:23:48 +0000
@@ -14,7 +14,7 @@
<generator class="native" />
</id>
&identifiableProperties;
-
+
<property name="value" />
</class>
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2012-03-30 10:53:18 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java 2012-04-02 17:23:48 +0000
@@ -29,11 +29,11 @@
import org.hisp.dhis.api.utils.ContextUtils;
import org.hisp.dhis.common.view.ExportView;
-import org.hisp.dhis.dxf2.metadata.DXF2;
-import org.hisp.dhis.dxf2.metadata.ExportOptions;
-import org.hisp.dhis.dxf2.metadata.ExportService;
+import org.hisp.dhis.dxf2.importsummary.ImportSummary;
+import org.hisp.dhis.dxf2.metadata.*;
import org.hisp.dhis.dxf2.utils.JacksonUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@@ -60,6 +60,9 @@
@Autowired
private ExportService exportService;
+ @Autowired
+ private ImportService importService;
+
//-------------------------------------------------------------------------------------------------------
// Export
//-------------------------------------------------------------------------------------------------------
@@ -114,102 +117,59 @@
@RequestMapping( value = MetaDataController.RESOURCE_PATH, method = RequestMethod.POST, headers = {"Content-Type=application/xml, text/*"} )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
- public void importXml( HttpServletResponse response, HttpServletRequest request ) throws JAXBException, IOException
+ public void importXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws JAXBException, IOException
{
DXF2 dxf2 = JacksonUtils.fromXml( request.getInputStream(), DXF2.class );
-
- print( dxf2 );
+ System.err.println( dxf2 );
+
+ ImportSummary summary = importService.importDxf2WithImportOptions( dxf2, importOptions );
+
+ response.setContentType( MediaType.APPLICATION_XML.toString() );
+ JacksonUtils.toXml( response.getOutputStream(), summary );
}
@RequestMapping( value = MetaDataController.RESOURCE_PATH, method = RequestMethod.POST, headers = {"Content-Type=application/json"} )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
- public void importJson( HttpServletResponse response, HttpServletRequest request ) throws IOException
+ public void importJson( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
DXF2 dxf2 = JacksonUtils.fromJson( request.getInputStream(), DXF2.class );
-
- print( dxf2 );
+ System.err.println( dxf2 );
+
+ ImportSummary summary = importService.importDxf2WithImportOptions( dxf2, importOptions );
+
+ response.setContentType( MediaType.APPLICATION_JSON.toString() );
+ JacksonUtils.toJson( response.getOutputStream(), summary );
}
@RequestMapping( value = MetaDataController.RESOURCE_PATH + ".zip", method = RequestMethod.POST, headers = {"Content-Type=application/xml, text/xml"} )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
- public void importZippedXml( HttpServletResponse response, HttpServletRequest request ) throws JAXBException, IOException
+ public void importZippedXml( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws JAXBException, IOException
{
ZipInputStream zip = new ZipInputStream( new BufferedInputStream( request.getInputStream() ) );
ZipEntry entry = zip.getNextEntry();
- System.err.println( "(xml) Reading from file : " + entry.getName() );
-
DXF2 dxf2 = JacksonUtils.fromXml( zip, DXF2.class );
-
- print( dxf2 );
+ System.err.println( dxf2 );
+
+ ImportSummary summary = importService.importDxf2WithImportOptions( dxf2, importOptions );
+
+ response.setContentType( MediaType.APPLICATION_XML.toString() );
+ JacksonUtils.toXml( response.getOutputStream(), summary );
}
@RequestMapping( value = MetaDataController.RESOURCE_PATH + ".zip", method = RequestMethod.POST, headers = {"Content-Type=application/json"} )
@PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_IMPORT')" )
- public void importZippedJson( HttpServletResponse response, HttpServletRequest request ) throws IOException
+ public void importZippedJson( ImportOptions importOptions, HttpServletResponse response, HttpServletRequest request ) throws IOException
{
ZipInputStream zip = new ZipInputStream( request.getInputStream() );
ZipEntry entry = zip.getNextEntry();
- System.err.println( "(json) Reading from file : " + entry.getName() );
DXF2 dxf2 = JacksonUtils.fromJson( zip, DXF2.class );
-
- print( dxf2 );
- }
-
-
- //-------------------------------------------------------------------------------------------------------
- // Helpers
- //-------------------------------------------------------------------------------------------------------
-
- private void print( DXF2 dxf2 )
- {
- System.err.println( "AttributeTypes: " + dxf2.getAttributeTypes().size() );
-
- System.err.println( "Users: " + dxf2.getUsers().size() );
- System.err.println( "UserGroups: " + dxf2.getUserGroups().size() );
- System.err.println( "UserAuthorityGroups: " + dxf2.getUserAuthorityGroups().size() );
-
- System.err.println( "Documents: " + dxf2.getDocuments().size() );
- System.err.println( "Reports: " + dxf2.getReports().size() );
- System.err.println( "ReportTables: " + dxf2.getReportTables().size() );
- System.err.println( "Charts: " + dxf2.getCharts().size() );
-
- System.err.println( "Maps: " + dxf2.getMaps().size() );
- System.err.println( "MapLegends: " + dxf2.getMapLegends().size() );
- System.err.println( "MapLegendSets: " + dxf2.getMapLegendSets().size() );
- System.err.println( "MapLayers: " + dxf2.getMapLayers().size() );
-
- System.err.println( "Constants: " + dxf2.getConstants().size() );
- System.err.println( "Concepts: " + dxf2.getConcepts().size() );
-
- System.err.println( "SqlViews: " + dxf2.getSqlViews().size() );
-
- System.err.println( "DataElements: " + dxf2.getDataElements().size() );
- System.err.println( "OptionSets: " + dxf2.getOptionSets().size() );
- System.err.println( "DataElementGroups: " + dxf2.getDataElementGroups().size() );
- System.err.println( "DataElementGroupSets: " + dxf2.getDataElementGroupSets().size() );
-
- System.err.println( "Categories: " + dxf2.getCategories().size() );
- System.err.println( "CategoryOptions: " + dxf2.getCategoryOptions().size() );
- System.err.println( "CategoryCombos: " + dxf2.getCategoryCombos().size() );
- System.err.println( "CategoryOptionCombos: " + dxf2.getCategoryOptionCombos().size() );
-
- System.err.println( "DataSets: " + dxf2.getDataSets().size() );
-
- System.err.println( "Indicators:" + dxf2.getIndicators().size() );
- System.err.println( "IndicatorGroups:" + dxf2.getIndicatorGroups().size() );
- System.err.println( "IndicatorGroupSets:" + dxf2.getIndicatorGroupSets().size() );
- System.err.println( "IndicatorTypes:" + dxf2.getIndicatorTypes().size() );
-
- System.err.println( "OrganisationUnits: " + dxf2.getOrganisationUnits().size() );
- System.err.println( "OrganisationUnitGroups: " + dxf2.getOrganisationUnitGroups().size() );
- System.err.println( "OrganisationUnitGroupSets: " + dxf2.getOrganisationUnitGroupSets().size() );
- System.err.println( "OrganisationUnitLevels: " + dxf2.getOrganisationUnitLevels().size() );
-
- System.err.println( "ValidationRules: " + dxf2.getValidationRules().size() );
- System.err.println( "ValidationRuleGroups: " + dxf2.getValidationRuleGroups().size() );
-
- System.err.println( "DataDictionaries: " + dxf2.getDataDictionaries().size() );
+ System.err.println( dxf2 );
+
+ ImportSummary summary = importService.importDxf2WithImportOptions( dxf2, importOptions );
+
+ response.setContentType( MediaType.APPLICATION_JSON.toString() );
+ JacksonUtils.toJson( response.getOutputStream(), summary );
}
}