Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.directory.ldap
Class LDAPReference

java.lang.Object
  extended by org.nuxeo.ecm.directory.AbstractReference
      extended by org.nuxeo.ecm.directory.ldap.LDAPReference
All Implemented Interfaces:
Reference

public class LDAPReference
extends AbstractReference

Implementation of the directory Reference interface that leverage two common ways of storing relationships in LDAP directories:

Please note that both static and dynamic references are resolved in read mode whereas only the static attribute strategy is used when creating new references or when deleting existing ones (write / update mode). Some design considerations behind the implementation of such reference can be found at: http://jira.nuxeo.org/browse/NXP-1506

Author:
Olivier Grisel

Field Summary
static java.util.List<java.lang.String> EMPTY_STRING_LIST
           
 boolean forceDnConsistencyCheck
           
 
Constructor Summary
LDAPReference()
           
 
Method Summary
 void addLinks(java.util.List<java.lang.String> sourceIds, java.lang.String targetId)
          Store new links using the LDAP staticAttributeId strategy.
 void addLinks(java.lang.String sourceId, java.util.List<java.lang.String> targetIds)
          Store new links using the LDAP staticAttributeId strategy.
 java.lang.String getDynamicAttributeId()
           
 java.util.List<LDAPDynamicReferenceDescriptor> getDynamicAttributes()
           
 java.util.List<java.lang.String> getLdapTargetIds(javax.naming.directory.Attributes attributes)
          Optimized method to spare a LDAP request when the caller is a LDAPSession object that has already fetched the LDAP Attribute instances.
 Directory getSourceDirectory()
           
 java.util.List<java.lang.String> getSourceIdsForTarget(java.lang.String targetId)
          Fetch both statically and dynamically defined references and merge the results.
 java.lang.String getStaticAttributeId()
           
 java.lang.String getStaticAttributeId(DirectoryFieldMapper sourceFM)
           
 Directory getTargetDirectory()
           
 java.util.List<java.lang.String> getTargetIdsForSource(java.lang.String sourceId)
          Fetches both statically and dynamically defined references and merges the results.
 boolean isDynamic()
           
 boolean isStatic()
           
 void removeLinksForSource(java.lang.String sourceId)
          Remove existing statically defined links for the given source id (dynamic references remain unaltered)
 void removeLinksForTarget(java.lang.String targetId)
          Remove existing statically defined links for the given target id (dynamic references remain unaltered)
 void setFieldName(java.lang.String fieldName)
           
 void setSourceIdsForTarget(java.lang.String targetId, java.util.List<java.lang.String> sourceIds)
          Edit the list of statically defined references for a given target (dynamic references remain unaltered)
 void setTargetDirectoryName(java.lang.String targetDirectoryName)
           
 void setTargetIdsForSource(java.lang.String sourceId, java.util.List<java.lang.String> targetIds)
          Set the list of statically defined references for a given source (dynamic references remain unaltered)
 java.lang.String toString()
           
 
Methods inherited from class org.nuxeo.ecm.directory.AbstractReference
getFieldName, setSourceDirectoryName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

forceDnConsistencyCheck

public boolean forceDnConsistencyCheck

EMPTY_STRING_LIST

public static final java.util.List<java.lang.String> EMPTY_STRING_LIST
Constructor Detail

LDAPReference

public LDAPReference()
Method Detail

setFieldName

public void setFieldName(java.lang.String fieldName)

isStatic

public boolean isStatic()
                 throws DirectoryException
Returns:
true if the reference should resolve statically refereed entries (identified by dn-valued attribute)
Throws:
DirectoryException

getStaticAttributeId

public java.lang.String getStaticAttributeId()
                                      throws DirectoryException
Throws:
DirectoryException

getStaticAttributeId

public java.lang.String getStaticAttributeId(DirectoryFieldMapper sourceFM)
                                      throws DirectoryException
Throws:
DirectoryException

getDynamicAttributes

public java.util.List<LDAPDynamicReferenceDescriptor> getDynamicAttributes()

getDynamicAttributeId

public java.lang.String getDynamicAttributeId()

isDynamic

public boolean isDynamic()
Returns:
true if the reference should resolve dynamically refereed entries (identified by a LDAP url-valued attribute)

setTargetDirectoryName

public void setTargetDirectoryName(java.lang.String targetDirectoryName)
Specified by:
setTargetDirectoryName in interface Reference
Overrides:
setTargetDirectoryName in class AbstractReference

getSourceDirectory

public Directory getSourceDirectory()
                             throws DirectoryException
Specified by:
getSourceDirectory in interface Reference
Overrides:
getSourceDirectory in class AbstractReference
Throws:
DirectoryException

getTargetDirectory

public Directory getTargetDirectory()
                             throws DirectoryException
Specified by:
getTargetDirectory in interface Reference
Overrides:
getTargetDirectory in class AbstractReference
Throws:
DirectoryException

addLinks

public void addLinks(java.lang.String sourceId,
                     java.util.List<java.lang.String> targetIds)
              throws DirectoryException
Store new links using the LDAP staticAttributeId strategy.

Throws:
DirectoryException
See Also:
Reference.addLinks(String, List)

addLinks

public void addLinks(java.util.List<java.lang.String> sourceIds,
                     java.lang.String targetId)
              throws DirectoryException
Store new links using the LDAP staticAttributeId strategy.

Throws:
DirectoryException
See Also:
Reference.addLinks(List, String)

getSourceIdsForTarget

public java.util.List<java.lang.String> getSourceIdsForTarget(java.lang.String targetId)
                                                       throws DirectoryException
Fetch both statically and dynamically defined references and merge the results.

Throws:
DirectoryException
See Also:
Reference.getSourceIdsForTarget(String)

getTargetIdsForSource

public java.util.List<java.lang.String> getTargetIdsForSource(java.lang.String sourceId)
                                                       throws DirectoryException
Fetches both statically and dynamically defined references and merges the results.

Throws:
DirectoryException
See Also:
Reference.getSourceIdsForTarget(String)

getLdapTargetIds

public java.util.List<java.lang.String> getLdapTargetIds(javax.naming.directory.Attributes attributes)
                                                  throws DirectoryException
Optimized method to spare a LDAP request when the caller is a LDAPSession object that has already fetched the LDAP Attribute instances.

This method should return the same results as the sister method: org.nuxeo.ecm.directory.Reference#getTargetIdsForSource(java.lang.String)

Returns:
target reference ids
Throws:
DirectoryException

removeLinksForSource

public void removeLinksForSource(java.lang.String sourceId)
                          throws DirectoryException
Remove existing statically defined links for the given source id (dynamic references remain unaltered)

Throws:
DirectoryException
See Also:
Reference.removeLinksForSource(String)

removeLinksForTarget

public void removeLinksForTarget(java.lang.String targetId)
                          throws DirectoryException
Remove existing statically defined links for the given target id (dynamic references remain unaltered)

Throws:
DirectoryException
See Also:
Reference.removeLinksForTarget(String)

setSourceIdsForTarget

public void setSourceIdsForTarget(java.lang.String targetId,
                                  java.util.List<java.lang.String> sourceIds)
                           throws DirectoryException
Edit the list of statically defined references for a given target (dynamic references remain unaltered)

Throws:
DirectoryException
See Also:
Reference.setSourceIdsForTarget(String, List)

setTargetIdsForSource

public void setTargetIdsForSource(java.lang.String sourceId,
                                  java.util.List<java.lang.String> targetIds)
                           throws DirectoryException
Set the list of statically defined references for a given source (dynamic references remain unaltered)

Throws:
DirectoryException
See Also:
Reference.setTargetIdsForSource(String, List)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.