directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1587590 - in /directory: apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/
Date Tue, 15 Apr 2014 14:11:56 GMT
Author: elecharny
Date: Tue Apr 15 14:11:56 2014
New Revision: 1587590

URL: http://svn.apache.org/r1587590
Log:
Made the Entry API fluent (DIRAPI-187)

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java?rev=1587590&r1=1587589&r2=1587590&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/entry/ClonedServerEntry.java
Tue Apr 15 14:11:56 2014
@@ -93,39 +93,39 @@ public class ClonedServerEntry implement
     }
 
 
-    public void add( AttributeType attributeType, byte[]... values ) throws LdapException
+    public Entry add( AttributeType attributeType, byte[]... values ) throws LdapException
     {
-        clonedEntry.add( attributeType, values );
+        return clonedEntry.add( attributeType, values );
     }
 
 
-    public void add( AttributeType attributeType, String... values ) throws LdapException
+    public Entry add( AttributeType attributeType, String... values ) throws LdapException
     {
-        clonedEntry.add( attributeType, values );
+        return clonedEntry.add( attributeType, values );
     }
 
 
-    public void add( AttributeType attributeType, Value<?>... values ) throws LdapException
+    public Entry add( AttributeType attributeType, Value<?>... values ) throws LdapException
     {
-        clonedEntry.add( attributeType, values );
+        return clonedEntry.add( attributeType, values );
     }
 
 
-    public void add( String upId, AttributeType attributeType, byte[]... values ) throws
LdapException
+    public Entry add( String upId, AttributeType attributeType, byte[]... values ) throws
LdapException
     {
-        clonedEntry.add( attributeType, values );
+        return clonedEntry.add( attributeType, values );
     }
 
 
-    public void add( String upId, AttributeType attributeType, String... values ) throws
LdapException
+    public Entry add( String upId, AttributeType attributeType, String... values ) throws
LdapException
     {
-        clonedEntry.add( attributeType, values );
+        return clonedEntry.add( attributeType, values );
     }
 
 
-    public void add( String upId, AttributeType attributeType, Value<?>... values )
throws LdapException
+    public Entry add( String upId, AttributeType attributeType, Value<?>... values
) throws LdapException
     {
-        clonedEntry.add( attributeType, values );
+        return clonedEntry.add( attributeType, values );
     }
 
 
@@ -240,27 +240,27 @@ public class ClonedServerEntry implement
     }
 
 
-    public void add( Attribute... attributes ) throws LdapException
+    public Entry add( Attribute... attributes ) throws LdapException
     {
-        clonedEntry.add( attributes );
+        return clonedEntry.add( attributes );
     }
 
 
-    public void add( String upId, String... values ) throws LdapException
+    public Entry add( String upId, String... values ) throws LdapException
     {
-        clonedEntry.add( upId, values );
+        return clonedEntry.add( upId, values );
     }
 
 
-    public void add( String upId, byte[]... values ) throws LdapException
+    public Entry add( String upId, byte[]... values ) throws LdapException
     {
-        clonedEntry.add( upId, values );
+        return clonedEntry.add( upId, values );
     }
 
 
-    public void add( String upId, Value<?>... values ) throws LdapException
+    public Entry add( String upId, Value<?>... values ) throws LdapException
     {
-        clonedEntry.add( upId, values );
+        return clonedEntry.add( upId, values );
     }
 
 

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java?rev=1587590&r1=1587589&r2=1587590&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
Tue Apr 15 14:11:56 2014
@@ -586,7 +586,7 @@ public final class DefaultEntry implemen
     /**
      * {@inheritDoc}
      */
-    public void add( AttributeType attributeType, byte[]... values ) throws LdapException
+    public Entry add( AttributeType attributeType, byte[]... values ) throws LdapException
     {
         if ( attributeType == null )
         {
@@ -625,13 +625,15 @@ public final class DefaultEntry implemen
             // createAttribute method
             createAttribute( null, attributeType, values );
         }
+        
+        return this;
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void add( AttributeType attributeType, String... values ) throws LdapException
+    public Entry add( AttributeType attributeType, String... values ) throws LdapException
     {
         if ( attributeType == null )
         {
@@ -655,13 +657,15 @@ public final class DefaultEntry implemen
             // createAttribute method
             createAttribute( null, attributeType, values );
         }
+        
+        return this;
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void add( AttributeType attributeType, Value<?>... values ) throws LdapException
+    public Entry add( AttributeType attributeType, Value<?>... values ) throws LdapException
     {
         if ( attributeType == null )
         {
@@ -685,13 +689,15 @@ public final class DefaultEntry implemen
             // createAttribute method
             createAttribute( null, attributeType, values );
         }
+        
+        return this;
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void add( String upId, AttributeType attributeType, byte[]... values ) throws
LdapException
+    public Entry add( String upId, AttributeType attributeType, byte[]... values ) throws
LdapException
     {
         // ObjectClass with binary values are not allowed
         if ( attributeType.equals( objectClassAttributeType ) )
@@ -718,13 +724,15 @@ public final class DefaultEntry implemen
             // and the upId
             createAttribute( id, attributeType, values );
         }
+        
+        return this;
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void add( String upId, AttributeType attributeType, Value<?>... values )
throws LdapException
+    public Entry add( String upId, AttributeType attributeType, Value<?>... values
) throws LdapException
     {
         if ( attributeType == null )
         {
@@ -748,13 +756,15 @@ public final class DefaultEntry implemen
         {
             createAttribute( id, attributeType, values );
         }
+        
+        return this;
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void add( String upId, AttributeType attributeType, String... values ) throws
LdapException
+    public Entry add( String upId, AttributeType attributeType, String... values ) throws
LdapException
     {
         if ( attributeType == null )
         {
@@ -780,13 +790,15 @@ public final class DefaultEntry implemen
             // and the upId
             createAttribute( id, attributeType, values );
         }
+        
+        return this;
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void add( Attribute... attributes ) throws LdapException
+    public Entry add( Attribute... attributes ) throws LdapException
     {
         // Loop on all the added attributes
         for ( Attribute attribute : attributes )
@@ -837,13 +849,15 @@ public final class DefaultEntry implemen
                 }
             }
         }
+        
+        return this;
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void add( String upId, byte[]... values ) throws LdapException
+    public Entry add( String upId, byte[]... values ) throws LdapException
     {
         if ( Strings.isEmpty( upId ) )
         {
@@ -879,13 +893,15 @@ public final class DefaultEntry implemen
                 attributes.put( id, new DefaultAttribute( upId, values ) );
             }
         }
+        
+        return this;
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void add( String upId, String... values ) throws LdapException
+    public Entry add( String upId, String... values ) throws LdapException
     {
         if ( Strings.isEmpty( upId ) )
         {
@@ -921,13 +937,15 @@ public final class DefaultEntry implemen
                 attributes.put( id, new DefaultAttribute( upId, values ) );
             }
         }
+        
+        return this;
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void add( String upId, Value<?>... values ) throws LdapException
+    public Entry add( String upId, Value<?>... values ) throws LdapException
     {
         if ( Strings.isEmpty( upId ) )
         {
@@ -963,6 +981,8 @@ public final class DefaultEntry implemen
                 attributes.put( id, new DefaultAttribute( upId, values ) );
             }
         }
+        
+        return this;
     }
 
 

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java?rev=1587590&r1=1587589&r2=1587590&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java
Tue Apr 15 14:11:56 2014
@@ -154,9 +154,10 @@ public interface Entry extends Cloneable
      * Add some Attributes to the current Entry.
      *
      * @param attributes The attributes to add
+     * @return the modified entry
      * @throws LdapException If we can't add any of the attributes
      */
-    void add( Attribute... attributes ) throws LdapException;
+    Entry add( Attribute... attributes ) throws LdapException;
 
 
     /**
@@ -175,9 +176,10 @@ public interface Entry extends Cloneable
      *
      * @param attributeType The attribute Type.
      * @param values The list of binary values to inject. It can be empty.
+     * @return the modified entry
      * @throws LdapException If the attribute does not exist
      */
-    void add( AttributeType attributeType, byte[]... values ) throws LdapException;
+    Entry add( AttributeType attributeType, byte[]... values ) throws LdapException;
 
 
     /**
@@ -196,9 +198,10 @@ public interface Entry extends Cloneable
      * 
      * @param attributeType The attribute Type
      * @param values The list of binary values to inject. It can be empty
+     * @return the modified entry
      * @throws org.apache.directory.api.ldap.model.exception.LdapException If the attribute
does not exist
      */
-    void add( AttributeType attributeType, String... values ) throws LdapException;
+    Entry add( AttributeType attributeType, String... values ) throws LdapException;
 
 
     /**
@@ -217,9 +220,10 @@ public interface Entry extends Cloneable
      *
      * @param attributeType The attribute Type
      * @param values The list of binary values to inject. It can be empty
+     * @return the modified entry
      * @throws LdapException If the attribute does not exist
      */
-    void add( AttributeType attributeType, Value<?>... values ) throws LdapException;
+    Entry add( AttributeType attributeType, Value<?>... values ) throws LdapException;
 
 
     /**
@@ -239,9 +243,10 @@ public interface Entry extends Cloneable
      * @param upId The user provided ID for the added AttributeType
      * @param attributeType The attribute Type.
      * @param values The list of binary values to add. It can be empty.
+     * @return the modified entry
      * @throws LdapException If the attribute does not exist
      */
-    void add( String upId, AttributeType attributeType, byte[]... values ) throws LdapException;
+    Entry add( String upId, AttributeType attributeType, byte[]... values ) throws LdapException;
 
 
     /**
@@ -261,9 +266,10 @@ public interface Entry extends Cloneable
      * @param upId The user provided ID for the added AttributeType
      * @param attributeType The attribute Type.
      * @param values The list of String values to add. It can be empty.
+     * @return the modified entry
      * @throws LdapException If the attribute does not exist
      */
-    void add( String upId, AttributeType attributeType, String... values ) throws LdapException;
+    Entry add( String upId, AttributeType attributeType, String... values ) throws LdapException;
 
 
     /**
@@ -283,9 +289,10 @@ public interface Entry extends Cloneable
      * @param upId The user provided ID for the added AttributeType
      * @param attributeType The attribute Type.
      * @param values The list of values to add. It can be empty.
+     * @return the modified entry
      * @throws LdapException If the attribute does not exist
      */
-    void add( String upId, AttributeType attributeType, Value<?>... values ) throws
LdapException;
+    Entry add( String upId, AttributeType attributeType, Value<?>... values ) throws
LdapException;
 
 
     /**
@@ -294,9 +301,10 @@ public interface Entry extends Cloneable
      * @param upId The user provided ID of the attribute we want to add 
      * some values to
      * @param values The list of String values to add
+     * @return the modified entry
      * @throws LdapException If we can't add any of the values
      */
-    void add( String upId, String... values ) throws LdapException;
+    Entry add( String upId, String... values ) throws LdapException;
 
 
     /**
@@ -305,9 +313,10 @@ public interface Entry extends Cloneable
      * @param upId The user provided ID of the attribute we want to add 
      * some values to
      * @param values The list of binary values to add
+     * @return the modified entry
      * @throws LdapException If we can't add any of the values
      */
-    void add( String upId, byte[]... values ) throws LdapException;
+    Entry add( String upId, byte[]... values ) throws LdapException;
 
 
     /**
@@ -316,9 +325,10 @@ public interface Entry extends Cloneable
      * @param upId The user provided ID of the attribute we want to add 
      * some values to
      * @param values The list of Values to add
+     * @return the modified entry
      * @throws LdapException If we can't add any of the values
      */
-    void add( String upId, Value<?>... values ) throws LdapException;
+    Entry add( String upId, Value<?>... values ) throws LdapException;
 
 
     /**

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java?rev=1587590&r1=1587589&r2=1587590&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java
Tue Apr 15 14:11:56 2014
@@ -70,7 +70,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public void add( AttributeType attributeType, byte[]... values ) throws LdapException
+    public Entry add( AttributeType attributeType, byte[]... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn()
+ " is immutable." );
@@ -80,7 +80,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public void add( AttributeType attributeType, String... values ) throws LdapException
+    public Entry add( AttributeType attributeType, String... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn()
+ " is immutable." );
@@ -90,7 +90,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public void add( AttributeType attributeType, Value<?>... values ) throws LdapException
+    public Entry add( AttributeType attributeType, Value<?>... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn()
+ " is immutable." );
@@ -100,7 +100,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public void add( String upId, AttributeType attributeType, byte[]... values ) throws
LdapException
+    public Entry add( String upId, AttributeType attributeType, byte[]... values ) throws
LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn()
+ " is immutable." );
@@ -110,7 +110,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public void add( String upId, AttributeType attributeType, Value<?>... values )
throws LdapException
+    public Entry add( String upId, AttributeType attributeType, Value<?>... values
) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn()
+ " is immutable." );
@@ -120,7 +120,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public void add( String upId, AttributeType attributeType, String... values ) throws
LdapException
+    public Entry add( String upId, AttributeType attributeType, String... values ) throws
LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn()
+ " is immutable." );
@@ -130,7 +130,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public void add( Attribute... attributes ) throws LdapException
+    public Entry add( Attribute... attributes ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn()
+ " is immutable." );
@@ -140,7 +140,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public void add( String upId, byte[]... values ) throws LdapException
+    public Entry add( String upId, byte[]... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn()
+ " is immutable." );
@@ -150,7 +150,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public void add( String upId, String... values ) throws LdapException
+    public Entry add( String upId, String... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn()
+ " is immutable." );
@@ -160,7 +160,7 @@ public class ImmutableEntry implements E
     /**
      * {@inheritDoc}
      */
-    public void add( String upId, Value<?>... values ) throws LdapException
+    public Entry add( String upId, Value<?>... values ) throws LdapException
     {
         new Exception().printStackTrace();
         throw new NotImplementedException( "Cannot add an attribute : the entry " + entry.getDn()
+ " is immutable." );



Mime
View raw message