← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7054: (webapi) Added AbstractCrudController for generic CRUD functionality (only used by dataElementCon...

 

------------------------------------------------------------
revno: 7054
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-05-27 23:50:00 +0200
message:
  (webapi) Added AbstractCrudController for generic CRUD functionality (only used by dataElementController for now). Adds lastUpdated=dd/MM/yyyy, MM/yyyy, yyyy. Adds viewClass=export, detailed, basic. Changes root element of collection classes (only for dataElements for now).
removed:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/HibernateObjectPersister.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ObjectPersister.java
added:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/WebMetaData.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/WebOptions.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java
  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/MetaData.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Options.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeTypeController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ConstantController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DashboardContentController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DocumentController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java
  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/ReportController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SmsConfigurationController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SqlViewController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryComboController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryOptionComboController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryOptionController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorTypeController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapLayerController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapLegendController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapLegendSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitGroupSetController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitLevelController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserAuthorityGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/validation/ValidationRuleController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/validation/ValidationRuleGroupController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonJsonView.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonXmlView.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/IdentifiableObjectManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java	2012-05-16 09:54:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java	2012-05-27 21:50:00 +0000
@@ -70,4 +70,6 @@
     IdentifiableObject getObject( String uid, String simpleClassName );
 
     IdentifiableObject getObject( int id, String simpleClassName );
+
+    <T extends IdentifiableObject> int getCount( Class<T> clazz );
 }

=== 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-05-26 16:15:25 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultExportService.java	2012-05-27 21:50:00 +0000
@@ -75,7 +75,7 @@
 
         log.info( "User '" + currentUserService.getCurrentUsername() + "' started export at " + new Date() );
 
-        Date lastUpdated = options.getDate( "lastUpdated" );
+        Date lastUpdated = options.getLastUpdated();
 
         for ( Map.Entry<String, Class<?>> entry : ExchangeClasses.getExportMap().entrySet() )
         {

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java	2012-05-16 18:08:43 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java	2012-05-27 21:50:00 +0000
@@ -73,79 +73,79 @@
 @JacksonXmlRootElement( localName = "metaData", namespace = Dxf2Namespace.NAMESPACE )
 public class MetaData
 {
-    private List<Attribute> attributeTypes = new ArrayList<Attribute>();
-
-    private List<Document> documents = new ArrayList<Document>();
-
-    private List<Constant> constants = new ArrayList<Constant>();
-
-    private List<Concept> concepts = new ArrayList<Concept>();
-
-    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<OptionSet> optionSets = new ArrayList<OptionSet>();
-
-    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<DataElement> dataElements = new ArrayList<DataElement>();
-
-    private List<DataElementGroup> dataElementGroups = new ArrayList<DataElementGroup>();
-
-    private List<DataElementGroupSet> dataElementGroupSets = new ArrayList<DataElementGroupSet>();
-
-    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<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<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 List<Section> sections = new ArrayList<Section>(  );
-
-    private List<DataSet> dataSets = new ArrayList<DataSet>();
+    private List<Attribute> attributeTypeList = new ArrayList<Attribute>();
+
+    private List<Document> documentList = new ArrayList<Document>();
+
+    private List<Constant> constantList = new ArrayList<Constant>();
+
+    private List<Concept> conceptList = new ArrayList<Concept>();
+
+    private List<User> userList = new ArrayList<User>();
+
+    private List<UserAuthorityGroup> userAuthorityGroupList = new ArrayList<UserAuthorityGroup>();
+
+    private List<UserGroup> userGroupList = new ArrayList<UserGroup>();
+
+    private List<MessageConversation> messageConversationList = new ArrayList<MessageConversation>();
+
+    private List<OptionSet> optionSetList = new ArrayList<OptionSet>();
+
+    private List<DataElementCategory> categoryList = new ArrayList<DataElementCategory>();
+
+    private List<DataElementCategoryOption> categoryOptionList = new ArrayList<DataElementCategoryOption>();
+
+    private List<DataElementCategoryCombo> categoryComboList = new ArrayList<DataElementCategoryCombo>();
+
+    private List<DataElementCategoryOptionCombo> categoryOptionComboList = new ArrayList<DataElementCategoryOptionCombo>();
+
+    private List<DataElement> dataElementList = new ArrayList<DataElement>();
+
+    private List<DataElementGroup> dataElementGroupList = new ArrayList<DataElementGroup>();
+
+    private List<DataElementGroupSet> dataElementGroupSetList = new ArrayList<DataElementGroupSet>();
+
+    private List<Indicator> indicatorList = new ArrayList<Indicator>();
+
+    private List<IndicatorGroup> indicatorGroupList = new ArrayList<IndicatorGroup>();
+
+    private List<IndicatorGroupSet> indicatorGroupSetList = new ArrayList<IndicatorGroupSet>();
+
+    private List<IndicatorType> indicatorTypeList = new ArrayList<IndicatorType>();
+
+    private List<OrganisationUnit> organisationUnitList = new ArrayList<OrganisationUnit>();
+
+    private List<OrganisationUnitGroup> organisationUnitGroupList = new ArrayList<OrganisationUnitGroup>();
+
+    private List<OrganisationUnitGroupSet> organisationUnitGroupSetList = new ArrayList<OrganisationUnitGroupSet>();
+
+    private List<OrganisationUnitLevel> organisationUnitLevelList = new ArrayList<OrganisationUnitLevel>();
+
+    private List<ValidationRule> validationRuleList = new ArrayList<ValidationRule>();
+
+    private List<ValidationRuleGroup> validationRuleGroupList = new ArrayList<ValidationRuleGroup>();
+
+    private List<SqlView> sqlViewList = new ArrayList<SqlView>();
+
+    private List<Chart> chartList = new ArrayList<Chart>();
+
+    private List<Report> reportList = new ArrayList<Report>();
+
+    private List<ReportTable> reportTableList = new ArrayList<ReportTable>();
+
+    private List<MapView> mapList = new ArrayList<MapView>();
+
+    private List<MapLegend> mapLegendList = new ArrayList<MapLegend>();
+
+    private List<MapLegendSet> mapLegendSetList = new ArrayList<MapLegendSet>();
+
+    private List<MapLayer> mapLayerList = new ArrayList<MapLayer>();
+
+    private List<DataDictionary> dataDictionaryList = new ArrayList<DataDictionary>();
+
+    private List<Section> sectionList = new ArrayList<Section>(  );
+
+    private List<DataSet> dataSetList = new ArrayList<DataSet>();
 
     public MetaData()
     {
@@ -154,525 +154,525 @@
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "attributeTypes", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "attributeType", namespace = Dxf2Namespace.NAMESPACE )
-    public List<Attribute> getAttributeTypes()
+    public List<Attribute> getAttributeTypeList()
     {
-        return attributeTypes;
+        return attributeTypeList;
     }
 
-    public void setAttributeTypes( List<Attribute> attributeTypes )
+    public void setAttributeTypeList( List<Attribute> attributeTypeList )
     {
-        this.attributeTypes = attributeTypes;
+        this.attributeTypeList = attributeTypeList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "users", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "user", namespace = Dxf2Namespace.NAMESPACE )
-    public List<User> getUsers()
+    public List<User> getUserList()
     {
-        return users;
+        return userList;
     }
 
-    public void setUsers( List<User> users )
+    public void setUserList( List<User> userList )
     {
-        this.users = users;
+        this.userList = userList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "userAuthorityGroups", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "userAuthorityGroup", namespace = Dxf2Namespace.NAMESPACE )
-    public List<UserAuthorityGroup> getUserAuthorityGroups()
+    public List<UserAuthorityGroup> getUserAuthorityGroupList()
     {
-        return userAuthorityGroups;
+        return userAuthorityGroupList;
     }
 
-    public void setUserAuthorityGroups( List<UserAuthorityGroup> userAuthorityGroups )
+    public void setUserAuthorityGroupList( List<UserAuthorityGroup> userAuthorityGroupList )
     {
-        this.userAuthorityGroups = userAuthorityGroups;
+        this.userAuthorityGroupList = userAuthorityGroupList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "userGroups", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "userGroup", namespace = Dxf2Namespace.NAMESPACE )
-    public List<UserGroup> getUserGroups()
+    public List<UserGroup> getUserGroupList()
     {
-        return userGroups;
+        return userGroupList;
     }
 
-    public void setUserGroups( List<UserGroup> userGroups )
+    public void setUserGroupList( List<UserGroup> userGroupList )
     {
-        this.userGroups = userGroups;
+        this.userGroupList = userGroupList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "messageConversations", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "messageConversation", namespace = Dxf2Namespace.NAMESPACE )
-    public List<MessageConversation> getMessageConversations()
+    public List<MessageConversation> getMessageConversationList()
     {
-        return messageConversations;
+        return messageConversationList;
     }
 
-    public void setMessageConversations( List<MessageConversation> messageConversations )
+    public void setMessageConversationList( List<MessageConversation> messageConversationList )
     {
-        this.messageConversations = messageConversations;
+        this.messageConversationList = messageConversationList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "dataElements", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "dataElement", namespace = Dxf2Namespace.NAMESPACE )
-    public List<DataElement> getDataElements()
+    public List<DataElement> getDataElementList()
     {
-        return dataElements;
+        return dataElementList;
     }
 
-    public void setDataElements( List<DataElement> dataElements )
+    public void setDataElementList( List<DataElement> dataElementList )
     {
-        this.dataElements = dataElements;
+        this.dataElementList = dataElementList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "optionSets", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "optionSet", namespace = Dxf2Namespace.NAMESPACE )
-    public List<OptionSet> getOptionSets()
+    public List<OptionSet> getOptionSetList()
     {
-        return optionSets;
+        return optionSetList;
     }
 
-    public void setOptionSets( List<OptionSet> optionSets )
+    public void setOptionSetList( List<OptionSet> optionSetList )
     {
-        this.optionSets = optionSets;
+        this.optionSetList = optionSetList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "dataElementGroups", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "dataElementGroup", namespace = Dxf2Namespace.NAMESPACE )
-    public List<DataElementGroup> getDataElementGroups()
+    public List<DataElementGroup> getDataElementGroupList()
     {
-        return dataElementGroups;
+        return dataElementGroupList;
     }
 
-    public void setDataElementGroups( List<DataElementGroup> dataElementGroups )
+    public void setDataElementGroupList( List<DataElementGroup> dataElementGroupList )
     {
-        this.dataElementGroups = dataElementGroups;
+        this.dataElementGroupList = dataElementGroupList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "dataElementGroupSets", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "dataElementGroupSet", namespace = Dxf2Namespace.NAMESPACE )
-    public List<DataElementGroupSet> getDataElementGroupSets()
+    public List<DataElementGroupSet> getDataElementGroupSetList()
     {
-        return dataElementGroupSets;
+        return dataElementGroupSetList;
     }
 
-    public void setDataElementGroupSets( List<DataElementGroupSet> dataElementGroupSets )
+    public void setDataElementGroupSetList( List<DataElementGroupSet> dataElementGroupSetList )
     {
-        this.dataElementGroupSets = dataElementGroupSets;
+        this.dataElementGroupSetList = dataElementGroupSetList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "concepts", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "concept", namespace = Dxf2Namespace.NAMESPACE )
-    public List<Concept> getConcepts()
+    public List<Concept> getConceptList()
     {
-        return concepts;
+        return conceptList;
     }
 
-    public void setConcepts( List<Concept> concepts )
+    public void setConceptList( List<Concept> conceptList )
     {
-        this.concepts = concepts;
+        this.conceptList = conceptList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "categories", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "category", namespace = Dxf2Namespace.NAMESPACE )
-    public List<DataElementCategory> getCategories()
+    public List<DataElementCategory> getCategoryList()
     {
-        return categories;
+        return categoryList;
     }
 
-    public void setCategories( List<DataElementCategory> categories )
+    public void setCategoryList( List<DataElementCategory> categoryList )
     {
-        this.categories = categories;
+        this.categoryList = categoryList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "categoryOptions", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "categoryOption", namespace = Dxf2Namespace.NAMESPACE )
-    public List<DataElementCategoryOption> getCategoryOptions()
+    public List<DataElementCategoryOption> getCategoryOptionList()
     {
-        return categoryOptions;
+        return categoryOptionList;
     }
 
-    public void setCategoryOptions( List<DataElementCategoryOption> categoryOptions )
+    public void setCategoryOptionList( List<DataElementCategoryOption> categoryOptionList )
     {
-        this.categoryOptions = categoryOptions;
+        this.categoryOptionList = categoryOptionList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "categoryCombos", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "categoryCombo", namespace = Dxf2Namespace.NAMESPACE )
-    public List<DataElementCategoryCombo> getCategoryCombos()
+    public List<DataElementCategoryCombo> getCategoryComboList()
     {
-        return categoryCombos;
+        return categoryComboList;
     }
 
-    public void setCategoryCombos( List<DataElementCategoryCombo> categoryCombos )
+    public void setCategoryComboList( List<DataElementCategoryCombo> categoryComboList )
     {
-        this.categoryCombos = categoryCombos;
+        this.categoryComboList = categoryComboList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "categoryOptionCombos", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "categoryOptionCombo", namespace = Dxf2Namespace.NAMESPACE )
-    public List<DataElementCategoryOptionCombo> getCategoryOptionCombos()
+    public List<DataElementCategoryOptionCombo> getCategoryOptionComboList()
     {
-        return categoryOptionCombos;
+        return categoryOptionComboList;
     }
 
-    public void setCategoryOptionCombos( List<DataElementCategoryOptionCombo> categoryOptionCombos )
+    public void setCategoryOptionComboList( List<DataElementCategoryOptionCombo> categoryOptionComboList )
     {
-        this.categoryOptionCombos = categoryOptionCombos;
+        this.categoryOptionComboList = categoryOptionComboList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "indicators", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "indicator", namespace = Dxf2Namespace.NAMESPACE )
-    public List<Indicator> getIndicators()
+    public List<Indicator> getIndicatorList()
     {
-        return indicators;
+        return indicatorList;
     }
 
-    public void setIndicators( List<Indicator> indicators )
+    public void setIndicatorList( List<Indicator> indicatorList )
     {
-        this.indicators = indicators;
+        this.indicatorList = indicatorList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "indicatorGroups", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "indicatorGroup", namespace = Dxf2Namespace.NAMESPACE )
-    public List<IndicatorGroup> getIndicatorGroups()
+    public List<IndicatorGroup> getIndicatorGroupList()
     {
-        return indicatorGroups;
+        return indicatorGroupList;
     }
 
-    public void setIndicatorGroups( List<IndicatorGroup> indicatorGroups )
+    public void setIndicatorGroupList( List<IndicatorGroup> indicatorGroupList )
     {
-        this.indicatorGroups = indicatorGroups;
+        this.indicatorGroupList = indicatorGroupList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "indicatorGroupSets", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "indicatorGroupSet", namespace = Dxf2Namespace.NAMESPACE )
-    public List<IndicatorGroupSet> getIndicatorGroupSets()
+    public List<IndicatorGroupSet> getIndicatorGroupSetList()
     {
-        return indicatorGroupSets;
+        return indicatorGroupSetList;
     }
 
-    public void setIndicatorGroupSets( List<IndicatorGroupSet> indicatorGroupSets )
+    public void setIndicatorGroupSetList( List<IndicatorGroupSet> indicatorGroupSetList )
     {
-        this.indicatorGroupSets = indicatorGroupSets;
+        this.indicatorGroupSetList = indicatorGroupSetList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "indicatorTypes", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "indicatorType", namespace = Dxf2Namespace.NAMESPACE )
-    public List<IndicatorType> getIndicatorTypes()
+    public List<IndicatorType> getIndicatorTypeList()
     {
-        return indicatorTypes;
+        return indicatorTypeList;
     }
 
-    public void setIndicatorTypes( List<IndicatorType> indicatorTypes )
+    public void setIndicatorTypeList( List<IndicatorType> indicatorTypeList )
     {
-        this.indicatorTypes = indicatorTypes;
+        this.indicatorTypeList = indicatorTypeList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "organisationUnits", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "organisationUnit", namespace = Dxf2Namespace.NAMESPACE )
-    public List<OrganisationUnit> getOrganisationUnits()
+    public List<OrganisationUnit> getOrganisationUnitList()
     {
-        return organisationUnits;
+        return organisationUnitList;
     }
 
-    public void setOrganisationUnits( List<OrganisationUnit> organisationUnits )
+    public void setOrganisationUnitList( List<OrganisationUnit> organisationUnitList )
     {
-        this.organisationUnits = organisationUnits;
+        this.organisationUnitList = organisationUnitList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "organisationUnitGroups", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "organisationUnitGroup", namespace = Dxf2Namespace.NAMESPACE )
-    public List<OrganisationUnitGroup> getOrganisationUnitGroups()
+    public List<OrganisationUnitGroup> getOrganisationUnitGroupList()
     {
-        return organisationUnitGroups;
+        return organisationUnitGroupList;
     }
 
-    public void setOrganisationUnitGroups( List<OrganisationUnitGroup> organisationUnitGroups )
+    public void setOrganisationUnitGroupList( List<OrganisationUnitGroup> organisationUnitGroupList )
     {
-        this.organisationUnitGroups = organisationUnitGroups;
+        this.organisationUnitGroupList = organisationUnitGroupList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "organisationUnitGroupSets", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "organisationUnitGroupSet", namespace = Dxf2Namespace.NAMESPACE )
-    public List<OrganisationUnitGroupSet> getOrganisationUnitGroupSets()
+    public List<OrganisationUnitGroupSet> getOrganisationUnitGroupSetList()
     {
-        return organisationUnitGroupSets;
+        return organisationUnitGroupSetList;
     }
 
-    public void setOrganisationUnitGroupSets( List<OrganisationUnitGroupSet> organisationUnitGroupSets )
+    public void setOrganisationUnitGroupSetList( List<OrganisationUnitGroupSet> organisationUnitGroupSetList )
     {
-        this.organisationUnitGroupSets = organisationUnitGroupSets;
+        this.organisationUnitGroupSetList = organisationUnitGroupSetList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "organisationUnitLevels", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "organisationUnitLevel", namespace = Dxf2Namespace.NAMESPACE )
-    public List<OrganisationUnitLevel> getOrganisationUnitLevels()
+    public List<OrganisationUnitLevel> getOrganisationUnitLevelList()
     {
-        return organisationUnitLevels;
+        return organisationUnitLevelList;
     }
 
-    public void setOrganisationUnitLevels( List<OrganisationUnitLevel> organisationUnitLevels )
+    public void setOrganisationUnitLevelList( List<OrganisationUnitLevel> organisationUnitLevelList )
     {
-        this.organisationUnitLevels = organisationUnitLevels;
+        this.organisationUnitLevelList = organisationUnitLevelList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "sections", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "section", namespace = Dxf2Namespace.NAMESPACE )
-    public List<Section> getSections()
+    public List<Section> getSectionList()
     {
-        return sections;
+        return sectionList;
     }
 
-    public void setSections( List<Section> sections )
+    public void setSectionList( List<Section> sectionList )
     {
-        this.sections = sections;
+        this.sectionList = sectionList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "dataSets", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "dataSet", namespace = Dxf2Namespace.NAMESPACE )
-    public List<DataSet> getDataSets()
+    public List<DataSet> getDataSetList()
     {
-        return dataSets;
+        return dataSetList;
     }
 
-    public void setDataSets( List<DataSet> dataSets )
+    public void setDataSetList( List<DataSet> dataSetList )
     {
-        this.dataSets = dataSets;
+        this.dataSetList = dataSetList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "validationRules", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "validationRule", namespace = Dxf2Namespace.NAMESPACE )
-    public List<ValidationRule> getValidationRules()
+    public List<ValidationRule> getValidationRuleList()
     {
-        return validationRules;
+        return validationRuleList;
     }
 
-    public void setValidationRules( List<ValidationRule> validationRules )
+    public void setValidationRuleList( List<ValidationRule> validationRuleList )
     {
-        this.validationRules = validationRules;
+        this.validationRuleList = validationRuleList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "validationRuleGroups", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "validationRuleGroup", namespace = Dxf2Namespace.NAMESPACE )
-    public List<ValidationRuleGroup> getValidationRuleGroups()
+    public List<ValidationRuleGroup> getValidationRuleGroupList()
     {
-        return validationRuleGroups;
+        return validationRuleGroupList;
     }
 
-    public void setValidationRuleGroups( List<ValidationRuleGroup> validationRuleGroups )
+    public void setValidationRuleGroupList( List<ValidationRuleGroup> validationRuleGroupList )
     {
-        this.validationRuleGroups = validationRuleGroups;
+        this.validationRuleGroupList = validationRuleGroupList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "sqlViews", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "sqlView", namespace = Dxf2Namespace.NAMESPACE )
-    public List<SqlView> getSqlViews()
+    public List<SqlView> getSqlViewList()
     {
-        return sqlViews;
+        return sqlViewList;
     }
 
-    public void setSqlViews( List<SqlView> sqlViews )
+    public void setSqlViewList( List<SqlView> sqlViewList )
     {
-        this.sqlViews = sqlViews;
+        this.sqlViewList = sqlViewList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "charts", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "chart", namespace = Dxf2Namespace.NAMESPACE )
-    public List<Chart> getCharts()
+    public List<Chart> getChartList()
     {
-        return charts;
+        return chartList;
     }
 
-    public void setCharts( List<Chart> charts )
+    public void setChartList( List<Chart> chartList )
     {
-        this.charts = charts;
+        this.chartList = chartList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "reports", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "report", namespace = Dxf2Namespace.NAMESPACE )
-    public List<Report> getReports()
+    public List<Report> getReportList()
     {
-        return reports;
+        return reportList;
     }
 
-    public void setReports( List<Report> reports )
+    public void setReportList( List<Report> reportList )
     {
-        this.reports = reports;
+        this.reportList = reportList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "reportTables", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "reportTable", namespace = Dxf2Namespace.NAMESPACE )
-    public List<ReportTable> getReportTables()
+    public List<ReportTable> getReportTableList()
     {
-        return reportTables;
+        return reportTableList;
     }
 
-    public void setReportTables( List<ReportTable> reportTables )
+    public void setReportTableList( List<ReportTable> reportTableList )
     {
-        this.reportTables = reportTables;
+        this.reportTableList = reportTableList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "documents", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "document", namespace = Dxf2Namespace.NAMESPACE )
-    public List<Document> getDocuments()
+    public List<Document> getDocumentList()
     {
-        return documents;
+        return documentList;
     }
 
-    public void setDocuments( List<Document> documents )
+    public void setDocumentList( List<Document> documentList )
     {
-        this.documents = documents;
+        this.documentList = documentList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "constants", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "constant", namespace = Dxf2Namespace.NAMESPACE )
-    public List<Constant> getConstants()
+    public List<Constant> getConstantList()
     {
-        return constants;
+        return constantList;
     }
 
-    public void setConstants( List<Constant> constants )
+    public void setConstantList( List<Constant> constantList )
     {
-        this.constants = constants;
+        this.constantList = constantList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "maps", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "map", namespace = Dxf2Namespace.NAMESPACE )
-    public List<MapView> getMaps()
+    public List<MapView> getMapList()
     {
-        return maps;
+        return mapList;
     }
 
-    public void setMaps( List<MapView> maps )
+    public void setMapList( List<MapView> mapList )
     {
-        this.maps = maps;
+        this.mapList = mapList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "mapLegends", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "mapLegend", namespace = Dxf2Namespace.NAMESPACE )
-    public List<MapLegend> getMapLegends()
+    public List<MapLegend> getMapLegendList()
     {
-        return mapLegends;
+        return mapLegendList;
     }
 
-    public void setMapLegends( List<MapLegend> mapLegends )
+    public void setMapLegendList( List<MapLegend> mapLegendList )
     {
-        this.mapLegends = mapLegends;
+        this.mapLegendList = mapLegendList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "mapLegendSets", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "mapLegendSet", namespace = Dxf2Namespace.NAMESPACE )
-    public List<MapLegendSet> getMapLegendSets()
+    public List<MapLegendSet> getMapLegendSetList()
     {
-        return mapLegendSets;
+        return mapLegendSetList;
     }
 
-    public void setMapLegendSets( List<MapLegendSet> mapLegendSets )
+    public void setMapLegendSetList( List<MapLegendSet> mapLegendSetList )
     {
-        this.mapLegendSets = mapLegendSets;
+        this.mapLegendSetList = mapLegendSetList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "mapLayers", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "mapLayer", namespace = Dxf2Namespace.NAMESPACE )
-    public List<MapLayer> getMapLayers()
+    public List<MapLayer> getMapLayerList()
     {
-        return mapLayers;
+        return mapLayerList;
     }
 
-    public void setMapLayers( List<MapLayer> mapLayers )
+    public void setMapLayerList( List<MapLayer> mapLayerList )
     {
-        this.mapLayers = mapLayers;
+        this.mapLayerList = mapLayerList;
     }
 
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "dataDictionaries", namespace = Dxf2Namespace.NAMESPACE )
     @JacksonXmlProperty( localName = "dataDictionary", namespace = Dxf2Namespace.NAMESPACE )
-    public List<DataDictionary> getDataDictionaries()
+    public List<DataDictionary> getDataDictionaryList()
     {
-        return dataDictionaries;
+        return dataDictionaryList;
     }
 
-    public void setDataDictionaries( List<DataDictionary> dataDictionaries )
+    public void setDataDictionaryList( List<DataDictionary> dataDictionaryList )
     {
-        this.dataDictionaries = dataDictionaries;
+        this.dataDictionaryList = dataDictionaryList;
     }
 
     @Override
     public String toString()
     {
         return "MetaData{" +
-            "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() +
-            ", sections=" + sections.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() +
+            "attributeTypes=" + attributeTypeList.size() +
+            ", users=" + userList.size() +
+            ", userAuthorityGroups=" + userAuthorityGroupList.size() +
+            ", userGroups=" + userGroupList.size() +
+            ", messageConversations=" + messageConversationList.size() +
+            ", dataElements=" + dataElementList.size() +
+            ", optionSets=" + optionSetList.size() +
+            ", dataElementGroups=" + dataElementGroupList.size() +
+            ", dataElementGroupSets=" + dataElementGroupSetList.size() +
+            ", concepts=" + conceptList.size() +
+            ", categories=" + categoryList.size() +
+            ", categoryOptions=" + categoryOptionList.size() +
+            ", categoryCombos=" + categoryComboList.size() +
+            ", categoryOptionCombos=" + categoryOptionComboList.size() +
+            ", indicators=" + indicatorList.size() +
+            ", indicatorGroups=" + indicatorGroupList.size() +
+            ", indicatorGroupSets=" + indicatorGroupSetList.size() +
+            ", indicatorTypes=" + indicatorTypeList.size() +
+            ", organisationUnits=" + organisationUnitList.size() +
+            ", organisationUnitGroups=" + organisationUnitGroupList.size() +
+            ", organisationUnitGroupSets=" + organisationUnitGroupSetList.size() +
+            ", organisationUnitLevels=" + organisationUnitLevelList.size() +
+            ", sections=" + sectionList.size() +
+            ", dataSets=" + dataSetList.size() +
+            ", validationRules=" + validationRuleList.size() +
+            ", validationRuleGroups=" + validationRuleGroupList.size() +
+            ", sqlViews=" + sqlViewList.size() +
+            ", charts=" + chartList.size() +
+            ", reports=" + reportList.size() +
+            ", reportTables=" + reportTableList.size() +
+            ", documents=" + documentList.size() +
+            ", constants=" + constantList.size() +
+            ", maps=" + mapList.size() +
+            ", mapLegends=" + mapLegendList.size() +
+            ", mapLegendSets=" + mapLegendSetList.size() +
+            ", mapLayers=" + mapLayerList.size() +
+            ", dataDictionaries=" + dataDictionaryList.size() +
             '}';
     }
 }

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Options.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Options.java	2012-05-26 16:15:25 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/Options.java	2012-05-27 21:50:00 +0000
@@ -49,29 +49,101 @@
         return DEFAULT_OPTIONS;
     }
 
-    private static Date stringAsDate( String str )
+    protected static String stringAsString( String str, String defaultValue )
+    {
+        if ( str == null )
+        {
+            str = defaultValue;
+        }
+
+        return str;
+    }
+
+    protected static Date stringAsDate( String str )
     {
         if ( str == null )
         {
             return null;
         }
 
-        try
-        {
-            return new SimpleDateFormat( "dd/MM/yyyy" ).parse( str );
-        } catch ( ParseException ignored )
-        {
-        }
-
-        return null;
-    }
-
-    private static boolean stringAsBoolean( String str )
-    {
-        return str != null && str.equalsIgnoreCase( "true" );
-    }
-
-    private static boolean isTrue( String str )
+        String patterns[] = new String[]{
+            "dd/MM/yyyy",
+            "MM/yyyy",
+            "yyyy"
+        };
+
+        for(String pattern : patterns)
+        {
+            Date date = getDateByPattern(str, pattern);
+
+            if(date != null)
+            {
+                return date;
+            }
+        }
+
+        return null;
+    }
+
+    protected static Date getDateByPattern( String str, String pattern )
+    {
+        if ( str != null )
+        {
+            try
+            {
+                return new SimpleDateFormat( pattern ).parse( str );
+            } catch ( ParseException ignored )
+            {
+            }
+        }
+
+        return null;
+    }
+
+    protected static boolean stringAsBoolean( String str )
+    {
+        return stringAsBoolean( str, false );
+    }
+
+    protected static boolean stringAsBoolean( String str, boolean defaultValue )
+    {
+        if ( str != null )
+        {
+            if ( str.equalsIgnoreCase( "true" ) )
+            {
+                return true;
+            }
+            else if ( str.equalsIgnoreCase( "false" ) )
+            {
+                return false;
+            }
+        }
+
+        return defaultValue;
+    }
+
+
+    protected static int stringAsInt( String str )
+    {
+        return stringAsInt( str, 0 );
+    }
+
+    protected static int stringAsInt( String str, int defaultValue )
+    {
+        if ( str != null )
+        {
+            try
+            {
+                return Integer.parseInt( str );
+            } catch ( NumberFormatException ignored )
+            {
+            }
+        }
+
+        return defaultValue;
+    }
+
+    protected static boolean isTrue( String str )
     {
         return stringAsBoolean( str );
     }
@@ -80,9 +152,9 @@
     // Internal State
     //--------------------------------------------------------------------------
 
-    private Map<String, String> options = new HashMap<String, String>();
+    protected Map<String, String> options = new HashMap<String, String>();
 
-    private boolean assumeTrue;
+    protected boolean assumeTrue;
 
     //--------------------------------------------------------------------------
     // Constructors
@@ -127,7 +199,7 @@
 
     public Date getDate( String key )
     {
-        return stringAsDate( options.get( key ));
+        return stringAsDate( options.get( key ) );
     }
 
     //--------------------------------------------------------------------------
@@ -153,4 +225,13 @@
     {
         this.assumeTrue = assumeTrue;
     }
+
+    //--------------------------------------------------------------------------
+    // Getters for standard options
+    //--------------------------------------------------------------------------
+
+    public Date getLastUpdated()
+    {
+        return getDate( "lastUpdated" );
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2012-05-16 09:54:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2012-05-27 21:50:00 +0000
@@ -385,6 +385,23 @@
         return null;
     }
 
+    @Override
+    public <T extends IdentifiableObject> int getCount( Class<T> clazz )
+    {
+        GenericIdentifiableObjectStore<IdentifiableObject> store = getIdentifiableObjectStore( clazz );
+
+        if ( store != null )
+        {
+            return store.getCount();
+        }
+        else
+        {
+            log.warn( "No IdentifiableObject store found for " + clazz + " (getCount)." );
+        }
+
+        return 0;
+    }
+
     private <T extends IdentifiableObject> GenericIdentifiableObjectStore<IdentifiableObject> getIdentifiableObjectStore( Class<T> clazz )
     {
         GenericIdentifiableObjectStore<IdentifiableObject> store = identifiableObjectStoreMap.get( clazz );

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java	2012-05-27 21:50:00 +0000
@@ -0,0 +1,248 @@
+package org.hisp.dhis.api.controller;
+
+/*
+ * Copyright (c) 2004-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.api.utils.WebLinkPopulator;
+import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.IdentifiableObjectManager;
+import org.hisp.dhis.common.Pager;
+import org.hisp.dhis.dataelement.DataElement;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.ui.Model;
+import org.springframework.util.StringUtils;
+import org.springframework.web.HttpRequestMethodNotSupportedException;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.InputStream;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public abstract class AbstractCrudController<T extends IdentifiableObject>
+{
+    //-------------------------------------------------------------------------------------------------------
+    // Dependencies
+    //-------------------------------------------------------------------------------------------------------
+
+    @Autowired
+    protected IdentifiableObjectManager manager;
+
+    //-------------------------------------------------------------------------------------------------------
+    // GET
+    //-------------------------------------------------------------------------------------------------------
+
+    @SuppressWarnings( "unchecked" )
+    @RequestMapping( method = RequestMethod.GET )
+    public String getObjectList( @RequestParam Map<String, String> parameters, Model model, HttpServletRequest request ) throws Exception
+    {
+        WebOptions options = new WebOptions( parameters );
+        WebMetaData metaData = new WebMetaData();
+        List<T> entityList = getEntityList( metaData, options );
+        metaData.setDataElementList( (List<DataElement>) entityList );
+
+        if ( options.hasLinks() )
+        {
+            WebLinkPopulator populator = new WebLinkPopulator( request );
+            populator.addLinks( metaData );
+        }
+
+        model.addAttribute( "model", metaData );
+        model.addAttribute( "viewClass", options.getViewClass( "basic" ) );
+
+        return StringUtils.uncapitalize( getEntitySimpleName() ) + "List";
+    }
+
+    @RequestMapping( value = "/{uid}", method = RequestMethod.GET )
+    public String getObject( @PathVariable( "uid" ) String uid, @RequestParam Map<String, String> parameters, Model model, HttpServletRequest request ) throws Exception
+    {
+        WebOptions options = new WebOptions( parameters );
+        T entity = getEntity( uid );
+
+        if ( options.hasLinks() )
+        {
+            WebLinkPopulator populator = new WebLinkPopulator( request );
+            populator.addLinks( entity );
+        }
+
+        model.addAttribute( "model", entity );
+        model.addAttribute( "viewClass", options.getViewClass( "detailed" ) );
+
+        return StringUtils.uncapitalize( getEntitySimpleName() );
+    }
+
+    //-------------------------------------------------------------------------------------------------------
+    // POST
+    //-------------------------------------------------------------------------------------------------------
+
+    @RequestMapping( method = RequestMethod.POST, headers = { "Content-Type=application/xml, text/xml" } )
+    public void postXmlObject( HttpServletResponse response, InputStream input ) throws Exception
+    {
+        throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
+    }
+
+    @RequestMapping( method = RequestMethod.POST, headers = { "Content-Type=application/json" } )
+    public void postJsonObject( HttpServletResponse response, InputStream input ) throws Exception
+    {
+        throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
+    }
+
+    //-------------------------------------------------------------------------------------------------------
+    // PUT
+    //-------------------------------------------------------------------------------------------------------
+
+    @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, headers = { "Content-Type=application/xml, text/xml" } )
+    @ResponseStatus( value = HttpStatus.NO_CONTENT )
+    public void putXmlObject( @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
+    {
+        throw new HttpRequestMethodNotSupportedException( RequestMethod.PUT.toString() );
+    }
+
+    @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, headers = { "Content-Type=application/json" } )
+    @ResponseStatus( value = HttpStatus.NO_CONTENT )
+    public void putJsonObject( @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
+    {
+        throw new HttpRequestMethodNotSupportedException( RequestMethod.PUT.toString() );
+    }
+
+    //-------------------------------------------------------------------------------------------------------
+    // DELETE
+    //-------------------------------------------------------------------------------------------------------
+
+    @RequestMapping( value = "/{uid}", method = RequestMethod.DELETE )
+    @ResponseStatus( value = HttpStatus.NO_CONTENT )
+    public void deleteObject( @PathVariable( "uid" ) String uid ) throws Exception
+    {
+        throw new HttpRequestMethodNotSupportedException( RequestMethod.DELETE.toString() );
+    }
+
+    //-------------------------------------------------------------------------------------------------------
+    // Helpers
+    //-------------------------------------------------------------------------------------------------------
+
+    protected List<T> getEntityList( WebMetaData metaData, WebOptions options )
+    {
+        List<T> entityList;
+
+        Date lastUpdated = options.getLastUpdated();
+
+        if ( lastUpdated != null )
+        {
+            entityList = new ArrayList<T>( manager.getByLastUpdated( getEntityClass(), lastUpdated ) );
+        }
+        else if ( options.hasPaging() )
+        {
+            int count = manager.getCount( getEntityClass() );
+
+            Pager pager = new Pager( options.getPage(), count );
+            metaData.setPager( pager );
+
+            entityList = new ArrayList<T>( manager.getBetween( getEntityClass(), pager.getOffset(), pager.getPageSize() ) );
+
+        }
+        else
+        {
+            entityList = new ArrayList<T>( manager.getAll( getEntityClass() ) );
+        }
+
+        return entityList;
+    }
+
+    protected T getEntity( String uid )
+    {
+        return manager.get( getEntityClass(), uid );
+    }
+
+    //-------------------------------------------------------------------------------------------------------
+    // Reflection helpers
+    //-------------------------------------------------------------------------------------------------------
+
+    private Class<T> entityClass;
+
+    private String entityName;
+
+    private String entitySimpleName;
+
+    @SuppressWarnings( "unchecked" )
+    protected Class<T> getEntityClass()
+    {
+        if ( entityClass == null )
+        {
+            Type[] actualTypeArguments = ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments();
+            entityClass = (Class<T>) actualTypeArguments[0];
+        }
+
+        return entityClass;
+    }
+
+    protected String getEntityName()
+    {
+        if ( entityName == null )
+        {
+            entityName = getEntityClass().getName();
+        }
+
+        return entityName;
+    }
+
+    protected String getEntitySimpleName()
+    {
+        if ( entitySimpleName == null )
+        {
+            entitySimpleName = getEntityClass().getSimpleName();
+        }
+
+        return entitySimpleName;
+    }
+
+    @SuppressWarnings( "unchecked" )
+    protected T getEntityInstance()
+    {
+        try
+        {
+            return (T) Class.forName( getEntityName() ).newInstance();
+        } catch ( InstantiationException e )
+        {
+            throw new RuntimeException( e );
+        } catch ( IllegalAccessException e )
+        {
+            throw new RuntimeException( e );
+        } catch ( ClassNotFoundException e )
+        {
+            throw new RuntimeException( e );
+        }
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeTypeController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeTypeController.java	2012-03-22 15:11:32 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AttributeTypeController.java	2012-05-27 21:50:00 +0000
@@ -109,7 +109,7 @@
         }
 
         model.addAttribute( "model", attribute );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "attributeType";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java	2012-05-05 19:13:56 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartController.java	2012-05-27 21:50:00 +0000
@@ -133,7 +133,7 @@
         }
 
         model.addAttribute( "model", chart );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "chart";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ConstantController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ConstantController.java	2012-04-23 09:35:01 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ConstantController.java	2012-05-27 21:50:00 +0000
@@ -111,7 +111,7 @@
         }
 
         model.addAttribute( "model", constant );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "constant";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DashboardContentController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DashboardContentController.java	2012-03-22 15:04:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DashboardContentController.java	2012-05-27 21:50:00 +0000
@@ -95,7 +95,7 @@
         */
 
         model.addAttribute( "model", dashboardContent );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "dashboardContent";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java	2012-03-22 15:04:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DataSetController.java	2012-05-27 21:50:00 +0000
@@ -111,7 +111,7 @@
         }
 
         model.addAttribute( "model", dataSet );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "dataSet";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DocumentController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DocumentController.java	2012-03-22 15:04:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DocumentController.java	2012-05-27 21:50:00 +0000
@@ -124,7 +124,7 @@
         }
 
         model.addAttribute( "model", document );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "document";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java	2012-03-28 16:14:44 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java	2012-05-27 21:50:00 +0000
@@ -115,7 +115,7 @@
         }
 
         model.addAttribute( "model", messageConversation );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "message";
     }

=== 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-05-26 14:32:28 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MetaDataController.java	2012-05-27 21:50:00 +0000
@@ -76,7 +76,8 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
     public String export( @RequestParam Map<String, String> parameters, Model model )
     {
-        MetaData metaData = exportService.getMetaData( new Options( parameters ) );
+        WebOptions options = new WebOptions( parameters );
+        MetaData metaData = exportService.getMetaData( options );
 
         model.addAttribute( "model", metaData );
         model.addAttribute( "view", "export" );
@@ -88,7 +89,8 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
     public void exportZippedXML( @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
     {
-        MetaData metaData = exportService.getMetaData( new Options( parameters ) );
+        WebOptions options = new WebOptions( parameters );
+        MetaData metaData = exportService.getMetaData( options );
 
         contextUtils.configureResponse( response, CONTENT_TYPE_ZIP, CacheStrategy.NO_CACHE, "export.xml.zip", true );
         response.addHeader( HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
@@ -103,7 +105,8 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
     public void exportZippedJSON( @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
     {
-        MetaData metaData = exportService.getMetaData( new Options( parameters ) );
+        WebOptions options = new WebOptions( parameters );
+        MetaData metaData = exportService.getMetaData( options );
 
         contextUtils.configureResponse( response, CONTENT_TYPE_ZIP, CacheStrategy.NO_CACHE, "export.json.zip", true );
         response.addHeader( HEADER_CONTENT_TRANSFER_ENCODING, "binary" );
@@ -118,7 +121,8 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
     public void exportGZippedXML( @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
     {
-        MetaData metaData = exportService.getMetaData( new Options( parameters ) );
+        WebOptions options = new WebOptions( parameters );
+        MetaData metaData = exportService.getMetaData( options );
 
         response.setContentType( CONTENT_TYPE_GZIP );
         GZIPOutputStream gzip = new GZIPOutputStream( response.getOutputStream() );
@@ -130,7 +134,8 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_METADATA_EXPORT')" )
     public void exportGZippedJSON( @RequestParam Map<String, String> parameters, HttpServletResponse response ) throws IOException
     {
-        MetaData metaData = exportService.getMetaData( new Options( parameters ) );
+        WebOptions options = new WebOptions( parameters );
+        MetaData metaData = exportService.getMetaData( options );
 
         response.setContentType( CONTENT_TYPE_GZIP );
         GZIPOutputStream gzip = new GZIPOutputStream( response.getOutputStream() );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java	2012-04-08 18:46:37 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportController.java	2012-05-27 21:50:00 +0000
@@ -128,7 +128,7 @@
         }
 
         model.addAttribute( "model", report );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "report";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2012-05-18 10:27:53 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ReportTableController.java	2012-05-27 21:50:00 +0000
@@ -154,7 +154,7 @@
         }
 
         model.addAttribute( "model", reportTable );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "reportTable";
     }
@@ -179,7 +179,7 @@
             orgUnits, crossTab, orgUnitIsParent, minimal, relatives, response );
         
         model.addAttribute( "model", grid );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
         
         return grid != null ? "reportTableData" : null;
     }
@@ -349,7 +349,7 @@
                                       HttpServletResponse response ) throws Exception
     {
         model.addAttribute( "model", getReportTableGrid( uid, organisationUnitUid, period ) );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
         
         return "grid";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceController.java	2012-03-22 15:04:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceController.java	2012-05-27 21:50:00 +0000
@@ -62,7 +62,7 @@
         }
 
         model.addAttribute( "model", resources );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "resources";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SmsConfigurationController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SmsConfigurationController.java	2012-03-22 15:04:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SmsConfigurationController.java	2012-05-27 21:50:00 +0000
@@ -83,7 +83,7 @@
         smsConfiguration.setGateways( Collections.singletonList( gatewayConfig ) );
         
         model.addAttribute( "model", smsConfiguration );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "smsConfiguration";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SqlViewController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SqlViewController.java	2012-03-22 15:04:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/SqlViewController.java	2012-05-27 21:50:00 +0000
@@ -111,7 +111,7 @@
         }
 
         model.addAttribute( "model", sqlView );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "sqlView";
     }

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/WebMetaData.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/WebMetaData.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/WebMetaData.java	2012-05-27 21:50:00 +0000
@@ -0,0 +1,78 @@
+package org.hisp.dhis.api.controller;
+
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.LinkableObject;
+import org.hisp.dhis.common.Pager;
+import org.hisp.dhis.dxf2.metadata.MetaData;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class WebMetaData
+    extends MetaData
+{
+    private Pager pager;
+
+    private LinkableObject linkableObject;
+
+    @JsonProperty
+    @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
+    public Pager getPager()
+    {
+        return pager;
+    }
+
+    public void setPager( Pager pager )
+    {
+        this.pager = pager;
+    }
+
+    @JsonProperty
+    @JacksonXmlProperty( isAttribute = true, namespace = Dxf2Namespace.NAMESPACE )
+    public String getLink()
+    {
+        if ( linkableObject == null )
+        {
+            return null;
+        }
+
+        return linkableObject.getLink();
+    }
+
+    public void setLink( String link )
+    {
+        if ( linkableObject != null )
+        {
+            linkableObject.setLink( link );
+        }
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/WebOptions.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/WebOptions.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/WebOptions.java	2012-05-27 21:50:00 +0000
@@ -0,0 +1,55 @@
+package org.hisp.dhis.api.controller;
+
+import org.hisp.dhis.dxf2.metadata.Options;
+
+import java.util.Map;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class WebOptions
+    extends Options
+{
+    public WebOptions()
+    {
+    }
+
+    public WebOptions( boolean assumeTrue )
+    {
+        super( assumeTrue );
+    }
+
+    public WebOptions( Map<String, String> options )
+    {
+        super( options );
+    }
+
+    public WebOptions( Map<String, String> options, boolean assumeTrue )
+    {
+        super( options, assumeTrue );
+    }
+
+    //--------------------------------------------------------------------------
+    // Getters for standard web options
+    //--------------------------------------------------------------------------
+
+    public boolean hasLinks()
+    {
+        return stringAsBoolean( options.get( "links" ), true );
+    }
+
+    public boolean hasPaging()
+    {
+        return stringAsBoolean( options.get( "paging" ), true );
+    }
+
+    public int getPage()
+    {
+        return stringAsInt( options.get( "page" ), 1 );
+    }
+
+    public String getViewClass( String defaultValue )
+    {
+        return stringAsString( options.get( "viewClass" ), defaultValue );
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryComboController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryComboController.java	2012-03-27 18:07:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryComboController.java	2012-05-27 21:50:00 +0000
@@ -111,7 +111,7 @@
         }
 
         model.addAttribute( "model", categoryCombo );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "categoryCombo";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryController.java	2012-03-27 18:07:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryController.java	2012-05-27 21:50:00 +0000
@@ -111,7 +111,7 @@
         }
 
         model.addAttribute( "model", category );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "category";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryOptionComboController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryOptionComboController.java	2012-03-27 18:07:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryOptionComboController.java	2012-05-27 21:50:00 +0000
@@ -88,7 +88,7 @@
         }
 
         model.addAttribute( "model", categoryOptionCombo );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "categoryOptionCombo";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryOptionController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryOptionController.java	2012-03-27 18:07:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/CategoryOptionController.java	2012-05-27 21:50:00 +0000
@@ -111,7 +111,7 @@
         }
 
         model.addAttribute( "model", categoryOption );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "categoryOption";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementController.java	2012-03-22 14:59:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementController.java	2012-05-27 21:50:00 +0000
@@ -1,7 +1,7 @@
 package org.hisp.dhis.api.controller.dataelement;
 
 /*
- * Copyright (c) 2004-2011, University of Oslo
+ * Copyright (c) 2004-2012, University of Oslo
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,182 +27,17 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.ObjectPersister;
-import org.hisp.dhis.api.utils.WebLinkPopulator;
-import org.hisp.dhis.common.Pager;
+import org.hisp.dhis.api.controller.AbstractCrudController;
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataelement.DataElements;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.HttpRequestMethodNotSupportedException;
-import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.ResponseStatus;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 @Controller
-@RequestMapping( value = DataElementController.RESOURCE_PATH )
+@RequestMapping( value = "/dataElements" )
 public class DataElementController
+    extends AbstractCrudController<DataElement>
 {
-    public static final String RESOURCE_PATH = "/dataElements";
-
-    @Autowired
-    private DataElementService dataElementService;
-
-    @Autowired
-    private ObjectPersister objectPersister;
-
-    //-------------------------------------------------------------------------------------------------------
-    // GET
-    //-------------------------------------------------------------------------------------------------------
-
-    @RequestMapping( method = RequestMethod.GET )
-    public String getDataElements( IdentifiableObjectParams params, Model model, HttpServletRequest request )
-    {
-        DataElements dataElements = new DataElements();
-
-        if ( params.isPaging() )
-        {
-            int total = dataElementService.getDataElementCount();
-
-            Pager pager = new Pager( params.getPage(), total );
-            dataElements.setPager( pager );
-
-            List<DataElement> dataElementList = new ArrayList<DataElement>(
-                dataElementService.getDataElementsBetween( pager.getOffset(), pager.getPageSize() ) );
-
-            dataElements.setDataElements( dataElementList );
-        }
-        else
-        {
-            dataElements.setDataElements( new ArrayList<DataElement>( dataElementService.getAllDataElements() ) );
-        }
-
-        if ( params.hasLinks() )
-        {
-            WebLinkPopulator listener = new WebLinkPopulator( request );
-            listener.addLinks( dataElements );
-        }
-
-        model.addAttribute( "model", dataElements );
-
-        return "dataElements";
-    }
-
-    @RequestMapping( value = "/{uid}", method = RequestMethod.GET )
-    public String getDataElement( @PathVariable( "uid" ) String uid, IdentifiableObjectParams params, Model model, HttpServletRequest request )
-    {
-        DataElement dataElement = dataElementService.getDataElement( uid );
-
-        if ( params.hasLinks() )
-        {
-            WebLinkPopulator listener = new WebLinkPopulator( request );
-            listener.addLinks( dataElement );
-        }
-
-        model.addAttribute( "model", dataElement );
-        model.addAttribute( "view", "detailed" );
-
-        return "dataElement";
-    }
-
-    //-------------------------------------------------------------------------------------------------------
-    // POST
-    //-------------------------------------------------------------------------------------------------------
-
-    @RequestMapping( method = RequestMethod.POST, headers = {"Content-Type=application/xml, text/xml"} )
-    @PreAuthorize( "hasRole('ALL') or hasRole('F_DATAELEMENT_ADD')" )
-    public void postDataElementXML( HttpServletResponse response, InputStream input ) throws Exception
-    {
-        //DataElement dataElement = Jaxb2Utils.unmarshal( DataElement.class, input );
-        //postDataElement( dataElement, response );
-    }
-
-    @RequestMapping( method = RequestMethod.POST, headers = {"Content-Type=application/json"} )
-    @PreAuthorize( "hasRole('ALL') or hasRole('F_DATAELEMENT_ADD')" )
-    public void postDataElementJSON( HttpServletResponse response, InputStream input ) throws Exception
-    {
-        throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
-        //DataElement dataElement = JacksonUtils.readValueAs( DataElement.class, input );
-        //postDataElement( dataElement, response );
-    }
-
-    public void postDataElement( DataElement dataElement, HttpServletResponse response )
-    {
-        if ( dataElement == null )
-        {
-            response.setStatus( HttpServletResponse.SC_NOT_IMPLEMENTED );
-        }
-        else
-        {
-            try
-            {
-                dataElement = objectPersister.persistDataElement( dataElement );
-
-                if ( dataElement.getUid() == null )
-                {
-                    response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-                }
-                else
-                {
-                    response.setStatus( HttpServletResponse.SC_CREATED );
-                    response.setHeader( "Location", DataElementController.RESOURCE_PATH + "/" + dataElement.getUid() );
-                }
-            } catch ( Exception e )
-            {
-                response.setStatus( HttpServletResponse.SC_CONFLICT );
-            }
-        }
-    }
-
-    //-------------------------------------------------------------------------------------------------------
-    // PUT
-    //-------------------------------------------------------------------------------------------------------
-
-    @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, headers = {"Content-Type=application/xml, text/xml"} )
-    @ResponseStatus( value = HttpStatus.NO_CONTENT )
-    @PreAuthorize( "hasRole('ALL') or hasRole('F_DATAELEMENT_UPDATE')" )
-    public void putDataElementXML( @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
-    {
-        throw new HttpRequestMethodNotSupportedException( RequestMethod.PUT.toString() );
-    }
-
-    @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, headers = {"Content-Type=application/json"} )
-    @ResponseStatus( value = HttpStatus.NO_CONTENT )
-    @PreAuthorize( "hasRole('ALL') or hasRole('F_DATAELEMENT_UPDATE')" )
-    public void putDataElementJSON( @PathVariable( "uid" ) String uid, InputStream input ) throws Exception
-    {
-        throw new HttpRequestMethodNotSupportedException( RequestMethod.PUT.toString() );
-    }
-
-    //-------------------------------------------------------------------------------------------------------
-    // DELETE
-    //-------------------------------------------------------------------------------------------------------
-
-    @RequestMapping( value = "/{uid}", method = RequestMethod.DELETE )
-    @ResponseStatus( value = HttpStatus.NO_CONTENT )
-    @PreAuthorize( "hasRole('ALL') or hasRole('F_DATAELEMENT_DELETE')" )
-    public void deleteDataElement( @PathVariable( "uid" ) String uid ) throws Exception
-    {
-        DataElement dataElement = dataElementService.getDataElement( uid );
-
-        if ( dataElement != null )
-        {
-            dataElementService.deleteDataElement( dataElement );
-        }
-    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupController.java	2012-03-22 14:59:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupController.java	2012-05-27 21:50:00 +0000
@@ -28,7 +28,6 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.ObjectPersister;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.dataelement.DataElementGroup;
@@ -60,9 +59,6 @@
     @Autowired
     private DataElementService dataElementService;
 
-    @Autowired
-    private ObjectPersister objectPersister;
-
     //-------------------------------------------------------------------------------------------------------
     // GET
     //-------------------------------------------------------------------------------------------------------
@@ -112,7 +108,7 @@
         }
 
         model.addAttribute( "model", dataElementGroup );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "dataElementGroup";
     }
@@ -125,8 +121,7 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_DATAELEMENTGROUP_ADD')" )
     public void postDataElementGroupXML( HttpServletResponse response, InputStream input ) throws Exception
     {
-        //DataElementGroup dataElementGroup = Jaxb2Utils.unmarshal( DataElementGroup.class, input );
-        //postDataElementGroup( dataElementGroup, response );
+        throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
     }
 
     @RequestMapping( method = RequestMethod.POST, headers = {"Content-Type=application/json"} )
@@ -136,34 +131,6 @@
         throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
     }
 
-    public void postDataElementGroup( DataElementGroup dataElementGroup, HttpServletResponse response )
-    {
-        if ( dataElementGroup == null )
-        {
-            response.setStatus( HttpServletResponse.SC_NOT_IMPLEMENTED );
-        }
-        else
-        {
-            try
-            {
-                dataElementGroup = objectPersister.persistDataElementGroup( dataElementGroup );
-
-                if ( dataElementGroup.getUid() == null )
-                {
-                    response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-                }
-                else
-                {
-                    response.setStatus( HttpServletResponse.SC_CREATED );
-                    response.setHeader( "Location", DataElementController.RESOURCE_PATH + "/" + dataElementGroup.getUid() );
-                }
-            } catch ( Exception e )
-            {
-                response.setStatus( HttpServletResponse.SC_CONFLICT );
-            }
-        }
-    }
-
     //-------------------------------------------------------------------------------------------------------
     // PUT
     //-------------------------------------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupSetController.java	2012-03-22 14:59:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementGroupSetController.java	2012-05-27 21:50:00 +0000
@@ -28,7 +28,6 @@
  */
 
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.ObjectPersister;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.dataelement.DataElementGroupSet;
@@ -63,9 +62,6 @@
     @Autowired
     private DataElementService dataElementService;
 
-    @Autowired
-    private ObjectPersister objectPersister;
-
     //-------------------------------------------------------------------------------------------------------
     // GET
     //-------------------------------------------------------------------------------------------------------
@@ -115,7 +111,7 @@
         }
 
         model.addAttribute( "model", dataElementGroupSet );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "dataElementGroupSet";
     }
@@ -128,8 +124,7 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_DATAELEMENTGROUPSET_ADD')" )
     public void postDataElementGroupSetXML( HttpServletResponse response, InputStream input ) throws Exception
     {
-        //DataElementGroupSet dataElementGroupSet = Jaxb2Utils.unmarshal( DataElementGroupSet.class, input );
-        //postDataElementGroupSet( dataElementGroupSet, response );
+        throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
     }
 
     @RequestMapping( method = RequestMethod.POST, headers = {"Content-Type=application/json"} )
@@ -139,34 +134,6 @@
         throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
     }
 
-    public void postDataElementGroupSet( DataElementGroupSet dataElementGroupSet, HttpServletResponse response )
-    {
-        if ( dataElementGroupSet == null )
-        {
-            response.setStatus( HttpServletResponse.SC_NOT_IMPLEMENTED );
-        }
-        else
-        {
-            try
-            {
-                dataElementGroupSet = objectPersister.persistDataElementGroupSet( dataElementGroupSet );
-
-                if ( dataElementGroupSet.getUid() == null )
-                {
-                    response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-                }
-                else
-                {
-                    response.setStatus( HttpServletResponse.SC_CREATED );
-                    response.setHeader( "Location", DataElementController.RESOURCE_PATH + "/" + dataElementGroupSet.getUid() );
-                }
-            } catch ( Exception e )
-            {
-                response.setStatus( HttpServletResponse.SC_CONFLICT );
-            }
-        }
-    }
-
     //-------------------------------------------------------------------------------------------------------
     // PUT
     //-------------------------------------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorController.java	2012-03-22 14:59:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorController.java	2012-05-27 21:50:00 +0000
@@ -111,7 +111,7 @@
         }
 
         model.addAttribute( "model", indicator );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "indicator";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupController.java	2012-03-22 14:59:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupController.java	2012-05-27 21:50:00 +0000
@@ -111,7 +111,7 @@
         }
 
         model.addAttribute( "model", indicatorGroup );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "indicatorGroup";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupSetController.java	2012-03-22 14:59:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorGroupSetController.java	2012-05-27 21:50:00 +0000
@@ -111,7 +111,7 @@
         }
 
         model.addAttribute( "model", indicatorGroupSet );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "indicatorGroupSet";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorTypeController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorTypeController.java	2012-03-27 18:07:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/indicator/IndicatorTypeController.java	2012-05-27 21:50:00 +0000
@@ -111,7 +111,7 @@
         }
 
         model.addAttribute( "model", indicatorType );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "indicatorType";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java	2012-03-22 14:59:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapController.java	2012-05-27 21:50:00 +0000
@@ -113,7 +113,7 @@
         }
 
         model.addAttribute( "model", mapView );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "map";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapLayerController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapLayerController.java	2012-03-22 14:59:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapLayerController.java	2012-05-27 21:50:00 +0000
@@ -91,7 +91,7 @@
         }
 
         model.addAttribute( "model", mapLayer );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "mapLayer";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapLegendController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapLegendController.java	2012-03-22 14:59:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapLegendController.java	2012-05-27 21:50:00 +0000
@@ -93,7 +93,7 @@
         }
 
         model.addAttribute( "model", mapLegend );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "mapLegend";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapLegendSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapLegendSetController.java	2012-03-22 14:59:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapLegendSetController.java	2012-05-27 21:50:00 +0000
@@ -93,7 +93,7 @@
         }
 
         model.addAttribute( "model", mapLegendSet );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "mapLegendSet";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java	2012-05-14 20:24:22 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java	2012-05-27 21:50:00 +0000
@@ -2,7 +2,6 @@
 
 import org.hisp.dhis.api.controller.dataelement.DataElementController;
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.ObjectPersister;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.common.Pager;
@@ -39,9 +38,6 @@
     private OrganisationUnitService organisationUnitService;
 
     @Autowired
-    private ObjectPersister objectPersister;
-
-    @Autowired
     private IdentifiableObjectManager identifiableObjectManager;
 
     //-------------------------------------------------------------------------------------------------------
@@ -97,7 +93,7 @@
         }
 
         model.addAttribute( "model", organisationUnit );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "organisationUnit";
     }
@@ -113,7 +109,7 @@
         }
 
         model.addAttribute( "model", organisationUnit );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "organisationUnit";
     }
@@ -126,8 +122,7 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_ORGANISATIONUNIT_ADD')" )
     public void postOrganisationUnitXML( HttpServletResponse response, InputStream input ) throws Exception
     {
-        //OrganisationUnit organisationUnit = Jaxb2Utils.unmarshal( OrganisationUnit.class, input );
-        //postOrganisationUnit( organisationUnit, response );
+        throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
     }
 
     @RequestMapping( method = RequestMethod.POST, headers = {"Content-Type=application/json"} )
@@ -137,6 +132,7 @@
         throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
     }
 
+    /*
     public void postOrganisationUnit( OrganisationUnit organisationUnit, HttpServletResponse response )
     {
         if ( organisationUnit == null )
@@ -164,6 +160,7 @@
             }
         }
     }
+    */
 
     //-------------------------------------------------------------------------------------------------------
     // PUT

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitGroupController.java	2012-03-27 18:07:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitGroupController.java	2012-05-27 21:50:00 +0000
@@ -2,7 +2,6 @@
 
 import org.hisp.dhis.api.controller.dataelement.DataElementController;
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.ObjectPersister;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
@@ -37,9 +36,6 @@
     @Autowired
     private OrganisationUnitGroupService organisationUnitGroupService;
 
-    @Autowired
-    private ObjectPersister objectPersister;
-
     //-------------------------------------------------------------------------------------------------------
     // GET
     //-------------------------------------------------------------------------------------------------------
@@ -89,7 +85,7 @@
         }
 
         model.addAttribute( "model", organisationUnitGroup );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "organisationUnitGroup";
     }
@@ -102,8 +98,7 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_ORGUNITGROUP_ADD')" )
     public void postOrganisationUnitGroupXML( HttpServletResponse response, InputStream input ) throws Exception
     {
-        //OrganisationUnitGroup organisationUnitGroup = Jaxb2Utils.unmarshal( OrganisationUnitGroup.class, input );
-        //postOrganisationUnitGroup( organisationUnitGroup, response );
+        throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
     }
 
     @RequestMapping( method = RequestMethod.POST, headers = {"Content-Type=application/json"} )
@@ -113,34 +108,6 @@
         throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
     }
 
-    public void postOrganisationUnitGroup( OrganisationUnitGroup organisationUnitGroup, HttpServletResponse response )
-    {
-        if ( organisationUnitGroup == null )
-        {
-            response.setStatus( HttpServletResponse.SC_NOT_IMPLEMENTED );
-        }
-        else
-        {
-            try
-            {
-                organisationUnitGroup = objectPersister.persistOrganisationUnitGroup( organisationUnitGroup );
-
-                if ( organisationUnitGroup.getUid() == null )
-                {
-                    response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-                }
-                else
-                {
-                    response.setStatus( HttpServletResponse.SC_CREATED );
-                    response.setHeader( "Location", DataElementController.RESOURCE_PATH + "/" + organisationUnitGroup.getUid() );
-                }
-            } catch ( Exception ex )
-            {
-                response.setStatus( HttpServletResponse.SC_CONFLICT );
-            }
-        }
-    }
-
     //-------------------------------------------------------------------------------------------------------
     // PUT
     //-------------------------------------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitGroupSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitGroupSetController.java	2012-03-27 18:07:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitGroupSetController.java	2012-05-27 21:50:00 +0000
@@ -29,7 +29,6 @@
 
 import org.hisp.dhis.api.controller.dataelement.DataElementController;
 import org.hisp.dhis.api.utils.IdentifiableObjectParams;
-import org.hisp.dhis.api.utils.ObjectPersister;
 import org.hisp.dhis.api.utils.WebLinkPopulator;
 import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
@@ -64,9 +63,6 @@
     @Autowired
     private OrganisationUnitGroupService organisationUnitGroupService;
 
-    @Autowired
-    private ObjectPersister objectPersister;
-
     //-------------------------------------------------------------------------------------------------------
     // GET
     //-------------------------------------------------------------------------------------------------------
@@ -116,7 +112,7 @@
         }
 
         model.addAttribute( "model", organisationUnitGroupSet );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "organisationUnitGroupSet";
     }
@@ -129,8 +125,7 @@
     @PreAuthorize( "hasRole('ALL') or hasRole('F_ORGUNITGROUPSET_ADD')" )
     public void postOrganisationUnitGroupSetXML( HttpServletResponse response, InputStream input ) throws Exception
     {
-        //OrganisationUnitGroupSet organisationUnitGroupSet = Jaxb2Utils.unmarshal( OrganisationUnitGroupSet.class, input );
-        //postOrganisationUnitGroupSet( organisationUnitGroupSet, response );
+        throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
     }
 
     @RequestMapping( method = RequestMethod.POST, headers = {"Content-Type=application/json"} )
@@ -140,34 +135,6 @@
         throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() );
     }
 
-    public void postOrganisationUnitGroupSet( OrganisationUnitGroupSet organisationUnitGroupSet, HttpServletResponse response )
-    {
-        if ( organisationUnitGroupSet == null )
-        {
-            response.setStatus( HttpServletResponse.SC_NOT_IMPLEMENTED );
-        }
-        else
-        {
-            try
-            {
-                organisationUnitGroupSet = objectPersister.persistOrganisationUnitGroupSet( organisationUnitGroupSet );
-
-                if ( organisationUnitGroupSet.getUid() == null )
-                {
-                    response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
-                }
-                else
-                {
-                    response.setStatus( HttpServletResponse.SC_CREATED );
-                    response.setHeader( "Location", DataElementController.RESOURCE_PATH + "/" + organisationUnitGroupSet.getUid() );
-                }
-            } catch ( Exception e )
-            {
-                response.setStatus( HttpServletResponse.SC_CONFLICT );
-            }
-        }
-    }
-
     //-------------------------------------------------------------------------------------------------------
     // PUT
     //-------------------------------------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitLevelController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitLevelController.java	2012-03-27 18:07:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitLevelController.java	2012-05-27 21:50:00 +0000
@@ -93,7 +93,7 @@
         }
 
         model.addAttribute( "model", organisationUnitLevel );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "organisationUnitLevel";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserAuthorityGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserAuthorityGroupController.java	2012-04-23 09:35:01 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserAuthorityGroupController.java	2012-05-27 21:50:00 +0000
@@ -96,7 +96,7 @@
         }
 
         model.addAttribute( "model", userAuthorityGroup );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "userGroup";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserController.java	2012-03-28 07:40:14 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserController.java	2012-05-27 21:50:00 +0000
@@ -95,7 +95,7 @@
         }
 
         model.addAttribute( "model", user );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "user";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserGroupController.java	2012-03-28 07:40:14 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserGroupController.java	2012-05-27 21:50:00 +0000
@@ -95,7 +95,7 @@
         }
 
         model.addAttribute( "model", userGroup );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "userGroup";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/validation/ValidationRuleController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/validation/ValidationRuleController.java	2012-03-22 14:59:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/validation/ValidationRuleController.java	2012-05-27 21:50:00 +0000
@@ -111,7 +111,7 @@
         }
 
         model.addAttribute( "model", validationRule );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "validationRule";
     }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/validation/ValidationRuleGroupController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/validation/ValidationRuleGroupController.java	2012-03-22 14:59:55 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/validation/ValidationRuleGroupController.java	2012-05-27 21:50:00 +0000
@@ -111,7 +111,7 @@
         }
 
         model.addAttribute( "model", validationRuleGroup );
-        model.addAttribute( "view", "detailed" );
+        model.addAttribute( "viewClass", "detailed" );
 
         return "validationRuleGroup";
     }

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/HibernateObjectPersister.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/HibernateObjectPersister.java	2012-03-22 13:48:16 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/HibernateObjectPersister.java	1970-01-01 00:00:00 +0000
@@ -1,245 +0,0 @@
-package org.hisp.dhis.api.utils;
-
-/*
- * Copyright (c) 2004-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 java.util.ArrayList;
-import java.util.Collection;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-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.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-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.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-@Component
-@Transactional
-public class HibernateObjectPersister implements ObjectPersister
-{
-    @Autowired
-    private DataElementService dataElementService;
-
-    @Autowired
-    private DataElementCategoryService dataElementCategoryService;
-
-    @Autowired
-    private DataSetService dataSetService;
-
-    @Autowired
-    private OrganisationUnitService organisationUnitService;
-
-    @Autowired
-    private OrganisationUnitGroupService organisationUnitGroupService;
-
-    @Override
-    public DataElement persistDataElement( DataElement dataElement )
-    {
-        Collection<DataElementGroup> dataElementGroups = new ArrayList<DataElementGroup>( dataElement.getGroups() );
-        Collection<DataSet> dataSets = new ArrayList<DataSet>( dataElement.getDataSets() );
-        dataElement.getGroups().clear();
-        dataElement.getDataSets().clear();
-        dataElement.getAttributeValues().clear();
-        dataElement.setCategoryCombo( null );
-
-        dataElementService.addDataElement( dataElement );
-
-        if ( dataElement.getCategoryCombo() != null )
-        {
-            DataElementCategoryCombo dataElementCategoryCombo = dataElementCategoryService.getDataElementCategoryCombo( dataElement.getCategoryCombo().getUid() );
-            dataElement.setCategoryCombo( dataElementCategoryCombo );
-        }
-
-        for ( DataElementGroup dataElementGroup : dataElementGroups )
-        {
-            dataElementGroup = dataElementService.getDataElementGroup( dataElementGroup.getUid() );
-            dataElement.addDataElementGroup( dataElementGroup );
-        }
-
-        for ( DataSet dataSet : dataSets )
-        {
-            dataSet = dataSetService.getDataSet( dataSet.getUid() );
-            dataSet.addDataElement( dataElement );
-        }
-
-        dataElementService.updateDataElement( dataElement );
-
-        return dataElement;
-    }
-
-    @Override
-    public DataElementGroup persistDataElementGroup( DataElementGroup dataElementGroup )
-    {
-        Collection<DataElement> dataElements = new ArrayList<DataElement>( dataElementGroup.getMembers() );
-        DataElementGroupSet dataElementGroupSet = dataElementGroup.getGroupSet();
-        dataElementGroup.getMembers().clear();
-        dataElementGroup.setGroupSet( null );
-
-        dataElementService.addDataElementGroup( dataElementGroup );
-
-        for ( DataElement dataElement : dataElements )
-        {
-            dataElement = dataElementService.getDataElement( dataElement.getUid() );
-            dataElementGroup.addDataElement( dataElement );
-        }
-
-        if ( dataElementGroupSet != null )
-        {
-            dataElementGroupSet = dataElementService.getDataElementGroupSet( dataElementGroup.getGroupSet().getUid() );
-            dataElementGroup.setGroupSet( dataElementGroupSet );
-        }
-
-        dataElementService.updateDataElementGroup( dataElementGroup );
-
-        return dataElementGroup;
-    }
-
-    @Override
-    public DataElementGroupSet persistDataElementGroupSet( DataElementGroupSet dataElementGroupSet )
-    {
-        Collection<DataElementGroup> dataElementGroups = new ArrayList<DataElementGroup>( dataElementGroupSet.getMembers() );
-        dataElementGroupSet.getMembers().clear();
-
-        dataElementService.addDataElementGroupSet( dataElementGroupSet );
-
-        for ( DataElementGroup dataElementGroup : dataElementGroups )
-        {
-            dataElementGroup = dataElementService.getDataElementGroup( dataElementGroup.getUid() );
-            dataElementGroupSet.addDataElementGroup( dataElementGroup );
-        }
-
-        dataElementService.updateDataElementGroupSet( dataElementGroupSet );
-
-        return dataElementGroupSet;
-    }
-
-    @Override
-    public OrganisationUnit persistOrganisationUnit( OrganisationUnit organisationUnit )
-    {
-        Collection<OrganisationUnitGroup> organisationUnitGroups = new ArrayList<OrganisationUnitGroup>( organisationUnit.getGroups() );
-        Collection<DataSet> dataSets = new ArrayList<DataSet>( organisationUnit.getDataSets() );
-        OrganisationUnit parent = organisationUnit.getParent();
-
-        organisationUnit.getGroups().clear();
-        organisationUnit.getDataSets().clear();
-        organisationUnit.setParent( null );
-        organisationUnit.getAttributeValues().clear();
-
-        organisationUnitService.addOrganisationUnit( organisationUnit );
-
-        for ( OrganisationUnitGroup organisationUnitGroup : organisationUnitGroups )
-        {
-            organisationUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( organisationUnitGroup.getUid() );
-            organisationUnit.addOrganisationUnitGroup( organisationUnitGroup );
-        }
-
-        for ( DataSet dataSet : dataSets )
-        {
-            dataSet = dataSetService.getDataSet( dataSet.getUid() );
-            organisationUnit.addDataSet( dataSet );
-        }
-
-        if ( parent != null )
-        {
-            parent = organisationUnitService.getOrganisationUnit( parent.getUid() );
-            organisationUnit.setParent( parent );
-        }
-
-        organisationUnitService.updateOrganisationUnit( organisationUnit );
-
-        return organisationUnit;
-    }
-
-    @Override
-    public OrganisationUnitLevel persistOrganisationUnitLevel( OrganisationUnitLevel organisationUnitLevel )
-    {
-        organisationUnitService.addOrganisationUnitLevel( organisationUnitLevel );
-
-        return organisationUnitLevel;
-    }
-
-    @Override
-    public OrganisationUnitGroup persistOrganisationUnitGroup( OrganisationUnitGroup organisationUnitGroup )
-    {
-        Collection<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( organisationUnitGroup.getMembers() );
-        OrganisationUnitGroupSet organisationUnitGroupSet = organisationUnitGroup.getGroupSet();
-
-        organisationUnitGroup.getMembers().clear();
-        organisationUnitGroup.setGroupSet( null );
-
-        organisationUnitGroupService.addOrganisationUnitGroup( organisationUnitGroup );
-
-        for ( OrganisationUnit organisationUnit : organisationUnits )
-        {
-            organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnit.getUid() );
-            organisationUnitGroup.addOrganisationUnit( organisationUnit );
-        }
-
-        if ( organisationUnitGroupSet != null )
-        {
-            organisationUnitGroupSet = organisationUnitGroupService.getOrganisationUnitGroupSet( organisationUnitGroupSet.getUid() );
-            organisationUnitGroupSet.addOrganisationUnitGroup( organisationUnitGroup );
-        }
-
-        organisationUnitGroupService.updateOrganisationUnitGroup( organisationUnitGroup );
-
-        return organisationUnitGroup;
-    }
-
-    @Override
-    public OrganisationUnitGroupSet persistOrganisationUnitGroupSet( OrganisationUnitGroupSet organisationUnitGroupSet )
-    {
-        Collection<OrganisationUnitGroup> organisationUnitGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupSet.getOrganisationUnitGroups() );
-        organisationUnitGroupSet.getOrganisationUnitGroups().clear();
-
-        organisationUnitGroupService.addOrganisationUnitGroupSet( organisationUnitGroupSet );
-
-        for ( OrganisationUnitGroup organisationUnitGroup : organisationUnitGroups )
-        {
-            organisationUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( organisationUnitGroup.getUid() );
-            organisationUnitGroupSet.addOrganisationUnitGroup( organisationUnitGroup );
-        }
-
-        organisationUnitGroupService.updateOrganisationUnitGroupSet( organisationUnitGroupSet );
-
-        return organisationUnitGroupSet;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ObjectPersister.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ObjectPersister.java	2012-03-22 15:04:58 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ObjectPersister.java	1970-01-01 00:00:00 +0000
@@ -1,56 +0,0 @@
-package org.hisp.dhis.api.utils;
-
-/*
- * Copyright (c) 2004-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.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementGroupSet;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
-import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public interface ObjectPersister
-{
-    public DataElement persistDataElement( DataElement dataElement );
-
-    public DataElementGroup persistDataElementGroup( DataElementGroup dataElementGroup );
-
-    public DataElementGroupSet persistDataElementGroupSet( DataElementGroupSet dataElementGroupSet );
-
-    public OrganisationUnit persistOrganisationUnit( OrganisationUnit organisationUnit );
-
-    public OrganisationUnitLevel persistOrganisationUnitLevel( OrganisationUnitLevel organisationUnitLevel );
-
-    public OrganisationUnitGroup persistOrganisationUnitGroup( OrganisationUnitGroup organisationUnitGroup );
-
-    public OrganisationUnitGroupSet persistOrganisationUnitGroupSet( OrganisationUnitGroupSet organisationUnitGroupSet );
-}

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonJsonView.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonJsonView.java	2012-03-27 14:58:37 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonJsonView.java	2012-05-27 21:50:00 +0000
@@ -84,7 +84,7 @@
     protected void renderMergedOutputModel( Map<String, Object> model, HttpServletRequest request, HttpServletResponse response ) throws Exception
     {
         Object object = model.get( "model" );
-        Class<?> viewClass = JacksonUtils.getViewClass( model.get( "view" ) );
+        Class<?> viewClass = JacksonUtils.getViewClass( model.get( "viewClass" ) );
         response.setContentType( getContentType() );
 
         if ( withPadding )

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonXmlView.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonXmlView.java	2012-03-22 15:11:32 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/view/JacksonXmlView.java	2012-05-27 21:50:00 +0000
@@ -52,7 +52,7 @@
     protected void renderMergedOutputModel( Map<String, Object> model, HttpServletRequest request, HttpServletResponse response ) throws Exception
     {
         Object object = model.get( "model" );
-        Class<?> viewClass = JacksonUtils.getViewClass( model.get( "view" ) );
+        Class<?> viewClass = JacksonUtils.getViewClass( model.get( "viewClass" ) );
         response.setContentType( getContentType() );
         response.setStatus( HttpServletResponse.SC_OK );