public class LDAPReference extends AbstractReference implements Cloneable
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
| Modifier and Type | Field and Description |
|---|---|
protected String |
dynamicAttributeId |
boolean |
forceDnConsistencyCheck |
protected String |
staticAttributeId |
protected LDAPDirectoryDescriptor |
targetDirectoryDescriptor |
fieldName, sourceDirectory, sourceDirectoryName, targetDirectory, targetDirectoryName| Constructor and Description |
|---|
LDAPReference() |
LDAPReference(ReferenceDescriptor referenceDescriptor) |
| Modifier and Type | Method and Description |
|---|---|
void |
addLinks(List<String> sourceIds,
String targetId)
Store new links using the LDAP staticAttributeId strategy.
|
void |
addLinks(List<String> sourceIds,
String targetId,
Session session)
Adds the links between the source ids and the target id
|
void |
addLinks(String sourceId,
List<String> targetIds)
Store new links using the LDAP staticAttributeId strategy.
|
void |
addLinks(String sourceId,
List<String> targetIds,
Session session)
Adds the links between the source id and the target ids
|
LDAPReference |
clone() |
String |
getDynamicAttributeId() |
List<LDAPDynamicReferenceDescriptor> |
getDynamicAttributes() |
protected String |
getIdForDn(LDAPSession session,
String dn) |
List<String> |
getLdapTargetIds(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() |
List<String> |
getSourceIdsForTarget(String targetId)
Fetch both statically and dynamically defined references and merge the results.
|
protected LDAPDirectory |
getSourceLDAPDirectory() |
String |
getStaticAttributeId() |
String |
getStaticAttributeId(DirectoryFieldMapper sourceFM) |
Directory |
getTargetDirectory() |
protected LDAPDirectoryDescriptor |
getTargetDirectoryDescriptor() |
List<String> |
getTargetIdsForSource(String sourceId)
Fetches both statically and dynamically defined references and merges the results.
|
protected LDAPDirectory |
getTargetLDAPDirectory() |
boolean |
isDynamic() |
boolean |
isStatic() |
protected static String |
pseudoNormalizeDn(String dn)
Simple helper that replaces ", " by "," in the provided dn and returns the lower case version of the result for
comparison purpose.
|
void |
removeLinksForSource(String sourceId)
Remove existing statically defined links for the given source id (dynamic references remain unaltered)
|
void |
removeLinksForSource(String sourceId,
Session session)
Removes all the links for a given source id
|
void |
removeLinksForTarget(String targetId)
Remove existing statically defined links for the given target id (dynamic references remain unaltered)
|
void |
removeLinksForTarget(String targetId,
Session session)
Removes all the links for a given target id
|
void |
setFieldName(String fieldName) |
void |
setSourceIdsForTarget(String targetId,
List<String> sourceIds)
Edit the list of statically defined references for a given target (dynamic references remain unaltered)
|
void |
setSourceIdsForTarget(String targetId,
List<String> sourceIds,
Session session)
Sets all source ids to be associated to the given target id
|
void |
setTargetDirectoryName(String targetDirectoryName) |
void |
setTargetIdsForSource(String sourceId,
List<String> targetIds)
Set the list of statically defined references for a given source (dynamic references remain unaltered)
|
void |
setTargetIdsForSource(String sourceId,
List<String> targetIds,
Session session)
Sets all target ids to be associated to the given source id
|
String |
toString() |
getFieldName, setSourceDirectoryNamepublic boolean forceDnConsistencyCheck
protected LDAPDirectoryDescriptor targetDirectoryDescriptor
protected String staticAttributeId
protected String dynamicAttributeId
public LDAPReference()
public LDAPReference(ReferenceDescriptor referenceDescriptor)
public void setFieldName(String fieldName)
public boolean isStatic() throws DirectoryException
DirectoryExceptionpublic String getStaticAttributeId() throws DirectoryException
DirectoryExceptionpublic String getStaticAttributeId(DirectoryFieldMapper sourceFM) throws DirectoryException
DirectoryExceptionpublic List<LDAPDynamicReferenceDescriptor> getDynamicAttributes()
public String getDynamicAttributeId()
public boolean isDynamic()
public void setTargetDirectoryName(String targetDirectoryName)
setTargetDirectoryName in interface ReferencesetTargetDirectoryName in class AbstractReferencepublic Directory getSourceDirectory() throws DirectoryException
getSourceDirectory in interface ReferencegetSourceDirectory in class AbstractReferenceDirectoryExceptionpublic Directory getTargetDirectory() throws DirectoryException
getTargetDirectory in interface ReferencegetTargetDirectory in class AbstractReferenceDirectoryExceptionprotected LDAPDirectory getTargetLDAPDirectory() throws DirectoryException
DirectoryExceptionprotected LDAPDirectory getSourceLDAPDirectory() throws DirectoryException
DirectoryExceptionprotected LDAPDirectoryDescriptor getTargetDirectoryDescriptor() throws DirectoryException
DirectoryExceptionpublic void addLinks(String sourceId, List<String> targetIds) throws DirectoryException
addLinks in interface ReferenceDirectoryExceptionReference.addLinks(String, List)public void addLinks(List<String> sourceIds, String targetId) throws DirectoryException
addLinks in interface ReferenceDirectoryExceptionReference.addLinks(List, String)public List<String> getSourceIdsForTarget(String targetId) throws DirectoryException
getSourceIdsForTarget in interface ReferenceDirectoryExceptionReference.getSourceIdsForTarget(String)public List<String> getTargetIdsForSource(String sourceId) throws DirectoryException
getTargetIdsForSource in interface ReferenceDirectoryExceptionReference.getSourceIdsForTarget(String)protected static String pseudoNormalizeDn(String dn) throws InvalidNameException
dn - the raw unnormalized dnInvalidNameExceptionpublic List<String> getLdapTargetIds(Attributes attributes) throws DirectoryException
This method should return the same results as the sister method: org.nuxeo .ecm.directory.Reference#getTargetIdsForSource(java.lang.String)
DirectoryExceptionprotected String getIdForDn(LDAPSession session, String dn)
public void removeLinksForSource(String sourceId) throws DirectoryException
removeLinksForSource in interface ReferenceDirectoryExceptionReference.removeLinksForSource(String)public void removeLinksForTarget(String targetId) throws DirectoryException
removeLinksForTarget in interface ReferenceDirectoryExceptionReference.removeLinksForTarget(String)public void setSourceIdsForTarget(String targetId, List<String> sourceIds) throws DirectoryException
setSourceIdsForTarget in interface ReferenceDirectoryExceptionReference.setSourceIdsForTarget(String, List)public void setSourceIdsForTarget(String targetId, List<String> sourceIds, Session session) throws DirectoryException
ReferencesetSourceIdsForTarget in interface ReferencetargetId - the target idsourceIds - the source idssession - the sessionDirectoryExceptionpublic void setTargetIdsForSource(String sourceId, List<String> targetIds) throws DirectoryException
setTargetIdsForSource in interface ReferenceDirectoryExceptionReference.setTargetIdsForSource(String, List)public void setTargetIdsForSource(String sourceId, List<String> targetIds, Session session) throws DirectoryException
ReferencesetTargetIdsForSource in interface ReferencesourceId - the source idtargetIds - the target idssession - the sessionDirectoryExceptionpublic void removeLinksForTarget(String targetId, Session session) throws DirectoryException
ReferenceremoveLinksForTarget in interface ReferencetargetId - the target idsession - the sessionDirectoryExceptionpublic void removeLinksForSource(String sourceId, Session session) throws DirectoryException
ReferenceremoveLinksForSource in interface ReferencesourceId - the source idsession - the sessionDirectoryExceptionpublic LDAPReference clone()
public void addLinks(String sourceId, List<String> targetIds, Session session) throws DirectoryException
ReferenceaddLinks in interface ReferencesourceId - the source idtargetIds - the target idssession - the sessionDirectoryExceptionpublic void addLinks(List<String> sourceIds, String targetId, Session session) throws DirectoryException
ReferenceaddLinks in interface ReferencesourceIds - the source idstargetId - the target idsession - the sessionDirectoryExceptionCopyright © 2018 Nuxeo. All rights reserved.