com.atlassian.crowd.model.directory
Class DirectoryImpl

java.lang.Object
  extended by com.atlassian.crowd.model.InternalEntity
      extended by com.atlassian.crowd.model.directory.DirectoryImpl
All Implemented Interfaces:
Attributes, Directory, TimestampedEntity, Serializable

public class DirectoryImpl
extends InternalEntity
implements Directory

Implementation of Directory (designed for use with Hibernate).

See Also:
Serialized Form

Field Summary
static String ATTRIBUTE_KEY_AUTO_ADD_GROUPS
           
static String ATTRIBUTE_KEY_LOCAL_USER_STATUS
          Key to decide whether we support local user status for a given LDAP directory.
static String ATTRIBUTE_KEY_USE_NESTED_GROUPS
           
static String ATTRIBUTE_KEY_USE_PRIMARY_GROUP
           
static String ATTRIBUTE_KEY_USER_ENCRYPTION_METHOD
           
static char AUTO_ADD_GROUPS_SEPARATOR
           
static Set<String> PASSWORD_ATTRIBUTES
           
static String SANITISED_PASSWORD
           
 
Fields inherited from class com.atlassian.crowd.model.InternalEntity
active, createdDate, id, name, updatedDate
 
Constructor Summary
DirectoryImpl()
           
DirectoryImpl(Directory directory)
           
DirectoryImpl(InternalEntityTemplate template)
          Used for importing via XML migration.
DirectoryImpl(String name, DirectoryType type, String implementationClass)
           
 
Method Summary
 void addAllowedOperation(OperationType operationType)
           
 boolean equals(Object o)
           
 Set<OperationType> getAllowedOperations()
          Returns the operations allowed to be performed on this directory.
 Map<String,String> getAttributes()
          Returns the attributes of the directory.
 String getDescription()
          Returns a description of the directory.
 String getEncryptionType()
          Returns the encryption algorithm used by the directory.
 RemoteDirectory getImplementation()
          Deprecated. Use a DirectoryInstanceLoader.
 String getImplementationClass()
          Returns the fully qualified name of the class that implements the directory.
 Set<String> getKeys()
          Gets all the keys of the attributes.
 String getLowerImplementationClass()
           
 String getLowerName()
           
 RemoteDirectory getRawImplementation()
          Deprecated. Use a DirectoryInstanceLoader.
 DirectoryType getType()
          Returns the type of the directory.
 String getValue(String name)
          Returns any value associated with the given key, returns null if there is no value.
 Set<String> getValues(String name)
          Get all the values associated with a given key.
 int hashCode()
           
 boolean isEmpty()
           
 void removeAttribute(String name)
           
 void setActive(boolean active)
           
 void setAllowedOperations(Set<OperationType> allowedOperations)
           
 void setAttribute(String name, String value)
           
 void setAttributes(Map<String,String> attributes)
          Sets the attributes of the directory.
 void setDescription(String description)
           
 void setImplementationClass(String implementationClass)
           
 void setName(String name)
           
 void setType(DirectoryType type)
           
 String toString()
           
 void updateAttributesFrom(Map<String,String> attributes)
           
 void updateDetailsFrom(Directory directory)
           
 void validate()
           
 
Methods inherited from class com.atlassian.crowd.model.InternalEntity
getCreatedDate, getId, getName, getUpdatedDate, isActive, setCreatedDate, setCreatedDateToNow, setUpdatedDate, setUpdatedDateToNow
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.crowd.embedded.api.Directory
getCreatedDate, getId, getName, getUpdatedDate, isActive
 

Field Detail

ATTRIBUTE_KEY_USER_ENCRYPTION_METHOD

public static final String ATTRIBUTE_KEY_USER_ENCRYPTION_METHOD
See Also:
Constant Field Values

ATTRIBUTE_KEY_USE_NESTED_GROUPS

public static final String ATTRIBUTE_KEY_USE_NESTED_GROUPS
See Also:
Constant Field Values

ATTRIBUTE_KEY_LOCAL_USER_STATUS

public static final String ATTRIBUTE_KEY_LOCAL_USER_STATUS
Key to decide whether we support local user status for a given LDAP directory. If the value is true, users can be enabled and disabled independently in Crowd and the LDAP server. If the value is false, user status is synchronised between Crowd and the LDAP server (for LDAP directories that support synchronisation of user status, like Active Directory). This option is only relevant for cached directories.

See Also:
Constant Field Values

ATTRIBUTE_KEY_AUTO_ADD_GROUPS

public static final String ATTRIBUTE_KEY_AUTO_ADD_GROUPS
See Also:
Constant Field Values

ATTRIBUTE_KEY_USE_PRIMARY_GROUP

public static final String ATTRIBUTE_KEY_USE_PRIMARY_GROUP
See Also:
Constant Field Values

AUTO_ADD_GROUPS_SEPARATOR

public static final char AUTO_ADD_GROUPS_SEPARATOR
See Also:
Constant Field Values

PASSWORD_ATTRIBUTES

public static final Set<String> PASSWORD_ATTRIBUTES

SANITISED_PASSWORD

public static final String SANITISED_PASSWORD
See Also:
Constant Field Values
Constructor Detail

DirectoryImpl

public DirectoryImpl()

DirectoryImpl

public DirectoryImpl(InternalEntityTemplate template)
Used for importing via XML migration.

Parameters:
template - directory template.

DirectoryImpl

public DirectoryImpl(String name,
                     DirectoryType type,
                     String implementationClass)

DirectoryImpl

public DirectoryImpl(Directory directory)
Method Detail

updateDetailsFrom

public void updateDetailsFrom(Directory directory)

updateAttributesFrom

public void updateAttributesFrom(Map<String,String> attributes)

getImplementation

public RemoteDirectory getImplementation()
                                  throws DirectoryInstantiationException
Deprecated. Use a DirectoryInstanceLoader.

Loads the implementationClass for this directory.

Returns:
The loaded interface for the RemoteDirectory.
Throws:
DirectoryInstantiationException - If the loading of the RemoteDirectory fails.

getRawImplementation

public RemoteDirectory getRawImplementation()
                                     throws DirectoryInstantiationException
Deprecated. Use a DirectoryInstanceLoader.

Throws:
DirectoryInstantiationException

getEncryptionType

public String getEncryptionType()
Description copied from interface: Directory
Returns the encryption algorithm used by the directory.

Specified by:
getEncryptionType in interface Directory
Returns:
encryption algorithm used by the directory

getAttributes

public Map<String,String> getAttributes()
Description copied from interface: Directory
Returns the attributes of the directory.

Specified by:
getAttributes in interface Directory
Returns:
attributes of the directory

setAttributes

public void setAttributes(Map<String,String> attributes)
Sets the attributes of the directory. attributes must be a mutable Map.

Parameters:
attributes - new attributes

getAllowedOperations

public Set<OperationType> getAllowedOperations()
Description copied from interface: Directory
Returns the operations allowed to be performed on this directory.

Specified by:
getAllowedOperations in interface Directory
Returns:
the operations allowed to be performed on this directory

addAllowedOperation

public void addAllowedOperation(OperationType operationType)

setAllowedOperations

public void setAllowedOperations(Set<OperationType> allowedOperations)

getLowerImplementationClass

public String getLowerImplementationClass()

getLowerName

public String getLowerName()

getDescription

public String getDescription()
Description copied from interface: Directory
Returns a description of the directory.

Specified by:
getDescription in interface Directory
Returns:
description of the directory

getType

public DirectoryType getType()
Description copied from interface: Directory
Returns the type of the directory.

Specified by:
getType in interface Directory
Returns:
type of the directory
See Also:
DirectoryType

getImplementationClass

public String getImplementationClass()
Description copied from interface: Directory
Returns the fully qualified name of the class that implements the directory.

Specified by:
getImplementationClass in interface Directory
Returns:
the fully qualified name of the class that implements the directory

setDescription

public void setDescription(String description)

setType

public void setType(DirectoryType type)

setImplementationClass

public void setImplementationClass(String implementationClass)

setName

public void setName(String name)
Overrides:
setName in class InternalEntity

setActive

public void setActive(boolean active)
Overrides:
setActive in class InternalEntity

getValues

public Set<String> getValues(String name)
Description copied from interface: Attributes
Get all the values associated with a given key. Duplicate values are not allowed, and this should be enforced case-insensitively to match the behaviour of LDAP servers. Will return null if the key does not exist.

Specified by:
getValues in interface Attributes
Parameters:
name - attribute name.
Returns:
a collection of the only attribtue value or null if the directory does not have the attribute.

getValue

public String getValue(String name)
Description copied from interface: Attributes
Returns any value associated with the given key, returns null if there is no value.

Specified by:
getValue in interface Attributes
Parameters:
name - the key to retrieve the value for
Returns:
any value associated with the given key, or null if there is no value

getKeys

public Set<String> getKeys()
Description copied from interface: Attributes
Gets all the keys of the attributes. Warning: case-insensitive keys are currently no enforced, however this is the case for LDAP, so this may be implemented in the future.

Specified by:
getKeys in interface Attributes
Returns:
a set of all the keys.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Attributes
Returns:
true if there are no attributes

setAttribute

public void setAttribute(String name,
                         String value)

removeAttribute

public void removeAttribute(String name)

validate

public void validate()

equals

public boolean equals(Object o)
Specified by:
equals in class InternalEntity

hashCode

public int hashCode()
Specified by:
hashCode in class InternalEntity

toString

public final String toString()
Overrides:
toString in class Object


Copyright © 2014 Atlassian. All Rights Reserved.