directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1533910 - in /directory/escimo/trunk/common/src/main/java/org/apache/directory/scim: ScimUtil.java json/ResourceSerializer.java schema/BaseType.java
Date Sun, 20 Oct 2013 14:10:26 GMT
Author: kayyagari
Date: Sun Oct 20 14:10:25 2013
New Revision: 1533910

URL: http://svn.apache.org/r1533910
Log:
o fixed the core attribute type checking
o fixed incorrect serialization of group resource

Modified:
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ScimUtil.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/json/ResourceSerializer.java
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/schema/BaseType.java

Modified: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ScimUtil.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ScimUtil.java?rev=1533910&r1=1533909&r2=1533910&view=diff
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ScimUtil.java (original)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/ScimUtil.java Sun
Oct 20 14:10:25 2013
@@ -29,6 +29,10 @@ import java.io.StringWriter;
  */
 public class ScimUtil
 {
+    public static final String CORE_USER_URI = "urn:scim:schemas:core:2.0:User";
+    public static final String CORE_GROUP_URI = "urn:scim:schemas:core:2.0:Group";
+    public static final String CORE_EXT_USER_URI = "urn:scim:schemas:extension:enterprise:2.0:User";
+
     public static String exceptionToStr( Exception e )
     {
         StringWriter sw = new StringWriter();
@@ -44,4 +48,11 @@ public class ScimUtil
         return sw.toString();
     }
 
+    
+    public static boolean isCoreAttribute( String uri )
+    {
+        return ( CORE_USER_URI.equals( uri ) || 
+                 CORE_GROUP_URI.equals( uri ) );
+    }
+
 }

Modified: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/json/ResourceSerializer.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/json/ResourceSerializer.java?rev=1533910&r1=1533909&r2=1533910&view=diff
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/json/ResourceSerializer.java
(original)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/json/ResourceSerializer.java
Sun Oct 20 14:10:25 2013
@@ -25,12 +25,11 @@ import java.util.Map;
 
 import org.apache.directory.scim.AbstractAttribute;
 import org.apache.directory.scim.ComplexAttribute;
-import org.apache.directory.scim.ServerResource;
-import org.apache.directory.scim.GroupResource;
 import org.apache.directory.scim.MultiValAttribute;
+import org.apache.directory.scim.ScimUtil;
+import org.apache.directory.scim.ServerResource;
 import org.apache.directory.scim.SimpleAttribute;
 import org.apache.directory.scim.SimpleAttributeGroup;
-import org.apache.directory.scim.UserResource;
 
 import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;
@@ -44,10 +43,6 @@ import com.google.gson.JsonPrimitive;
  */
 public class ResourceSerializer
 {
-    public static final String CORE_USER_URI = "urn:scim:schemas:core:2.0:User";
-    public static final String CORE_GROUP_URI = "urn:scim:schemas:core:2.0:Group";
-    public static final String CORE_EXT_USER_URI = "urn:scim:schemas:extension:enterprise:2.0:User";
-    
 
     public static String serialize( ServerResource resource )
     {
@@ -64,7 +59,7 @@ public class ResourceSerializer
 
             JsonObject parent = root;
 
-            if ( !uri.equals( CORE_USER_URI ) )
+            if ( !ScimUtil.isCoreAttribute( uri ) )
             {
                 parent = new JsonObject();
                 root.add( uri, parent );

Modified: directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/schema/BaseType.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/schema/BaseType.java?rev=1533910&r1=1533909&r2=1533910&view=diff
==============================================================================
--- directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/schema/BaseType.java
(original)
+++ directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/schema/BaseType.java
Sun Oct 20 14:10:25 2013
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.scim.schema;
 
+import org.apache.directory.scim.ScimUtil;
 import org.apache.directory.scim.json.ResourceSerializer;
 import static org.apache.directory.scim.json.ResourceSerializer.*;
 
@@ -79,9 +80,7 @@ public abstract class BaseType
 
     public boolean isCoreAttribute()
     {
-        return ( CORE_USER_URI.equals( uri ) || 
-                 CORE_GROUP_URI.equals( uri ) ||
-                 CORE_EXT_USER_URI.equals( uri ) );
+        return ScimUtil.isCoreAttribute( uri );
     }
 
     /**



Mime
View raw message