You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/04/26 13:55:29 UTC
svn commit: r938016 - in
/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry:
DefaultServerEntry.java Entry.java ServerEntry.java
client/DefaultClientEntry.java
Author: elecharny
Date: Mon Apr 26 11:55:28 2010
New Revision: 938016
URL: http://svn.apache.org/viewvc?rev=938016&view=rev
Log:
Moved the contains() methods to ClientEntry
Modified:
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerEntry.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java?rev=938016&r1=938015&r2=938016&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultServerEntry.java Mon Apr 26 11:55:28 2010
@@ -24,10 +24,8 @@ import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -420,90 +418,6 @@ public final class DefaultServerEntry ex
// API
//-------------------------------------------------------------------------
/**
- * Checks if an entry contains an attribute with some given binary values.
- *
- * @param attributeType The Attribute we are looking for.
- * @param values The searched values.
- * @return <code>true</code> if all the values are found within the attribute,
- * <code>false</code> otherwise, or if the attributes does not exist.
- */
- public boolean contains( AttributeType attributeType, byte[]... values )
- {
- if ( attributeType == null )
- {
- return false;
- }
-
- EntryAttribute attribute = attributes.get( attributeType.getOid() );
-
- if ( attribute != null )
- {
- return attribute.contains( values );
- }
- else
- {
- return false;
- }
- }
-
-
- /**
- * Checks if an entry contains an attribute with some given String values.
- *
- * @param attributeType The Attribute we are looking for.
- * @param values The searched values.
- * @return <code>true</code> if all the values are found within the attribute,
- * <code>false</code> otherwise, or if the attributes does not exist.
- */
- public boolean contains( AttributeType attributeType, String... values )
- {
- if ( attributeType == null )
- {
- return false;
- }
-
- EntryAttribute attribute = attributes.get( attributeType.getOid() );
-
- if ( attribute != null )
- {
- return attribute.contains( values );
- }
- else
- {
- return false;
- }
- }
-
-
- /**
- * Checks if an entry contains an attribute with some given binary values.
- *
- * @param attributeType The Attribute we are looking for.
- * @param values The searched values.
- * @return <code>true</code> if all the values are found within the attribute,
- * <code>false</code> otherwise, or if the attributes does not exist.
- */
- public boolean contains( AttributeType attributeType, Value<?>... values )
- {
- if ( attributeType == null )
- {
- return false;
- }
-
- EntryAttribute attribute = attributes.get( attributeType.getOid() );
-
- if ( attribute != null )
- {
- return attribute.contains( values );
- }
- else
- {
- return false;
- }
- }
-
-
- /**
* <p>
* Checks if an entry contains a list of attributes.
* </p>
@@ -537,132 +451,6 @@ public final class DefaultServerEntry ex
/**
- * Checks if an entry contains an attribute with some binary values.
- *
- * @param id The Attribute we are looking for.
- * @param values The searched values.
- * @return <code>true</code> if all the values are found within the attribute,
- * false if at least one value is not present or if the ID is not valid.
- */
- public boolean contains( String id, byte[]... values )
- {
- if ( id == null )
- {
- return false;
- }
-
- try
- {
- AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( id );
-
- if ( attributeType == null )
- {
- return false;
- }
-
- EntryAttribute attribute = attributes.get( attributeType.getOid() );
-
- if ( attribute != null )
- {
- return attribute.contains( values );
- }
- else
- {
- return false;
- }
- }
- catch ( LdapException ne )
- {
- return false;
- }
- }
-
-
- /**
- * Checks if an entry contains an attribute with some String values.
- *
- * @param id The Attribute we are looking for.
- * @param values The searched values.
- * @return <code>true</code> if all the values are found within the attribute,
- * false if at least one value is not present or if the ID is not valid.
- */
- public boolean contains( String id, String... values )
- {
- if ( id == null )
- {
- return false;
- }
-
- try
- {
- AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( id );
-
- if ( attributeType == null )
- {
- return false;
- }
-
- EntryAttribute attribute = attributes.get( attributeType.getOid() );
-
- if ( attribute != null )
- {
- return attribute.contains( values );
- }
- else
- {
- return false;
- }
- }
- catch ( LdapException ne )
- {
- return false;
- }
- }
-
-
- /**
- * Checks if an entry contains an attribute with some values.
- *
- * @param id The Attribute we are looking for.
- * @param values The searched values.
- * @return <code>true</code> if all the values are found within the attribute,
- * false if at least one value is not present or if the ID is not valid.
- */
- public boolean contains( String id, Value<?>... values )
- {
- if ( id == null )
- {
- return false;
- }
-
- try
- {
- AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( id );
-
- if ( attributeType == null )
- {
- return false;
- }
-
- EntryAttribute attribute = attributes.get( attributeType.getOid() );
-
- if ( attribute != null )
- {
- return attribute.contains( values );
- }
- else
- {
- return false;
- }
- }
- catch ( LdapException ne )
- {
- return false;
- }
- }
-
-
- /**
* Checks if an entry contains a specific AttributeType.
*
* @param attributeType The AttributeType to look for.
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java?rev=938016&r1=938015&r2=938016&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java Mon Apr 26 11:55:28 2010
@@ -527,6 +527,45 @@ public interface Entry extends Cloneable
List<EntryAttribute> removeAttributes( String... attributes );
+ // -----------------------------------------------------------------------
+ // Container (get/put/remove) Methods
+ // -----------------------------------------------------------------------
+ /**
+ * Checks if an entry contains an attribute with some given binary values.
+ *
+ * @param attributeType The Attribute we are looking for.
+ * @param values The searched values.
+ * @return <code>true</code> if all the values are found within the attribute,
+ * <code>false</code> otherwise, or if the attributes does not exist.
+ * @throws LdapException If the attribute does not exists
+ */
+ boolean contains( AttributeType attributeType, byte[]... values );
+
+
+ /**
+ * Checks if an entry contains an attribute with some given String values.
+ *
+ * @param attributeType The Attribute we are looking for.
+ * @param values The searched values.
+ * @return <code>true</code> if all the values are found within the attribute,
+ * <code>false</code> otherwise, or if the attributes does not exist.
+ * @throws LdapException If the attribute does not exists
+ */
+ boolean contains( AttributeType attributeType, String... values );
+
+
+ /**
+ * Checks if an entry contains an attribute with some given binary values.
+ *
+ * @param attributeType The Attribute we are looking for.
+ * @param values The searched values.
+ * @return <code>true</code> if all the values are found within the attribute,
+ * <code>false</code> otherwise, or if the attributes does not exist.
+ * @throws LdapException If the attribute does not exists
+ */
+ boolean contains( AttributeType attributeType, Value<?>... values );
+
+
/**
* <p>
* Checks if an entry contains a list of attributes.
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerEntry.java?rev=938016&r1=938015&r2=938016&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerEntry.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/ServerEntry.java Mon Apr 26 11:55:28 2010
@@ -32,47 +32,8 @@ import org.apache.directory.shared.ldap.
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public interface ServerEntry extends Entry, Cloneable
+public interface ServerEntry extends Entry
{
- // -----------------------------------------------------------------------
- // Container (get/put/remove) Methods
- // -----------------------------------------------------------------------
- /**
- * Checks if an entry contains an attribute with some given binary values.
- *
- * @param attributeType The Attribute we are looking for.
- * @param values The searched values.
- * @return <code>true</code> if all the values are found within the attribute,
- * <code>false</code> otherwise, or if the attributes does not exist.
- * @throws LdapException If the attribute does not exists
- */
- boolean contains( AttributeType attributeType, byte[]... values );
-
-
- /**
- * Checks if an entry contains an attribute with some given String values.
- *
- * @param attributeType The Attribute we are looking for.
- * @param values The searched values.
- * @return <code>true</code> if all the values are found within the attribute,
- * <code>false</code> otherwise, or if the attributes does not exist.
- * @throws LdapException If the attribute does not exists
- */
- boolean contains( AttributeType attributeType, String... values );
-
-
- /**
- * Checks if an entry contains an attribute with some given binary values.
- *
- * @param attributeType The Attribute we are looking for.
- * @param values The searched values.
- * @return <code>true</code> if all the values are found within the attribute,
- * <code>false</code> otherwise, or if the attributes does not exist.
- * @throws LdapException If the attribute does not exists
- */
- boolean contains( AttributeType attributeType, Value<?>... values );
-
-
/**
* Checks if an entry contains a specific AttributeType.
*
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java?rev=938016&r1=938015&r2=938016&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientEntry.java Mon Apr 26 11:55:28 2010
@@ -646,18 +646,7 @@ public class DefaultClientEntry implemen
/**
- * <p>
- * Checks if an entry contains a list of attributes.
- * </p>
- * <p>
- * If the list is null or empty, this method will return <code>true</code>
- * if the entry has no attribute, <code>false</code> otherwise.
- * </p>
- *
- * @param attributes The Attributes to look for
- * @return <code>true</code> if all the attributes are found within
- * the entry, <code>false</code> if at least one of them is not present.
- * @throws LdapException If the attribute does not exist
+ * {@inheritDoc}
*/
public boolean contains( EntryAttribute... attributes ) throws LdapException
{
@@ -679,32 +668,114 @@ public class DefaultClientEntry implemen
/**
- * Checks if an entry contains a specific attribute
- *
- * @param attributes The Attributes to look for
- * @return <code>true</code> if the attributes are found within the entry
- * @throws LdapException If the attribute does not exist
+ * {@inheritDoc}
*/
public boolean contains( String upId ) throws LdapException
{
+ if ( StringTools.isEmpty( upId ) )
+ {
+ return false;
+ }
+
String id = getId( upId );
return attributes.containsKey( id );
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean contains( AttributeType attributeType, byte[]... values )
+ {
+ if ( attributeType == null )
+ {
+ return false;
+ }
+
+ EntryAttribute attribute = attributes.get( attributeType.getOid() );
+
+ if ( attribute != null )
+ {
+ return attribute.contains( values );
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean contains( AttributeType attributeType, String... values )
+ {
+ if ( attributeType == null )
+ {
+ return false;
+ }
+
+ EntryAttribute attribute = attributes.get( attributeType.getOid() );
+
+ if ( attribute != null )
+ {
+ return attribute.contains( values );
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean contains( AttributeType attributeType, Value<?>... values )
+ {
+ if ( attributeType == null )
+ {
+ return false;
+ }
+
+ EntryAttribute attribute = attributes.get( attributeType.getOid() );
+
+ if ( attribute != null )
+ {
+ return attribute.contains( values );
+ }
+ else
+ {
+ return false;
+ }
+ }
+
/**
- * Checks if an entry contains an attribute with some binary values.
- *
- * @param id The Attribute we are looking for.
- * @param values The searched values.
- * @return <code>true</code> if all the values are found within the attribute,
- * false if at least one value is not present or if the ID is not valid.
+ * {@inheritDoc}
*/
public boolean contains( String upId, byte[]... values )
{
+ if ( StringTools.isEmpty( upId ) )
+ {
+ return false;
+ }
+
String id = getId( upId );
+ if ( schemaManager != null )
+ {
+ try
+ {
+ return contains( schemaManager.lookupAttributeTypeRegistry( id ), values );
+ }
+ catch ( LdapException le )
+ {
+ return false;
+ }
+ }
+
EntryAttribute attribute = attributes.get( id );
if ( attribute == null )
@@ -717,16 +788,29 @@ public class DefaultClientEntry implemen
/**
- * Checks if an entry contains an attribute with some String values.
- *
- * @param id The Attribute we are looking for.
- * @param values The searched values.
- * @return <code>true</code> if all the values are found within the attribute,
- * false if at least one value is not present or if the ID is not valid.
+ * {@inheritDoc}
*/
public boolean contains( String upId, String... values )
{
+ if ( StringTools.isEmpty( upId ) )
+ {
+ return false;
+ }
+
String id = getId( upId );
+
+ if ( schemaManager != null )
+ {
+ try
+ {
+ return contains( schemaManager.lookupAttributeTypeRegistry( id ), values );
+ }
+ catch ( LdapException le )
+ {
+ return false;
+ }
+ }
+
EntryAttribute attribute = attributes.get( id );
@@ -740,16 +824,29 @@ public class DefaultClientEntry implemen
/**
- * Checks if an entry contains an attribute with some values.
- *
- * @param id The Attribute we are looking for.
- * @param values The searched values.
- * @return <code>true</code> if all the values are found within the attribute,
- * false if at least one value is not present or if the ID is not valid.
+ * {@inheritDoc}
*/
public boolean contains( String upId, Value<?>... values )
{
+ if ( StringTools.isEmpty( upId ) )
+ {
+ return false;
+ }
+
String id = getId( upId );
+
+ if ( schemaManager != null )
+ {
+ try
+ {
+ return contains( schemaManager.lookupAttributeTypeRegistry( id ), values );
+ }
+ catch ( LdapException le )
+ {
+ return false;
+ }
+ }
+
EntryAttribute attribute = attributes.get( id );
@@ -763,10 +860,7 @@ public class DefaultClientEntry implemen
/**
- * Checks if an entry contains some specific attributes.
- *
- * @param attributes The Attributes to look for.
- * @return <code>true</code> if the attributes are all found within the entry.
+ * {@inheritDoc}
*/
public boolean containsAttribute( String... attributes )
{