com.unboundid.ldap.sdk.unboundidds.controls
Class JoinRule

java.lang.Object
  extended by com.unboundid.ldap.sdk.unboundidds.controls.JoinRule
All Implemented Interfaces:
java.io.Serializable

@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class JoinRule
extends java.lang.Object
implements java.io.Serializable

NOTE: This class is part of the Commercial Edition of the UnboundID LDAP SDK for Java. It is not available for use in applications that include only the Standard Edition of the LDAP SDK, and is not supported for use in conjunction with non-UnboundID products.
This class provides an implementation of a join rule as used by the LDAP join request control. See the class-level documentation for the JoinRequestControl class for additional information and an example demonstrating its use.

Join rules are encoded as follows:
   JoinRule ::= CHOICE {
        and               [0] SET (1 .. MAX) of JoinRule,
        or                [1] SET (1 .. MAX) of JoinRule,
        dnJoin            [2] AttributeDescription,
        equalityJoin      [3] JoinRuleAssertion,
        containsJoin      [4] JoinRuleAssertion,
        reverseDNJoin     [5] AttributeDescription,
        ... }

   JoinRuleAssertion ::= SEQUENCE {
        sourceAttribute     AttributeDescription,
        targetAttribute     AttributeDescription,
        matchAll            BOOLEAN DEFAULT FALSE }
 

See Also:
Serialized Form

Field Summary
static byte JOIN_TYPE_AND
          The join rule type that will be used for AND join rules.
static byte JOIN_TYPE_CONTAINS
          The join rule type that will be used for contains join rules.
static byte JOIN_TYPE_DN
          The join rule type that will be used for DN join rules.
static byte JOIN_TYPE_EQUALITY
          The join rule type that will be used for equality join rules.
static byte JOIN_TYPE_OR
          The join rule type that will be used for OR join rules.
static byte JOIN_TYPE_REVERSE_DN
          The join rule type that will be used for reverse DN join rules.
 
Method Summary
static JoinRule createANDRule(JoinRule... components)
          Creates an AND join rule in which all of the contained join rules must match an entry for it to be included in the join.
static JoinRule createANDRule(java.util.List<JoinRule> components)
          Creates an AND join rule in which all of the contained join rules must match an entry for it to be included in the join.
static JoinRule createContainsJoin(java.lang.String sourceAttribute, java.lang.String targetAttribute, boolean matchAll)
          Creates an equality join rule in which the value(s) of the source attribute in the source entry must be equal to or a substring of the value(s) of the target attribute of a target entry for it to be included in the join.
static JoinRule createDNJoin(java.lang.String sourceAttribute)
          Creates a DN join rule in which the value(s) of the source attribute must specify the DN(s) of the target entries to include in the join.
static JoinRule createEqualityJoin(java.lang.String sourceAttribute, java.lang.String targetAttribute, boolean matchAll)
          Creates an equality join rule in which the value(s) of the source attribute in the source entry must be equal to the value(s) of the target attribute of a target entry for it to be included in the join.
static JoinRule createORRule(JoinRule... components)
          Creates an OR join rule in which at least one of the contained join rules must match an entry for it to be included in the join.
static JoinRule createORRule(java.util.List<JoinRule> components)
          Creates an OR join rule in which at least one of the contained join rules must match an entry for it to be included in the join.
static JoinRule createReverseDNJoin(java.lang.String targetAttribute)
          Creates a reverse DN join rule in which the target entries to include in the join must include a specified attribute that contains the DN of the source entry.
 JoinRule[] getComponents()
          Retrieves the set of subordinate components for this AND or OR join rule.
 java.lang.String getSourceAttribute()
          Retrieves the name of the source attribute for this DN, equality, or contains join rule.
 java.lang.String getTargetAttribute()
          Retrieves the name of the target attribute for this reverse DN, equality, or contains join rule.
 byte getType()
          Retrieves the join rule type for this join rule.
 boolean matchAll()
          Indicates whether all values of a multivalued source attribute must be present in a target entry for it to be considered a match.
 java.lang.String toString()
          Retrieves a string representation of this join rule.
 void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this join rule to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JOIN_TYPE_AND

public static final byte JOIN_TYPE_AND
The join rule type that will be used for AND join rules.

See Also:
Constant Field Values

JOIN_TYPE_OR

public static final byte JOIN_TYPE_OR
The join rule type that will be used for OR join rules.

See Also:
Constant Field Values

JOIN_TYPE_DN

public static final byte JOIN_TYPE_DN
The join rule type that will be used for DN join rules.

See Also:
Constant Field Values

JOIN_TYPE_EQUALITY

public static final byte JOIN_TYPE_EQUALITY
The join rule type that will be used for equality join rules.

See Also:
Constant Field Values

JOIN_TYPE_CONTAINS

public static final byte JOIN_TYPE_CONTAINS
The join rule type that will be used for contains join rules.

See Also:
Constant Field Values

JOIN_TYPE_REVERSE_DN

public static final byte JOIN_TYPE_REVERSE_DN
The join rule type that will be used for reverse DN join rules.

See Also:
Constant Field Values
Method Detail

createANDRule

public static JoinRule createANDRule(JoinRule... components)
Creates an AND join rule in which all of the contained join rules must match an entry for it to be included in the join.

Parameters:
components - The set of components to include in this join. It must not be null or empty.
Returns:
The created AND join rule.

createANDRule

public static JoinRule createANDRule(java.util.List<JoinRule> components)
Creates an AND join rule in which all of the contained join rules must match an entry for it to be included in the join.

Parameters:
components - The set of components to include in this join. It must not be null or empty.
Returns:
The created AND join rule.

createORRule

public static JoinRule createORRule(JoinRule... components)
Creates an OR join rule in which at least one of the contained join rules must match an entry for it to be included in the join.

Parameters:
components - The set of components to include in this join. It must not be null or empty.
Returns:
The created OR join rule.

createORRule

public static JoinRule createORRule(java.util.List<JoinRule> components)
Creates an OR join rule in which at least one of the contained join rules must match an entry for it to be included in the join.

Parameters:
components - The set of components to include in this join. It must not be null or empty.
Returns:
The created OR join rule.

createDNJoin

public static JoinRule createDNJoin(java.lang.String sourceAttribute)
Creates a DN join rule in which the value(s) of the source attribute must specify the DN(s) of the target entries to include in the join.

Parameters:
sourceAttribute - The name or OID of the attribute in the source entry whose values contain the DNs of the entries to be included in the join. It must not be null, and it must be associated with a distinguished name or name and optional UID syntax.
Returns:
The created DN join rule.

createEqualityJoin

public static JoinRule createEqualityJoin(java.lang.String sourceAttribute,
                                          java.lang.String targetAttribute,
                                          boolean matchAll)
Creates an equality join rule in which the value(s) of the source attribute in the source entry must be equal to the value(s) of the target attribute of a target entry for it to be included in the join.

Parameters:
sourceAttribute - The name or OID of the attribute in the source entry whose value(s) should be matched in target entries to be included in the join. It must not be null.
targetAttribute - The name or OID of the attribute whose value(s) must match the source value(s) in entries included in the join. It must not be null.
matchAll - Indicates whether all values of a multivalued source attribute must be present in the target entry for it to be considered a match.
Returns:
The created equality join rule.

createContainsJoin

public static JoinRule createContainsJoin(java.lang.String sourceAttribute,
                                          java.lang.String targetAttribute,
                                          boolean matchAll)
Creates an equality join rule in which the value(s) of the source attribute in the source entry must be equal to or a substring of the value(s) of the target attribute of a target entry for it to be included in the join.

Parameters:
sourceAttribute - The name or OID of the attribute in the source entry whose value(s) should be matched in target entries to be included in the join. It must not be null.
targetAttribute - The name or OID of the attribute whose value(s) must equal or contain the source value(s) in entries included in the join. It must not be null.
matchAll - Indicates whether all values of a multivalued source attribute must be present in the target entry for it to be considered a match.
Returns:
The created equality join rule.

createReverseDNJoin

public static JoinRule createReverseDNJoin(java.lang.String targetAttribute)
Creates a reverse DN join rule in which the target entries to include in the join must include a specified attribute that contains the DN of the source entry.

Parameters:
targetAttribute - The name or OID of the attribute in the target entries which must contain the DN of the source entry. It must not be null, and it must be associated with a distinguished nme or name and optional UID syntax.
Returns:
The created reverse DN join rule.

getType

public byte getType()
Retrieves the join rule type for this join rule.

Returns:
The join rule type for this join rule.

getComponents

public JoinRule[] getComponents()
Retrieves the set of subordinate components for this AND or OR join rule.

Returns:
The set of subordinate components for this AND or OR join rule, or an empty list if this is not an AND or OR join rule.

getSourceAttribute

public java.lang.String getSourceAttribute()
Retrieves the name of the source attribute for this DN, equality, or contains join rule.

Returns:
The name of the source attribute for this DN, equality, or contains join rule, or null if this is some other type of join rule.

getTargetAttribute

public java.lang.String getTargetAttribute()
Retrieves the name of the target attribute for this reverse DN, equality, or contains join rule.

Returns:
The name of the target attribute for this reverse DN, equality, or contains join rule, or null if this is some other type of join rule.

matchAll

public boolean matchAll()
Indicates whether all values of a multivalued source attribute must be present in a target entry for it to be considered a match. The return value will only be meaningful for equality join rules.

Returns:
true if all values of the source attribute must be included in the target attribute of an entry for it to be considered for inclusion in the join, or false if it is only necessary for at least one of the values to be included in a target entry for it to be considered for inclusion in the join.

toString

public java.lang.String toString()
Retrieves a string representation of this join rule.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this join rule.

toString

public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this join rule to the provided buffer.

Parameters:
buffer - The buffer to which the information should be appended.