← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14427: minor fix, add xmlNamespace info to Schema

 

------------------------------------------------------------
revno: 14427
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-03-26 12:12:59 +0100
message:
  minor fix, add xmlNamespace info to Schema
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Authorities.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Property.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultPropertyScannerService.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Authorities.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Authorities.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Authorities.java	2014-03-26 11:12:59 +0000
@@ -0,0 +1,40 @@
+package org.hisp.dhis.schema;
+
+/*
+ * Copyright (c) 2004-2014, 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.dataformat.xml.annotation.JacksonXmlRootElement;
+import org.hisp.dhis.common.DxfNamespaces;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@JacksonXmlRootElement( localName = "authorities", namespace = DxfNamespaces.DXF_2_0 )
+public class Authorities
+{
+}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Property.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Property.java	2014-03-21 09:35:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Property.java	2014-03-26 11:12:59 +0000
@@ -47,6 +47,8 @@
 
     private String xmlName;
 
+    private String xmlNamespace;
+
     private boolean xmlAttribute;
 
     private String xmlCollectionName;
@@ -102,6 +104,18 @@
 
     @JsonProperty
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public String getXmlNamespace()
+    {
+        return xmlNamespace;
+    }
+
+    public void setXmlNamespace( String xmlNamespace )
+    {
+        this.xmlNamespace = xmlNamespace;
+    }
+
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public boolean isXmlAttribute()
     {
         return xmlAttribute;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java	2014-03-26 09:23:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java	2014-03-26 11:12:59 +0000
@@ -57,6 +57,8 @@
 
     private boolean shareable;
 
+    private Authorities authorities;
+
     private List<String> publicAuthorities = Lists.newArrayList();
 
     private List<String> privateAuthorities = Lists.newArrayList();
@@ -137,6 +139,18 @@
     }
 
     @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public Authorities getAuthorities()
+    {
+        return authorities;
+    }
+
+    public void setAuthorities( Authorities authorities )
+    {
+        this.authorities = authorities;
+    }
+
+    @JsonProperty
     @JacksonXmlElementWrapper( localName = "publicAuthorities", namespace = DxfNamespaces.DXF_2_0 )
     @JacksonXmlProperty( localName = "publicAuthority", namespace = DxfNamespaces.DXF_2_0 )
     public List<String> getPublicAuthorities()

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultPropertyScannerService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultPropertyScannerService.java	2014-03-21 09:35:30 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/schema/DefaultPropertyScannerService.java	2014-03-26 11:12:59 +0000
@@ -65,6 +65,7 @@
             property.setIdentifiableObject( descriptor.isIdentifiableObject() );
             property.setName( descriptor.getName() );
             property.setXmlName( descriptor.getXmlName() );
+            property.setXmlNamespace( descriptor.getXmlNamespace() );
             property.setXmlCollectionName( descriptor.getXmlCollectionName() );
             property.setDescription( descriptor.getDescription() );
         }

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java	2014-03-26 11:12:59 +0000
@@ -34,6 +34,7 @@
 import com.google.common.collect.Maps;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.annotation.Description;
+import org.hisp.dhis.schema.Property;
 import org.hisp.dhis.system.util.functional.Function1;
 import org.hisp.dhis.system.util.functional.Predicate;
 import org.springframework.util.StringUtils;
@@ -404,7 +405,7 @@
         return methods;
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public static <T> T invokeMethod( Object target, Method method, Object... args )
     {
         if ( Modifier.isProtected( method.getModifiers() ) || Modifier.isPrivate( method.getModifiers() ) )
@@ -426,7 +427,7 @@
         }
     }
 
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public static <T> T getFieldObject( Field field, T target )
     {
         return (T) invokeGetterMethod( field.getName(), target );
@@ -541,6 +542,8 @@
 
         private String xmlName;
 
+        private String xmlNamespace;
+
         private boolean xmlAttribute;
 
         private String xmlCollectionName;
@@ -570,6 +573,17 @@
         }
 
         @JsonProperty
+        public String getXmlNamespace()
+        {
+            return xmlNamespace;
+        }
+
+        public void setXmlNamespace( String xmlNamespace )
+        {
+            this.xmlNamespace = xmlNamespace;
+        }
+
+        @JsonProperty
         public String getDescription()
         {
             return description;
@@ -730,6 +744,7 @@
                         descriptor.setXmlName( jacksonXmlProperty.localName() );
                     }
 
+                    descriptor.setXmlNamespace( jacksonXmlProperty.namespace() );
                     descriptor.setXmlAttribute( jacksonXmlProperty.isAttribute() );
                 }