directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1510897 - in /directory/escimo/trunk: common/src/main/java/org/apache/directory/scim/json/ ldap/src/main/java/org/apache/directory/scim/ldap/ ldap/src/main/java/org/apache/directory/scim/ldap/schema/
Date Tue, 06 Aug 2013 10:31:25 GMT
Author: kayyagari
Date: Tue Aug  6 10:31:25 2013
New Revision: 1510897

URL: http://svn.apache.org/r1510897
Log:
o moved name and show attributes to base type
o organzed the parameters in attribute types

Modified:
    directory/escimo/trunk/common/src/main/java/org/apache/directory/scim/json/ResourceSerializer.java
    directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapSchemaMapper.java
    directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/BaseType.java
    directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/ComplexType.java
    directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/DynamicType.java
    directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/MultiValType.java
    directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/SimpleType.java
    directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/TypedType.java

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=1510897&r1=1510896&r2=1510897&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
Tue Aug  6 10:31:25 2013
@@ -30,8 +30,6 @@ import org.apache.directory.scim.SimpleA
 import org.apache.directory.scim.SimpleAttributeGroup;
 import org.apache.directory.scim.User;
 
-import sun.reflect.generics.tree.BaseType;
-
 import com.google.gson.Gson;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;

Modified: directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapSchemaMapper.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapSchemaMapper.java?rev=1510897&r1=1510896&r2=1510897&view=diff
==============================================================================
--- directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapSchemaMapper.java
(original)
+++ directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/LdapSchemaMapper.java
Tue Aug  6 10:31:25 2013
@@ -225,13 +225,15 @@ public class LdapSchemaMapper implements
                     + elmComplex.asXML() );
             }
 
+            boolean show = getShowVal( elmComplex );
+            
             List<SimpleType> stList = new ArrayList<SimpleType>();
 
             Element atGrpElm = elmComplex.element( "at-group" );
             SimpleTypeGroup stg = parseAtGroup( atGrpElm, uri );
             if ( stg != null )
             {
-                ComplexType ct = new ComplexType( name, uri, stg );
+                ComplexType ct = new ComplexType( uri, name, show, stg );
                 resourceSchema.addAttributeType( name, ct );
             }
 
@@ -240,33 +242,35 @@ public class LdapSchemaMapper implements
         // load multival-attributes
         List<Element> multivalAtElmList = schemaRoot.elements( "multival-attribute"
);
 
-        for ( Element elmComplex : multivalAtElmList )
+        for ( Element elmMultiVal : multivalAtElmList )
         {
-            String name = elmComplex.attributeValue( "name" );
+            String name = elmMultiVal.attributeValue( "name" );
 
             if ( Strings.isEmpty( name ) )
             {
                 throw new IllegalStateException( "name is missing in the multival-attribute
configuration element "
-                    + elmComplex.asXML() );
+                    + elmMultiVal.asXML() );
             }
 
-            String baseDn = elmComplex.attributeValue( "baseDn" );
-            String filter = elmComplex.attributeValue( "filter" );
+            String baseDn = elmMultiVal.attributeValue( "baseDn" );
+            String filter = elmMultiVal.attributeValue( "filter" );
 
-            Element elmAtGroup = elmComplex.element( "at-group" );
+            boolean showMultiVal = getShowVal( elmMultiVal );
+            
+            Element elmAtGroup = elmMultiVal.element( "at-group" );
             if ( elmAtGroup != null )
             {
                 SimpleTypeGroup stg = parseAtGroup( elmAtGroup, uri );
                 if ( stg != null )
                 {
-                    MultiValType ct = new MultiValType( name, uri, stg, baseDn, filter );
+                    MultiValType ct = new MultiValType( uri, name, showMultiVal, stg, baseDn,
filter );
                     resourceSchema.addAttributeType( name, ct );
                 }
 
             }
             else
             {
-                List<Element> lstElmTypes = elmComplex.elements( "type" );
+                List<Element> lstElmTypes = elmMultiVal.elements( "type" );
 
                 List<TypedType> lstTypes = new ArrayList<TypedType>();
 
@@ -275,12 +279,7 @@ public class LdapSchemaMapper implements
                     Element elmTypeAtGroup = elmType.element( "at-group" );
                     SimpleTypeGroup stg = parseAtGroup( elmTypeAtGroup, uri );
 
-                    String show = elmType.attributeValue( "show" );
-
-                    if ( Strings.isEmpty( show ) )
-                    {
-                        show = "true";
-                    }
+                    boolean show = getShowVal( elmType );
 
                     String primary = elmType.attributeValue( "primary" );
 
@@ -296,12 +295,12 @@ public class LdapSchemaMapper implements
                         throw new IllegalArgumentException( "name is missing in the type
element " + elmType.asXML() );
                     }
 
-                    TypedType tt = new TypedType( typeName, stg, Boolean.parseBoolean( show
),
-                        Boolean.parseBoolean( primary ), uri );
+                    TypedType tt = new TypedType( uri, typeName, show, stg, 
+                        Boolean.parseBoolean( primary ) );
                     lstTypes.add( tt );
                 }
 
-                MultiValType ct = new MultiValType( name, uri, lstTypes, baseDn, filter );
+                MultiValType ct = new MultiValType( uri, name, showMultiVal, lstTypes, baseDn,
filter );
                 resourceSchema.addAttributeType( name, ct );
             }
         }
@@ -371,6 +370,18 @@ public class LdapSchemaMapper implements
             show = Boolean.parseBoolean( showVal );
         }
 
-        return new SimpleType( name, mappedTo, uri, show );
+        return new SimpleType( uri, name, show, mappedTo );
+    }
+    
+    private boolean getShowVal(Element el)
+    {
+        String showVal = el.attributeValue( "show" );
+
+        if ( Strings.isEmpty( showVal ) )
+        {
+            showVal = "true";
+        }
+        
+        return Boolean.parseBoolean( showVal );
     }
 }

Modified: directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/BaseType.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/BaseType.java?rev=1510897&r1=1510896&r2=1510897&view=diff
==============================================================================
--- directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/BaseType.java
(original)
+++ directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/BaseType.java
Tue Aug  6 10:31:25 2013
@@ -31,9 +31,27 @@ public abstract class BaseType
 {
     private String uri;
 
-    public BaseType( String uri )
+    private String name;
+    
+    private boolean show = true;
+
+    public BaseType( String uri, String name, boolean show )
     {
         this.uri = uri;
+        this.name = name;
+        this.show = show;
+    }
+
+
+    public String getName()
+    {
+        return name;
+    }
+
+
+    public boolean isShow()
+    {
+        return show;
     }
 
 

Modified: directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/ComplexType.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/ComplexType.java?rev=1510897&r1=1510896&r2=1510897&view=diff
==============================================================================
--- directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/ComplexType.java
(original)
+++ directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/ComplexType.java
Tue Aug  6 10:31:25 2013
@@ -30,37 +30,14 @@ import java.util.List;
  */
 public class ComplexType extends BaseType
 {
-    private String name;
-
     private SimpleTypeGroup atGroup;
 
-    private boolean show = true;
-
-    public ComplexType( String name, String uri, SimpleTypeGroup atGroup )
+    public ComplexType( String uri, String name, boolean show, SimpleTypeGroup atGroup )
     {
-        super(uri);
-        this.name = name;
+        super(uri, name, show);
         this.atGroup = atGroup;
     }
 
-    /**
-     * @return the show
-     */
-    public boolean isShow()
-    {
-        return show;
-    }
-
-
-    /**
-     * @return the name
-     */
-    public String getName()
-    {
-        return name;
-    }
-
-
     public SimpleTypeGroup getAtGroup()
     {
         return atGroup;

Modified: directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/DynamicType.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/DynamicType.java?rev=1510897&r1=1510896&r2=1510897&view=diff
==============================================================================
--- directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/DynamicType.java
(original)
+++ directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/DynamicType.java
Tue Aug  6 10:31:25 2013
@@ -29,15 +29,13 @@ public class DynamicType extends BaseTyp
 {
     private SimpleTypeGroup atGroup;
     
-    private boolean show = true;
-    
     private String baseDn;
     
     private String filter;
     
-    public DynamicType(String baseDn, String filter, SimpleTypeGroup atGroup, String uri
)
+    public DynamicType(String uri, String name, boolean show, String baseDn, String filter,
SimpleTypeGroup atGroup )
     {
-        super(uri);
+        super(uri, name, show);
         this.baseDn = baseDn;
         this.filter = filter;
         this.atGroup = atGroup;

Modified: directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/MultiValType.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/MultiValType.java?rev=1510897&r1=1510896&r2=1510897&view=diff
==============================================================================
--- directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/MultiValType.java
(original)
+++ directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/MultiValType.java
Tue Aug  6 10:31:25 2013
@@ -30,40 +30,36 @@ import java.util.List;
  */
 public class MultiValType extends BaseType
 {
-    private String name;
-
     private SimpleTypeGroup stGroup;
 
     private List<TypedType> typedList;
 
-    private boolean show = true;
-
     private String baseDn;
-    
+
     private String filter;
 
     /** used for setting the value of "formatted" attribute */
     private String format;
 
-    public MultiValType( String name, String uri, SimpleTypeGroup stGroup, String baseDn,
String filter )
+
+    public MultiValType( String uri, String name, boolean show, SimpleTypeGroup stGroup,
String baseDn, String filter )
     {
-        super(uri);
-        this.name = name;
+        super( uri, name, show );
         this.stGroup = stGroup;
         this.baseDn = baseDn;
         this.filter = filter;
     }
 
 
-    public MultiValType( String name, String uri, List<TypedType> typedList, String
baseDn, String filter )
+    public MultiValType( String uri, String name, boolean show, List<TypedType> typedList,
String baseDn, String filter )
     {
-        super(uri);
-        this.name = name;
+        super( uri, name, show );
         this.typedList = typedList;
         this.baseDn = baseDn;
         this.filter = filter;
     }
 
+
     /**
      * @return the typedList
      */
@@ -83,15 +79,6 @@ public class MultiValType extends BaseTy
 
 
     /**
-     * @return the show
-     */
-    public boolean isShow()
-    {
-        return show;
-    }
-
-
-    /**
      * @return the baseDn
      */
     public String getBaseDn()
@@ -118,30 +105,10 @@ public class MultiValType extends BaseTy
     }
 
 
-    /**
-     * @return the name
-     */
-    public String getName()
-    {
-        return name;
-    }
-
-
     @Override
     public boolean isComplex()
     {
         return true;
     }
 
-
-    /* (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
-    @Override
-    public String toString()
-    {
-        return "ComplexType [name=" + name + ", stGroup=" + stGroup + ", typedList="
-            + typedList + ", show=" + show + ", format=" + format + "]";
-    }
-
 }

Modified: directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/SimpleType.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/SimpleType.java?rev=1510897&r1=1510896&r2=1510897&view=diff
==============================================================================
--- directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/SimpleType.java
(original)
+++ directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/SimpleType.java
Tue Aug  6 10:31:25 2013
@@ -27,28 +27,13 @@ package org.apache.directory.scim.ldap.s
  */
 public class SimpleType extends BaseType
 {
-    private String name;
-
     private String mappedTo;
 
-    private boolean show = true;
-
 
-    public SimpleType( String name, String mappedTo, String uri, boolean show )
+    public SimpleType( String uri, String name, boolean show, String mappedTo )
     {
-        super(uri);
-        this.name = name;
+        super( uri, name, show );
         this.mappedTo = mappedTo;
-        this.show = show;
-    }
-
-
-    /**
-     * @return the name
-     */
-    public String getName()
-    {
-        return name;
     }
 
 
@@ -61,29 +46,10 @@ public class SimpleType extends BaseType
     }
 
 
-    /**
-     * @return the show
-     */
-    public boolean isShow()
-    {
-        return show;
-    }
-
-
     @Override
     public boolean isSimple()
     {
         return true;
     }
 
-
-    /* (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
-    @Override
-    public String toString()
-    {
-        return "SimpleType [name=" + name + ", mappedTo=" + mappedTo + ", show=" + show +
"]";
-    }
-
 }

Modified: directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/TypedType.java
URL: http://svn.apache.org/viewvc/directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/TypedType.java?rev=1510897&r1=1510896&r2=1510897&view=diff
==============================================================================
--- directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/TypedType.java
(original)
+++ directory/escimo/trunk/ldap/src/main/java/org/apache/directory/scim/ldap/schema/TypedType.java
Tue Aug  6 10:31:25 2013
@@ -36,9 +36,9 @@ public class TypedType extends BaseType
     private boolean primary = false;
     
 
-    public TypedType( String name, SimpleTypeGroup atGroup, boolean show, boolean primary,
String uri )
+    public TypedType( String uri, String name, boolean show, SimpleTypeGroup atGroup, boolean
primary )
     {
-        super(uri);
+        super(uri, name, show);
         this.name = name;
         this.atGroup = atGroup;
         this.show = show;



Mime
View raw message