=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2012-03-29 16:45:18 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2012-04-03 10:24:37 +0000 @@ -27,28 +27,28 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import org.hisp.dhis.common.IdentifiableObject.IdentifiableProperty; + import java.util.Map; -import org.hisp.dhis.common.IdentifiableObject.IdentifiableProperty; - /** * @author Lars Helge Overland */ public interface IdentifiableObjectManager { void save( IdentifiableObject object ); - + void update( IdentifiableObject object ); - + void get( Class clazz, String uid ); - + void delete( IdentifiableObject object ); - + Map getIdMap( Class clazz, IdentifiableProperty property ); - + T getObject( Class clazz, IdentifiableProperty property, String id ); - + IdentifiableObject getObject( String uid, String simpleClassName ); - + IdentifiableObject getObject( int id, String simpleClassName ); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java 2012-04-03 10:24:37 +0000 @@ -38,7 +38,6 @@ * Defines the functionality for persisting DataElements and DataElementGroups. * * @author Torgeir Lorange Ostby - * @version $Id: DataElementStore.java 6289 2008-11-14 17:53:24Z larshelg $ */ public interface DataElementStore extends GenericNameableObjectStore === 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-04-02 17:23:48 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/importsummary/ImportCount.java 2012-04-03 10:24:37 +0000 @@ -42,6 +42,11 @@ private int ignores; + public ImportCount( String object ) + { + this.object = object; + } + public ImportCount( String object, int imports, int updates, int ignores ) { this.object = object; === 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-04-02 17:23:48 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DXF2.java 2012-04-03 10:24:37 +0000 @@ -63,8 +63,8 @@ import org.hisp.dhis.validation.ValidationRule; import org.hisp.dhis.validation.ValidationRuleGroup; -import java.util.HashSet; -import java.util.Set; +import java.util.ArrayList; +import java.util.List; /** * @author Morten Olav Hansen @@ -72,77 +72,77 @@ @JacksonXmlRootElement( localName = "dxf2", namespace = Dxf2Namespace.NAMESPACE ) public class DXF2 { - private Set attributeTypes = new HashSet(); - - private Set users = new HashSet(); - - private Set userAuthorityGroups = new HashSet(); - - private Set userGroups = new HashSet(); - - private Set messageConversations = new HashSet(); - - private Set dataElements = new HashSet(); - - private Set optionSets = new HashSet(); - - private Set dataElementGroups = new HashSet(); - - private Set dataElementGroupSets = new HashSet(); - - private Set concepts = new HashSet(); - - private Set categories = new HashSet(); - - private Set categoryOptions = new HashSet(); - - private Set categoryCombos = new HashSet(); - - private Set categoryOptionCombos = new HashSet(); - - private Set indicators = new HashSet(); - - private Set indicatorGroups = new HashSet(); - - private Set indicatorGroupSets = new HashSet(); - - private Set indicatorTypes = new HashSet(); - - private Set organisationUnits = new HashSet(); - - private Set organisationUnitGroups = new HashSet(); - - private Set organisationUnitGroupSets = new HashSet(); - - private Set organisationUnitLevels = new HashSet(); - - private Set dataSets = new HashSet(); - - private Set validationRules = new HashSet(); - - private Set validationRuleGroups = new HashSet(); - - private Set sqlViews = new HashSet(); - - private Set charts = new HashSet(); - - private Set reports = new HashSet(); - - private Set reportTables = new HashSet(); - - private Set documents = new HashSet(); - - private Set constants = new HashSet(); - - private Set maps = new HashSet(); - - private Set mapLegends = new HashSet(); - - private Set mapLegendSets = new HashSet(); - - private Set mapLayers = new HashSet(); - - private Set dataDictionaries = new HashSet(); + private List attributeTypes = new ArrayList(); + + private List users = new ArrayList(); + + private List userAuthorityGroups = new ArrayList(); + + private List userGroups = new ArrayList(); + + private List messageConversations = new ArrayList(); + + private List dataElements = new ArrayList(); + + private List optionSets = new ArrayList(); + + private List dataElementGroups = new ArrayList(); + + private List dataElementGroupSets = new ArrayList(); + + private List concepts = new ArrayList(); + + private List categories = new ArrayList(); + + private List categoryOptions = new ArrayList(); + + private List categoryCombos = new ArrayList(); + + private List categoryOptionCombos = new ArrayList(); + + private List indicators = new ArrayList(); + + private List indicatorGroups = new ArrayList(); + + private List indicatorGroupSets = new ArrayList(); + + private List indicatorTypes = new ArrayList(); + + private List organisationUnits = new ArrayList(); + + private List organisationUnitGroups = new ArrayList(); + + private List organisationUnitGroupSets = new ArrayList(); + + private List organisationUnitLevels = new ArrayList(); + + private List dataSets = new ArrayList(); + + private List validationRules = new ArrayList(); + + private List validationRuleGroups = new ArrayList(); + + private List sqlViews = new ArrayList(); + + private List charts = new ArrayList(); + + private List reports = new ArrayList(); + + private List reportTables = new ArrayList(); + + private List documents = new ArrayList(); + + private List constants = new ArrayList(); + + private List maps = new ArrayList(); + + private List mapLegends = new ArrayList(); + + private List mapLegendSets = new ArrayList(); + + private List mapLayers = new ArrayList(); + + private List dataDictionaries = new ArrayList(); public DXF2() { @@ -151,12 +151,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "attributeTypes", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "attributeType", namespace = Dxf2Namespace.NAMESPACE ) - public Set getAttributeTypes() + public List getAttributeTypes() { return attributeTypes; } - public void setAttributeTypes( Set attributeTypes ) + public void setAttributeTypes( List attributeTypes ) { this.attributeTypes = attributeTypes; } @@ -164,12 +164,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "users", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "user", namespace = Dxf2Namespace.NAMESPACE ) - public Set getUsers() + public List getUsers() { return users; } - public void setUsers( Set users ) + public void setUsers( List users ) { this.users = users; } @@ -177,12 +177,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "userAuthorityGroups", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "userAuthorityGroup", namespace = Dxf2Namespace.NAMESPACE ) - public Set getUserAuthorityGroups() + public List getUserAuthorityGroups() { return userAuthorityGroups; } - public void setUserAuthorityGroups( Set userAuthorityGroups ) + public void setUserAuthorityGroups( List userAuthorityGroups ) { this.userAuthorityGroups = userAuthorityGroups; } @@ -190,12 +190,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "userGroups", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "userGroup", namespace = Dxf2Namespace.NAMESPACE ) - public Set getUserGroups() + public List getUserGroups() { return userGroups; } - public void setUserGroups( Set userGroups ) + public void setUserGroups( List userGroups ) { this.userGroups = userGroups; } @@ -203,12 +203,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "messageConversations", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "messageConversation", namespace = Dxf2Namespace.NAMESPACE ) - public Set getMessageConversations() + public List getMessageConversations() { return messageConversations; } - public void setMessageConversations( Set messageConversations ) + public void setMessageConversations( List messageConversations ) { this.messageConversations = messageConversations; } @@ -216,12 +216,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "dataElements", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "dataElement", namespace = Dxf2Namespace.NAMESPACE ) - public Set getDataElements() + public List getDataElements() { return dataElements; } - public void setDataElements( Set dataElements ) + public void setDataElements( List dataElements ) { this.dataElements = dataElements; } @@ -229,12 +229,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "optionSets", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "optionSet", namespace = Dxf2Namespace.NAMESPACE ) - public Set getOptionSets() + public List getOptionSets() { return optionSets; } - public void setOptionSets( Set optionSets ) + public void setOptionSets( List optionSets ) { this.optionSets = optionSets; } @@ -242,12 +242,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "dataElementGroups", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "dataElementGroup", namespace = Dxf2Namespace.NAMESPACE ) - public Set getDataElementGroups() + public List getDataElementGroups() { return dataElementGroups; } - public void setDataElementGroups( Set dataElementGroups ) + public void setDataElementGroups( List dataElementGroups ) { this.dataElementGroups = dataElementGroups; } @@ -255,12 +255,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "dataElementGroupSets", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "dataElementGroupSet", namespace = Dxf2Namespace.NAMESPACE ) - public Set getDataElementGroupSets() + public List getDataElementGroupSets() { return dataElementGroupSets; } - public void setDataElementGroupSets( Set dataElementGroupSets ) + public void setDataElementGroupSets( List dataElementGroupSets ) { this.dataElementGroupSets = dataElementGroupSets; } @@ -268,12 +268,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "concepts", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "concept", namespace = Dxf2Namespace.NAMESPACE ) - public Set getConcepts() + public List getConcepts() { return concepts; } - public void setConcepts( Set concepts ) + public void setConcepts( List concepts ) { this.concepts = concepts; } @@ -281,12 +281,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "categories", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "category", namespace = Dxf2Namespace.NAMESPACE ) - public Set getCategories() + public List getCategories() { return categories; } - public void setCategories( Set categories ) + public void setCategories( List categories ) { this.categories = categories; } @@ -294,12 +294,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "categoryOptions", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "categoryOption", namespace = Dxf2Namespace.NAMESPACE ) - public Set getCategoryOptions() + public List getCategoryOptions() { return categoryOptions; } - public void setCategoryOptions( Set categoryOptions ) + public void setCategoryOptions( List categoryOptions ) { this.categoryOptions = categoryOptions; } @@ -307,12 +307,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "categoryCombos", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "categoryCombo", namespace = Dxf2Namespace.NAMESPACE ) - public Set getCategoryCombos() + public List getCategoryCombos() { return categoryCombos; } - public void setCategoryCombos( Set categoryCombos ) + public void setCategoryCombos( List categoryCombos ) { this.categoryCombos = categoryCombos; } @@ -320,12 +320,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "categoryOptionCombos", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "categoryOptionCombo", namespace = Dxf2Namespace.NAMESPACE ) - public Set getCategoryOptionCombos() + public List getCategoryOptionCombos() { return categoryOptionCombos; } - public void setCategoryOptionCombos( Set categoryOptionCombos ) + public void setCategoryOptionCombos( List categoryOptionCombos ) { this.categoryOptionCombos = categoryOptionCombos; } @@ -333,12 +333,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "indicators", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "indicator", namespace = Dxf2Namespace.NAMESPACE ) - public Set getIndicators() + public List getIndicators() { return indicators; } - public void setIndicators( Set indicators ) + public void setIndicators( List indicators ) { this.indicators = indicators; } @@ -346,12 +346,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "indicatorGroups", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "indicatorGroup", namespace = Dxf2Namespace.NAMESPACE ) - public Set getIndicatorGroups() + public List getIndicatorGroups() { return indicatorGroups; } - public void setIndicatorGroups( Set indicatorGroups ) + public void setIndicatorGroups( List indicatorGroups ) { this.indicatorGroups = indicatorGroups; } @@ -359,12 +359,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "indicatorGroupSets", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "indicatorGroupSet", namespace = Dxf2Namespace.NAMESPACE ) - public Set getIndicatorGroupSets() + public List getIndicatorGroupSets() { return indicatorGroupSets; } - public void setIndicatorGroupSets( Set indicatorGroupSets ) + public void setIndicatorGroupSets( List indicatorGroupSets ) { this.indicatorGroupSets = indicatorGroupSets; } @@ -372,12 +372,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "indicatorTypes", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "indicatorType", namespace = Dxf2Namespace.NAMESPACE ) - public Set getIndicatorTypes() + public List getIndicatorTypes() { return indicatorTypes; } - public void setIndicatorTypes( Set indicatorTypes ) + public void setIndicatorTypes( List indicatorTypes ) { this.indicatorTypes = indicatorTypes; } @@ -385,12 +385,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "organisationUnits", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "organisationUnit", namespace = Dxf2Namespace.NAMESPACE ) - public Set getOrganisationUnits() + public List getOrganisationUnits() { return organisationUnits; } - public void setOrganisationUnits( Set organisationUnits ) + public void setOrganisationUnits( List organisationUnits ) { this.organisationUnits = organisationUnits; } @@ -398,12 +398,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "organisationUnitGroups", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "organisationUnitGroup", namespace = Dxf2Namespace.NAMESPACE ) - public Set getOrganisationUnitGroups() + public List getOrganisationUnitGroups() { return organisationUnitGroups; } - public void setOrganisationUnitGroups( Set organisationUnitGroups ) + public void setOrganisationUnitGroups( List organisationUnitGroups ) { this.organisationUnitGroups = organisationUnitGroups; } @@ -411,12 +411,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "organisationUnitGroupSets", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "organisationUnitGroupSet", namespace = Dxf2Namespace.NAMESPACE ) - public Set getOrganisationUnitGroupSets() + public List getOrganisationUnitGroupSets() { return organisationUnitGroupSets; } - public void setOrganisationUnitGroupSets( Set organisationUnitGroupSets ) + public void setOrganisationUnitGroupSets( List organisationUnitGroupSets ) { this.organisationUnitGroupSets = organisationUnitGroupSets; } @@ -424,12 +424,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "organisationUnitLevels", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "organisationUnitLevel", namespace = Dxf2Namespace.NAMESPACE ) - public Set getOrganisationUnitLevels() + public List getOrganisationUnitLevels() { return organisationUnitLevels; } - public void setOrganisationUnitLevels( Set organisationUnitLevels ) + public void setOrganisationUnitLevels( List organisationUnitLevels ) { this.organisationUnitLevels = organisationUnitLevels; } @@ -437,12 +437,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "dataSets", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "dataSet", namespace = Dxf2Namespace.NAMESPACE ) - public Set getDataSets() + public List getDataSets() { return dataSets; } - public void setDataSets( Set dataSets ) + public void setDataSets( List dataSets ) { this.dataSets = dataSets; } @@ -450,12 +450,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "validationRules", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "validationRule", namespace = Dxf2Namespace.NAMESPACE ) - public Set getValidationRules() + public List getValidationRules() { return validationRules; } - public void setValidationRules( Set validationRules ) + public void setValidationRules( List validationRules ) { this.validationRules = validationRules; } @@ -463,12 +463,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "validationRuleGroups", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "validationRuleGroup", namespace = Dxf2Namespace.NAMESPACE ) - public Set getValidationRuleGroups() + public List getValidationRuleGroups() { return validationRuleGroups; } - public void setValidationRuleGroups( Set validationRuleGroups ) + public void setValidationRuleGroups( List validationRuleGroups ) { this.validationRuleGroups = validationRuleGroups; } @@ -476,12 +476,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "sqlViews", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "sqlView", namespace = Dxf2Namespace.NAMESPACE ) - public Set getSqlViews() + public List getSqlViews() { return sqlViews; } - public void setSqlViews( Set sqlViews ) + public void setSqlViews( List sqlViews ) { this.sqlViews = sqlViews; } @@ -489,12 +489,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "charts", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "chart", namespace = Dxf2Namespace.NAMESPACE ) - public Set getCharts() + public List getCharts() { return charts; } - public void setCharts( Set charts ) + public void setCharts( List charts ) { this.charts = charts; } @@ -502,12 +502,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "reports", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "report", namespace = Dxf2Namespace.NAMESPACE ) - public Set getReports() + public List getReports() { return reports; } - public void setReports( Set reports ) + public void setReports( List reports ) { this.reports = reports; } @@ -515,12 +515,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "reportTables", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "reportTable", namespace = Dxf2Namespace.NAMESPACE ) - public Set getReportTables() + public List getReportTables() { return reportTables; } - public void setReportTables( Set reportTables ) + public void setReportTables( List reportTables ) { this.reportTables = reportTables; } @@ -528,12 +528,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "documents", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "document", namespace = Dxf2Namespace.NAMESPACE ) - public Set getDocuments() + public List getDocuments() { return documents; } - public void setDocuments( Set documents ) + public void setDocuments( List documents ) { this.documents = documents; } @@ -541,12 +541,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "constants", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "constant", namespace = Dxf2Namespace.NAMESPACE ) - public Set getConstants() + public List getConstants() { return constants; } - public void setConstants( Set constants ) + public void setConstants( List constants ) { this.constants = constants; } @@ -554,12 +554,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "maps", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "map", namespace = Dxf2Namespace.NAMESPACE ) - public Set getMaps() + public List getMaps() { return maps; } - public void setMaps( Set maps ) + public void setMaps( List maps ) { this.maps = maps; } @@ -567,12 +567,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "mapLegends", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "mapLegend", namespace = Dxf2Namespace.NAMESPACE ) - public Set getMapLegends() + public List getMapLegends() { return mapLegends; } - public void setMapLegends( Set mapLegends ) + public void setMapLegends( List mapLegends ) { this.mapLegends = mapLegends; } @@ -580,12 +580,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "mapLegendSets", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "mapLegendSet", namespace = Dxf2Namespace.NAMESPACE ) - public Set getMapLegendSets() + public List getMapLegendSets() { return mapLegendSets; } - public void setMapLegendSets( Set mapLegendSets ) + public void setMapLegendSets( List mapLegendSets ) { this.mapLegendSets = mapLegendSets; } @@ -593,12 +593,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "mapLayers", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "mapLayer", namespace = Dxf2Namespace.NAMESPACE ) - public Set getMapLayers() + public List getMapLayers() { return mapLayers; } - public void setMapLayers( Set mapLayers ) + public void setMapLayers( List mapLayers ) { this.mapLayers = mapLayers; } @@ -606,12 +606,12 @@ @JsonProperty @JacksonXmlElementWrapper( localName = "dataDictionaries", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "dataDictionary", namespace = Dxf2Namespace.NAMESPACE ) - public Set getDataDictionaries() + public List getDataDictionaries() { return dataDictionaries; } - public void setDataDictionaries( Set dataDictionaries ) + public void setDataDictionaries( List dataDictionaries ) { this.dataDictionaries = dataDictionaries; } === 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-02 17:23:48 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.java 2012-04-03 10:24:37 +0000 @@ -61,7 +61,6 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; -import java.util.HashSet; /** * @author Morten Olav Hansen @@ -143,177 +142,177 @@ if ( exportOptions.isAttributeTypes() ) { - dxf2.setAttributeTypes( new HashSet( attributeService.getAllAttributes() ) ); + dxf2.setAttributeTypes( new ArrayList( attributeService.getAllAttributes() ) ); } if ( exportOptions.isUsers() ) { - dxf2.setUsers( new HashSet( userService.getAllUsers() ) ); + dxf2.setUsers( new ArrayList( userService.getAllUsers() ) ); } if ( exportOptions.isUserAuthorityGroups() ) { - dxf2.setUserAuthorityGroups( new HashSet( userService.getAllUserAuthorityGroups() ) ); + dxf2.setUserAuthorityGroups( new ArrayList( userService.getAllUserAuthorityGroups() ) ); } if ( exportOptions.isUserGroups() ) { - dxf2.setUserGroups( new HashSet( userGroupService.getAllUserGroups() ) ); + dxf2.setUserGroups( new ArrayList( userGroupService.getAllUserGroups() ) ); } if ( exportOptions.isConstants() ) { - dxf2.setConstants( new HashSet( constantService.getAllConstants() ) ); + dxf2.setConstants( new ArrayList( constantService.getAllConstants() ) ); } if ( exportOptions.isConcepts() ) { - dxf2.setConcepts( new HashSet( conceptService.getAllConcepts() ) ); + dxf2.setConcepts( new ArrayList( conceptService.getAllConcepts() ) ); } if ( exportOptions.isDataElements() ) { - dxf2.setDataElements( new HashSet( dataElementService.getAllDataElements() ) ); + dxf2.setDataElements( new ArrayList( dataElementService.getAllDataElements() ) ); } if ( exportOptions.isOptionSets() ) { - dxf2.setOptionSets( new HashSet( optionService.getAllOptionSets() ) ); + dxf2.setOptionSets( new ArrayList( optionService.getAllOptionSets() ) ); } if ( exportOptions.isDataElementGroups() ) { - dxf2.setDataElementGroups( new HashSet( dataElementService.getAllDataElementGroups() ) ); + dxf2.setDataElementGroups( new ArrayList( dataElementService.getAllDataElementGroups() ) ); } if ( exportOptions.isDataElementGroupSets() ) { - dxf2.setDataElementGroupSets( new HashSet( dataElementService.getAllDataElementGroupSets() ) ); + dxf2.setDataElementGroupSets( new ArrayList( dataElementService.getAllDataElementGroupSets() ) ); } if ( exportOptions.isCategories() ) { - dxf2.setCategories( new HashSet( dataElementCategoryService.getAllDataElementCategories() ) ); + dxf2.setCategories( new ArrayList( dataElementCategoryService.getAllDataElementCategories() ) ); } if ( exportOptions.isCategoryOptions() ) { - dxf2.setCategoryOptions( new HashSet( dataElementCategoryService.getAllDataElementCategoryOptions() ) ); + dxf2.setCategoryOptions( new ArrayList( dataElementCategoryService.getAllDataElementCategoryOptions() ) ); } if ( exportOptions.isCategoryCombos() ) { - dxf2.setCategoryCombos( new HashSet( dataElementCategoryService.getAllDataElementCategoryCombos() ) ); + dxf2.setCategoryCombos( new ArrayList( dataElementCategoryService.getAllDataElementCategoryCombos() ) ); } if ( exportOptions.isCategoryOptionCombos() ) { - dxf2.setCategoryOptionCombos( new HashSet( dataElementCategoryService.getAllDataElementCategoryOptionCombos() ) ); + dxf2.setCategoryOptionCombos( new ArrayList( dataElementCategoryService.getAllDataElementCategoryOptionCombos() ) ); } if ( exportOptions.isIndicators() ) { - dxf2.setIndicators( new HashSet( indicatorService.getAllIndicators() ) ); + dxf2.setIndicators( new ArrayList( indicatorService.getAllIndicators() ) ); } if ( exportOptions.isIndicatorGroups() ) { - dxf2.setIndicatorGroups( new HashSet( indicatorService.getAllIndicatorGroups() ) ); + dxf2.setIndicatorGroups( new ArrayList( indicatorService.getAllIndicatorGroups() ) ); } if ( exportOptions.isIndicatorGroupSets() ) { - dxf2.setIndicatorGroupSets( new HashSet( indicatorService.getAllIndicatorGroupSets() ) ); + dxf2.setIndicatorGroupSets( new ArrayList( indicatorService.getAllIndicatorGroupSets() ) ); } if ( exportOptions.isIndicatorTypes() ) { - dxf2.setIndicatorTypes( new HashSet( indicatorService.getAllIndicatorTypes() ) ); + dxf2.setIndicatorTypes( new ArrayList( indicatorService.getAllIndicatorTypes() ) ); } if ( exportOptions.isOrganisationUnits() ) { - dxf2.setOrganisationUnits( new HashSet( organisationUnitService.getAllOrganisationUnits() ) ); + dxf2.setOrganisationUnits( new ArrayList( organisationUnitService.getAllOrganisationUnits() ) ); } if ( exportOptions.isOrganisationUnitLevels() ) { - dxf2.setOrganisationUnitLevels( new HashSet( organisationUnitService.getOrganisationUnitLevels() ) ); + dxf2.setOrganisationUnitLevels( new ArrayList( organisationUnitService.getOrganisationUnitLevels() ) ); } if ( exportOptions.isOrganisationUnitGroups() ) { - dxf2.setOrganisationUnitGroups( new HashSet( organisationUnitGroupService.getAllOrganisationUnitGroups() ) ); + dxf2.setOrganisationUnitGroups( new ArrayList( organisationUnitGroupService.getAllOrganisationUnitGroups() ) ); } if ( exportOptions.isOrganisationUnitGroupSets() ) { - dxf2.setOrganisationUnitGroupSets( new HashSet( organisationUnitGroupService.getAllOrganisationUnitGroupSets() ) ); + dxf2.setOrganisationUnitGroupSets( new ArrayList( organisationUnitGroupService.getAllOrganisationUnitGroupSets() ) ); } if ( exportOptions.isDataSets() ) { - dxf2.setDataSets( new HashSet( dataSetService.getAllDataSets() ) ); + dxf2.setDataSets( new ArrayList( dataSetService.getAllDataSets() ) ); } if ( exportOptions.isValidationRules() ) { - dxf2.setValidationRules( new HashSet( validationRuleService.getAllValidationRules() ) ); + dxf2.setValidationRules( new ArrayList( validationRuleService.getAllValidationRules() ) ); } if ( exportOptions.isValidationRuleGroups() ) { - dxf2.setValidationRuleGroups( new HashSet( validationRuleService.getAllValidationRuleGroups() ) ); + dxf2.setValidationRuleGroups( new ArrayList( validationRuleService.getAllValidationRuleGroups() ) ); } if ( exportOptions.isSqlViews() ) { - dxf2.setSqlViews( new HashSet( sqlViewService.getAllSqlViews() ) ); + dxf2.setSqlViews( new ArrayList( sqlViewService.getAllSqlViews() ) ); } if ( exportOptions.isDocuments() ) { - dxf2.setDocuments( new HashSet( documentService.getAllDocuments() ) ); + dxf2.setDocuments( new ArrayList( documentService.getAllDocuments() ) ); } if ( exportOptions.isReportTables() ) { - dxf2.setReportTables( new HashSet( reportTableService.getAllReportTables() ) ); + dxf2.setReportTables( new ArrayList( reportTableService.getAllReportTables() ) ); } if ( exportOptions.isReports() ) { - dxf2.setReports( new HashSet( reportService.getAllReports() ) ); + dxf2.setReports( new ArrayList( reportService.getAllReports() ) ); } if ( exportOptions.isCharts() ) { - dxf2.setCharts( new HashSet( chartService.getAllCharts() ) ); + dxf2.setCharts( new ArrayList( chartService.getAllCharts() ) ); } if ( exportOptions.isMaps() ) { - dxf2.setMaps( new HashSet( mappingService.getAllMapViews() ) ); + dxf2.setMaps( new ArrayList( mappingService.getAllMapViews() ) ); } if ( exportOptions.isMapLegends() ) { - dxf2.setMapLegends( new HashSet( mappingService.getAllMapLegends() ) ); + dxf2.setMapLegends( new ArrayList( mappingService.getAllMapLegends() ) ); } if ( exportOptions.isMapLegendSets() ) { - dxf2.setMapLegendSets( new HashSet( mappingService.getAllMapLegendSets() ) ); + dxf2.setMapLegendSets( new ArrayList( mappingService.getAllMapLegendSets() ) ); } if ( exportOptions.isMapLayers() ) { - dxf2.setMapLayers( new HashSet( mappingService.getAllMapLayers() ) ); + dxf2.setMapLayers( new ArrayList( mappingService.getAllMapLayers() ) ); } if ( exportOptions.isDataDictionaries() ) { - dxf2.setDataDictionaries( new HashSet( dataDictionaryService.getAllDataDictionaries() ) ); + dxf2.setDataDictionaries( new ArrayList( dataDictionaryService.getAllDataDictionaries() ) ); } return dxf2; === modified 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 2012-04-02 17:23:48 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java 2012-04-03 10:24:37 +0000 @@ -27,36 +27,16 @@ * 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.ImportCount; 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.Collection; +import java.util.HashSet; import java.util.List; import java.util.Set; @@ -124,15 +104,54 @@ private DocumentService documentService; @Autowired - private ConstantService constantService; - - @Autowired private MappingService mappingService; @Autowired private DataDictionaryService dataDictionaryService; */ + @Autowired + private Set importerClasses = new HashSet(); + + private Importer findImporterClass( Collection clazzes ) + { + if ( clazzes.size() > 0 ) + { + IdentifiableObject identifiableObject = clazzes.iterator().next(); + + return findImporterClass( identifiableObject.getClass() ); + } + + return null; + } + + private Importer findImporterClass( Class clazz ) + { + for ( Importer i : importerClasses ) + { + if ( i.canHandle( clazz ) ) + { + return i; + } + } + + return null; + } + + private void doImport( Collection objects, ImportOptions importOptions, ImportSummary importSummary ) + { + Importer importer = findImporterClass( objects ); + + if ( importer != null ) + { + List conflicts = importer.importCollection( objects, importOptions ); + ImportCount count = importer.getImportCount(); + + importSummary.getConflicts().addAll( conflicts ); + importSummary.getCounts().add( count ); + } + } + //------------------------------------------------------------------------------------------------------- // ImportService Implementation //------------------------------------------------------------------------------------------------------- @@ -146,6 +165,12 @@ @Override public ImportSummary importDxf2WithImportOptions( DXF2 dxf2, ImportOptions importOptions ) { - return new ImportSummary(); + ImportSummary importSummary = new ImportSummary(); + + // Imports.. this could be made even more generic, just need to make sure that everything is imported in + // the correct order + doImport( dxf2.getConstants(), importOptions, importSummary ); + + return importSummary; } } === modified 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 2012-04-02 17:23:48 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ImportStrategy.java 2012-04-03 10:24:37 +0000 @@ -27,7 +27,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - /** * @author Morten Olav Hansen */ === added file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Importer.java' --- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Importer.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Importer.java 2012-04-03 10:24:37 +0000 @@ -0,0 +1,48 @@ +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.ImportConflict; +import org.hisp.dhis.dxf2.importsummary.ImportCount; + +import java.util.Collection; +import java.util.List; + +/** + * @author Morten Olav Hansen + */ +public interface Importer +{ + ImportConflict importObject( T object, ImportOptions options ); + + List importCollection( Collection objects, ImportOptions options ); + + ImportCount getImportCount(); + + boolean canHandle( Class clazz ); +} === added directory 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers' === added file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.java' --- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/AbstractImporter.java 2012-04-03 10:24:37 +0000 @@ -0,0 +1,180 @@ +package org.hisp.dhis.dxf2.metadata.importers; + +/* + * 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.common.IdentifiableObject; +import org.hisp.dhis.common.IdentifiableObjectManager; +import org.hisp.dhis.dxf2.importsummary.ImportConflict; +import org.hisp.dhis.dxf2.importsummary.ImportCount; +import org.hisp.dhis.dxf2.metadata.IdScheme; +import org.hisp.dhis.dxf2.metadata.ImportOptions; +import org.hisp.dhis.dxf2.metadata.Importer; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * @author Morten Olav Hansen + */ +public abstract class AbstractImporter + implements Importer +{ + @Autowired + private IdentifiableObjectManager manager; + + protected int imports; + + protected int updates; + + protected int ignores; + + protected abstract void newObject( T object ); + + protected abstract void updatedObject( T object, T oldObject ); + + protected abstract String getObjectName(); + + @Override + public List importCollection( Collection objects, ImportOptions options ) + { + imports = 0; + updates = 0; + ignores = 0; + + List conflicts = new ArrayList(); + + for ( T object : objects ) + { + ImportConflict importConflict = importObject( object, options ); + + if ( importConflict != null ) + { + conflicts.add( importConflict ); + } + } + + return conflicts; + } + + @Override + public ImportConflict importObject( T object, ImportOptions options ) + { + Map map = getIdMap( (Class) object.getClass(), options.getIdScheme() ); + String identifier = getIdentifier( object, options.getIdScheme() ); + T oldObject = map.get( identifier ); + + if ( options.getImportStrategy().isNewStrategy() ) + { + if ( oldObject != null ) + { + ignores++; + return new ImportConflict( object.getClass().getName(), "Strategy is new, but identifier '" + identifier + "' already exists." ); + } + + imports++; + newObject( object ); + } + else if ( options.getImportStrategy().isUpdatesStrategy() ) + { + if ( oldObject == null ) + { + ignores++; + return new ImportConflict( object.getClass().getName(), "Strategy is updates, but identifier '" + identifier + "' does not exist." ); + } + + updates++; + updatedObject( object, oldObject ); + } + else if ( options.getImportStrategy().isNewAndUpdatesStrategy() ) + { + if ( oldObject != null ) + { + updates++; + updatedObject( object, oldObject ); + } + else + { + imports++; + newObject( object ); + } + } + + return null; + } + + @Override + public ImportCount getImportCount() + { + ImportCount importCount = new ImportCount( getObjectName() ); + + importCount.setImports( imports ); + importCount.setUpdates( updates ); + importCount.setIgnores( ignores ); + + return importCount; + } + + protected Map getIdMap( Class clazz, IdScheme scheme ) + { + if ( scheme.isUidScheme() ) + { + return manager.getIdMap( clazz, IdentifiableObject.IdentifiableProperty.UID ); + } + else if ( scheme.isNameScheme() ) + { + return manager.getIdMap( clazz, IdentifiableObject.IdentifiableProperty.NAME ); + } + else if ( scheme.isCodeScheme() ) + { + return manager.getIdMap( clazz, IdentifiableObject.IdentifiableProperty.CODE ); + } + + return null; + } + + protected String getIdentifier( T object, IdScheme scheme ) + { + if ( scheme.isUidScheme() ) + { + return object.getUid(); + } + else if ( scheme.isNameScheme() ) + { + return object.getName(); + } + else if ( scheme.isCodeScheme() ) + { + return object.getCode(); + } + + return null; + } +} === added file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/ConstantImporter.java' --- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/ConstantImporter.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/ConstantImporter.java 2012-04-03 10:24:37 +0000 @@ -0,0 +1,67 @@ +package org.hisp.dhis.dxf2.metadata.importers; + +/* + * 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.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.hisp.dhis.constant.Constant; +import org.springframework.stereotype.Component; + +/** + * @author Morten Olav Hansen + */ +@Component +public class ConstantImporter + extends AbstractImporter +{ + protected static final Log LOG = LogFactory.getLog( ConstantImporter.class ); + + @Override + protected void newObject( Constant constant ) + { + LOG.info( "NEW OBJECT: " + constant ); + } + + @Override + protected void updatedObject( Constant constant, Constant oldConstant ) + { + LOG.info( "UPDATED OBJECT: " + constant + ", OLD OBJECT: " + oldConstant ); + } + + @Override + protected String getObjectName() + { + return this.getClass().getName(); + } + + @Override + public boolean canHandle( Class clazz ) + { + return Constant.class.equals( clazz ); + } +}