com.atlassian.crowd.model.application
Class ApplicationImpl

java.lang.Object
  extended by com.atlassian.crowd.model.InternalEntity
      extended by com.atlassian.crowd.model.application.ApplicationImpl
All Implemented Interfaces:
Attributes, Application, TimestampedEntity, java.io.Serializable

public class ApplicationImpl
extends InternalEntity
implements Application

Implementation of Application (designed for use for Hibernate).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.atlassian.crowd.model.InternalEntity
active, createdDate, id, name, updatedDate
 
Constructor Summary
protected ApplicationImpl()
           
  ApplicationImpl(InternalEntityTemplate template)
          Used for importing via XML migration.
protected ApplicationImpl(java.lang.String name, long id, ApplicationType type, java.lang.String description, PasswordCredential credential, boolean active, java.util.Map<java.lang.String,java.lang.String> attributes, java.util.List<DirectoryMapping> directoryMappings, java.util.Set<RemoteAddress> remoteAddresses, java.util.Date createdDate, java.util.Date updatedDate)
           
 
Method Summary
 void addDirectoryMapping(Directory directory, boolean allowAllToAuthenticate, OperationType... operationTypes)
           
 void addGroupMapping(long directoryId, java.lang.String groupName)
           
 void addRemoteAddress(java.lang.String remoteAddress)
           
 boolean equals(java.lang.Object o)
           
 java.util.Map<java.lang.String,java.lang.String> getAttributes()
          Returns the attributes of the application.
 PasswordCredential getCredential()
          Returns the application password.
 java.lang.String getDescription()
          Returns the description of the application.
 DirectoryMapping getDirectoryMapping(long directoryId)
          Returns a directory mapping of the directory specified by directory id.
 java.util.List<DirectoryMapping> getDirectoryMappings()
          Returns the list of directory mappings ranked by directory priority as in perspective of the application.
 java.util.Set<java.lang.String> getKeys()
          Gets all the keys of the attributes.
 java.lang.String getLowerName()
           
 java.util.Set<RemoteAddress> getRemoteAddresses()
          Returns the whitelist of addresses allowed to connect to Crowd as the application.
 ApplicationType getType()
          Returns the type of the application.
 java.lang.String getValue(java.lang.String name)
          Returns any value associated with the given key, returns null if there is no value.
 java.util.Set<java.lang.String> getValues(java.lang.String name)
          Get all the values associated with a given key.
 int hashCode()
           
 boolean hasRemoteAddress(java.lang.String remoteAddress)
          Returns true if the remote address is already in the list of allowable remote addresses for the application.
 boolean isAliasingEnabled()
          Returns true if aliasing is enabled for the application.
 boolean isEmpty()
           
 boolean isLowerCaseOutput()
          Returns true if the usernames and group names returned should be in lowercase.
 boolean isPermanent()
          Returns whether the application is a permanent application and thus cannot be removed.
static ApplicationImpl newInstance(Application application)
           
static ApplicationImpl newInstance(java.lang.String name, ApplicationType type)
           
static ApplicationImpl newInstanceWithCredential(java.lang.String name, ApplicationType type, PasswordCredential credential)
           
static ApplicationImpl newInstanceWithIdAndCredential(java.lang.String name, ApplicationType type, PasswordCredential credential, long id)
           
static ApplicationImpl newInstanceWithPassword(java.lang.String name, ApplicationType type, java.lang.String password)
           
 void removeAttribute(java.lang.String name)
           
 boolean removeDirectoryMapping(long directoryId)
           
 boolean removeRemoteAddress(java.lang.String remoteAddress)
           
 void setActive(boolean active)
           
 void setAliasingEnabled(boolean aliasingEnabled)
           
 void setAttribute(java.lang.String name, java.lang.String value)
           
 void setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
          Sets the attributes of the application.
 void setCredential(PasswordCredential credential)
           
 void setDescription(java.lang.String description)
           
 void setLowerCaseOutput(boolean value)
           
 void setName(java.lang.String name)
           
 void setRemoteAddresses(java.util.Set<RemoteAddress> remoteAddresses)
           
 void setType(ApplicationType type)
           
 java.lang.String toString()
           
 void updateAttributesFrom(java.util.Map<java.lang.String,java.lang.String> attributes)
           
 void updateDetailsFromApplication(Application application)
          Only to be used by the ApplicationDAO#update method
 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.model.application.Application
getCreatedDate, getId, getName, getUpdatedDate, isActive
 

Constructor Detail

ApplicationImpl

protected ApplicationImpl()

ApplicationImpl

protected ApplicationImpl(java.lang.String name,
                          long id,
                          ApplicationType type,
                          java.lang.String description,
                          PasswordCredential credential,
                          boolean active,
                          java.util.Map<java.lang.String,java.lang.String> attributes,
                          java.util.List<DirectoryMapping> directoryMappings,
                          java.util.Set<RemoteAddress> remoteAddresses,
                          java.util.Date createdDate,
                          java.util.Date updatedDate)

ApplicationImpl

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

Parameters:
template - directory template.
Method Detail

newInstance

public static ApplicationImpl newInstance(Application application)

newInstance

public static ApplicationImpl newInstance(java.lang.String name,
                                          ApplicationType type)

newInstanceWithIdAndCredential

public static ApplicationImpl newInstanceWithIdAndCredential(java.lang.String name,
                                                             ApplicationType type,
                                                             PasswordCredential credential,
                                                             long id)

newInstanceWithCredential

public static ApplicationImpl newInstanceWithCredential(java.lang.String name,
                                                        ApplicationType type,
                                                        PasswordCredential credential)

newInstanceWithPassword

public static ApplicationImpl newInstanceWithPassword(java.lang.String name,
                                                      ApplicationType type,
                                                      java.lang.String password)

updateDetailsFromApplication

public void updateDetailsFromApplication(Application application)
Only to be used by the ApplicationDAO#update method

Parameters:
application -

updateAttributesFrom

public void updateAttributesFrom(java.util.Map<java.lang.String,java.lang.String> attributes)

validate

public void validate()

setName

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

setActive

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

getLowerName

public java.lang.String getLowerName()

getType

public ApplicationType getType()
Description copied from interface: Application
Returns the type of the application.

Specified by:
getType in interface Application
Returns:
application type

setType

public void setType(ApplicationType type)

getDescription

public java.lang.String getDescription()
Description copied from interface: Application
Returns the description of the application.

Specified by:
getDescription in interface Application
Returns:
description of the application

setDescription

public void setDescription(java.lang.String description)

getCredential

public PasswordCredential getCredential()
Description copied from interface: Application
Returns the application password.

Specified by:
getCredential in interface Application
Returns:
application password

setCredential

public void setCredential(PasswordCredential credential)

isPermanent

public boolean isPermanent()
Description copied from interface: Application
Returns whether the application is a permanent application and thus cannot be removed. For instance, the Crowd application is a permanent application.

Specified by:
isPermanent in interface Application
Returns:
true if the application is permanent.

getAttributes

public java.util.Map<java.lang.String,java.lang.String> getAttributes()
Description copied from interface: Application
Returns the attributes of the application.

Specified by:
getAttributes in interface Application
Returns:
attributes of the application

setAttributes

public void setAttributes(java.util.Map<java.lang.String,java.lang.String> attributes)
Sets the attributes of the application. attributes must be a mutable Map.

Parameters:
attributes - new attributes

getDirectoryMappings

public java.util.List<DirectoryMapping> getDirectoryMappings()
Description copied from interface: Application
Returns the list of directory mappings ranked by directory priority as in perspective of the application.

Specified by:
getDirectoryMappings in interface Application
Returns:
List of directory mappings (never null).

addDirectoryMapping

public void addDirectoryMapping(Directory directory,
                                boolean allowAllToAuthenticate,
                                OperationType... operationTypes)

addGroupMapping

public void addGroupMapping(long directoryId,
                            java.lang.String groupName)

getDirectoryMapping

public DirectoryMapping getDirectoryMapping(long directoryId)
Description copied from interface: Application
Returns a directory mapping of the directory specified by directory id.

Specified by:
getDirectoryMapping in interface Application
Parameters:
directoryId - ID of the directory
Returns:
directory mapping if found, null if the directory mapping could not be found

removeDirectoryMapping

public boolean removeDirectoryMapping(long directoryId)

getRemoteAddresses

public java.util.Set<RemoteAddress> getRemoteAddresses()
Description copied from interface: Application
Returns the whitelist of addresses allowed to connect to Crowd as the application. The remote addresses may contain subnet masking information in CIDR format.

Specified by:
getRemoteAddresses in interface Application
Returns:
whitelist of addresses allowed to connect to Crowd as the application.

addRemoteAddress

public void addRemoteAddress(java.lang.String remoteAddress)

setRemoteAddresses

public void setRemoteAddresses(java.util.Set<RemoteAddress> remoteAddresses)

hasRemoteAddress

public boolean hasRemoteAddress(java.lang.String remoteAddress)
Description copied from interface: Application
Returns true if the remote address is already in the list of allowable remote addresses for the application.

Specified by:
hasRemoteAddress in interface Application
Parameters:
remoteAddress - RemoteAddress whose presence is to be tested
Returns:
true if the remote address is already in the list of allowable remote addresses for the application

removeRemoteAddress

public boolean removeRemoteAddress(java.lang.String remoteAddress)

getValues

public java.util.Set<java.lang.String> getValues(java.lang.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 java.lang.String getValue(java.lang.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 java.util.Set<java.lang.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(java.lang.String name,
                         java.lang.String value)

removeAttribute

public void removeAttribute(java.lang.String name)

isLowerCaseOutput

public boolean isLowerCaseOutput()
Description copied from interface: Application
Returns true if the usernames and group names returned should be in lowercase.

Specified by:
isLowerCaseOutput in interface Application
Returns:
true if the usernames and group names returned

setLowerCaseOutput

public void setLowerCaseOutput(boolean value)

setAliasingEnabled

public void setAliasingEnabled(boolean aliasingEnabled)

isAliasingEnabled

public boolean isAliasingEnabled()
Description copied from interface: Application
Returns true if aliasing is enabled for the application.

Specified by:
isAliasingEnabled in interface Application
Returns:
true if aliasing is enabled for the application

equals

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

hashCode

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

toString

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


Copyright © 2011 Atlassian. All Rights Reserved.