← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11826: minor bugfixes for meta-data import/export

 

------------------------------------------------------------
revno: 11826
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-08-28 11:35:34 +0200
message:
  minor bugfixes for meta-data import/export
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/Dashboard.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java	2013-08-28 09:35:34 +0000
@@ -28,6 +28,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonView;
@@ -50,7 +52,7 @@
 /**
  * @author Bob Jolliffe
  */
-@JacksonXmlRootElement(localName = "identifiableObject", namespace = DxfNamespaces.DXF_2_0)
+@JacksonXmlRootElement( localName = "identifiableObject", namespace = DxfNamespaces.DXF_2_0 )
 public class BaseIdentifiableObject
     extends BaseLinkableObject
     implements IdentifiableObject
@@ -176,8 +178,8 @@
         this.id = id;
     }
 
-    @JsonProperty(value = "id")
-    @JacksonXmlProperty(localName = "id", isAttribute = true)
+    @JsonProperty( value = "id" )
+    @JacksonXmlProperty( localName = "id", isAttribute = true )
     public String getUid()
     {
         return uid;
@@ -189,7 +191,7 @@
     }
 
     @JsonProperty
-    @JacksonXmlProperty(isAttribute = true)
+    @JacksonXmlProperty( isAttribute = true )
     public String getCode()
     {
         return code;
@@ -201,7 +203,7 @@
     }
 
     @JsonProperty
-    @JacksonXmlProperty(isAttribute = true)
+    @JacksonXmlProperty( isAttribute = true )
     public String getName()
     {
         return name;
@@ -225,7 +227,7 @@
     }
 
     @JsonProperty
-    @JacksonXmlProperty(isAttribute = true)
+    @JacksonXmlProperty( isAttribute = true )
     public Date getCreated()
     {
         return created;
@@ -237,7 +239,7 @@
     }
 
     @JsonProperty
-    @JacksonXmlProperty(isAttribute = true)
+    @JacksonXmlProperty( isAttribute = true )
     public Date getLastUpdated()
     {
         return lastUpdated;
@@ -250,8 +252,8 @@
 
     @Override
     @JsonProperty
-    @JsonView({ DetailedView.class, ExportView.class })
-    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getPublicAccess()
     {
         return publicAccess;
@@ -264,8 +266,8 @@
 
     @Override
     @JsonProperty
-    @JsonView({ DetailedView.class, ExportView.class })
-    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public boolean getExternalAccess()
     {
         return externalAccess;
@@ -294,9 +296,9 @@
     }
 
     @JsonProperty
-    @JsonView({ DetailedView.class, ExportView.class })
-    @JacksonXmlElementWrapper(localName = "userGroupAccesses", namespace = DxfNamespaces.DXF_2_0)
-    @JacksonXmlProperty(localName = "userGroupAccess", namespace = DxfNamespaces.DXF_2_0)
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlElementWrapper( localName = "userGroupAccesses", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "userGroupAccess", namespace = DxfNamespaces.DXF_2_0 )
     public Set<UserGroupAccess> getUserGroupAccesses()
     {
         return userGroupAccesses;
@@ -308,7 +310,7 @@
     }
 
     @JsonProperty
-    @JacksonXmlProperty(localName = "access", namespace = DxfNamespaces.DXF_2_0)
+    @JacksonXmlProperty( localName = "access", namespace = DxfNamespaces.DXF_2_0 )
     public Access getAccess()
     {
         return access;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/Dashboard.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/Dashboard.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dashboard/Dashboard.java	2013-08-28 09:35:34 +0000
@@ -58,7 +58,7 @@
     public Dashboard()
     {
     }
-    
+
     public Dashboard( String name )
     {
         this.name = name;
@@ -72,9 +72,9 @@
      * Moves an item in the list. Returns true if the operation lead to a
      * modification of the list order. Returns false if there are no items,
      * the given position is out of bounds, the item is not present, if position
-     * is equal to current item index or if attempting to move an item one 
+     * is equal to current item index or if attempting to move an item one
      * position to the right (pointless operation).
-     * 
+     *
      * @param uid the uid of the item to move.
      * @param position the new index position of the item.
      * @return true if the operation lead to a modification of order, false otherwise.
@@ -85,33 +85,33 @@
         {
             return false; // No items or position out of bounds
         }
-        
+
         int index = items.indexOf( new DashboardItem( uid ) );
-        
+
         if ( index == -1 || index == position || ( index + 1 ) == position )
         {
             return false; // Not found, already at position or pointless move
         }
-        
+
         DashboardItem item = items.get( index );
 
         index = position < index ? ( index + 1 ) : index; // New index after move
 
         items.add( position, item ); // Add item at position        
         items.remove( index ); // Remove item at previous index
-        
+
         return true;
     }
-    
+
     /**
      * Removes the item with the given identifier from this dashboard.
-     * 
+     *
      * @param uid the item uid.
      */
     public boolean removeItem( String uid )
     {
         Iterator<DashboardItem> iter = items.iterator();
-        
+
         while ( iter.hasNext() )
         {
             if ( uid.equals( iter.next().getUid() ) )
@@ -120,28 +120,28 @@
                 return true;
             }
         }
-        
+
         return false;
     }
-    
+
     /**
      * Returns the item with the given uid, or null if no item with the given
      * uid is present for this dashboard.
-     * 
+     *
      * @param uid the item identifier.
      * @return an item.
      */
     public DashboardItem getItemByUid( String uid )
     {
         int index = items.indexOf( new DashboardItem( uid ) );
-        
+
         return index != -1 ? items.get( index ) : null;
     }
-    
+
     /**
      * Returns an item from this dashboard of the given type which number of
      * content is less than max. Returns null if no item matches the criteria.
-     * 
+     *
      * @param type the type of content to return.
      * @return an item.
      */
@@ -154,17 +154,17 @@
                 return item;
             }
         }
-        
+
         return null;
-    }    
-    
+    }
+
     @JsonProperty
     @JacksonXmlProperty
     public int getItemCount()
     {
         return items == null ? 0 : items.size();
     }
-    
+
     // -------------------------------------------------------------------------
     // Getters and setters
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/ExchangeClasses.java	2013-08-28 09:35:34 +0000
@@ -170,8 +170,12 @@
         // this is considered data, and is not available for meta-data export/import
         exportClasses.remove( MessageConversation.class );
         exportClasses.remove( Interpretation.class );
+        exportClasses.remove( Dashboard.class );
+        exportClasses.remove( BaseDimensionalObject.class );
         importClasses.remove( MessageConversation.class );
         importClasses.remove( Interpretation.class );
+        importClasses.remove( Dashboard.class );
+        importClasses.remove( BaseDimensionalObject.class );
 
         // tracker types are not enabled for meta-data import-export yet
         exportClasses.remove( Program.class );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/utils/JacksonUtils.java	2013-08-28 09:35:34 +0000
@@ -73,8 +73,8 @@
             objectMapper.configure( SerializationFeature.FAIL_ON_EMPTY_BEANS, false );
             objectMapper.configure( SerializationFeature.WRAP_EXCEPTIONS, true );
 
-            objectMapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true );
-            objectMapper.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, true );
+            objectMapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false );
+            objectMapper.configure( DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, false );
             objectMapper.configure( DeserializationFeature.WRAP_EXCEPTIONS, true );
 
             objectMapper.disable( MapperFeature.AUTO_DETECT_FIELDS );