com.atlassian.crowd.plugin.rest.util
Class ApplicationEntityTranslator

java.lang.Object
  extended by com.atlassian.crowd.plugin.rest.util.ApplicationEntityTranslator

public class ApplicationEntityTranslator
extends java.lang.Object

Translates between application related REST entities and com.atlassian.crowd.model classes.

Since:
2.2

Nested Class Summary
static class ApplicationEntityTranslator.PasswordMode
           
 
Method Summary
static java.lang.Boolean getBoolean(java.lang.Boolean b)
          Returns the boolean if not null, otherwise returns false.
static ApplicationEntityList toApplicationEntities(java.util.Collection<Application> applications, java.net.URI baseUri)
          Translates from a collection of Applications to a list of ApplicationEntitys.
static ApplicationEntity toApplicationEntity(Application application, com.atlassian.plugins.rest.common.Link link)
          Translates from an Application to an ApplicationEntity.
static ApplicationEntity toApplicationEntity(Application application, com.atlassian.plugins.rest.common.Link link, ApplicationEntityTranslator.PasswordMode passwordMode)
          Translates from an Application to an ApplicationEntity.
static ApplicationType toApplicationType(java.lang.String type)
          Translates from an application type string to an ApplicationType.
static Application toApplicationWithNoDirectoryMappings(ApplicationEntity applicationEntity)
          Translates from an ApplicationEntity to an Application with no directory mappings.
static AttributeEntityList toAttributeEntities(java.util.Map<java.lang.String,java.lang.String> attributes)
          Translates attributes to AttributeEntityList.
static DirectoryMapping toDirectoryMapping(DirectoryMappingEntity directoryMappingEntity, Application application, Directory directory)
          Translates from a DirectoryMappingEntity to a DirectoryMapping.
static DirectoryMappingEntityList toDirectoryMappingEntities(java.util.List<DirectoryMapping> directoryMappings, java.net.URI applicationUri)
          Translates from a list of DirectoryMapping to a DirectoryMappingEntityList.
static DirectoryMappingEntity toDirectoryMappingEntity(DirectoryMapping directoryMapping, java.net.URI directoryMappingsUri)
          Translates from a DirectoryMapping to a DirectoryMappingEntity.
static java.util.List<DirectoryMapping> toDirectoryMappings(DirectoryMappingEntityList directoryMappingEntities, Application application, DirectoryManager directoryManager)
          Translates from a DirectoryMappingEntityList to a list of DirectoryMapping.
static OperationType toOperationType(java.lang.String type)
          Translates from an operation type string to an OperationType.
static java.util.Set<OperationType> toOperationTypes(java.util.Set<java.lang.String> types)
          Translates from a set of operation type strings to a set of OperationType.
static java.lang.String toOperationTypeString(OperationType type)
          Translates from an OperationType to an operation type string.
static java.util.Set<java.lang.String> toOperationTypeStrings(java.util.Set<OperationType> types)
          Translates from a set of OperationTypes to a set of operation type strings.
static PasswordCredential toPasswordCredential(PasswordEntity passwordEntity)
          Translates from a PasswordEntity to a PasswordCredential.
static RemoteAddress toRemoteAddress(RemoteAddressEntity remoteAddressEntity)
          Translates from a RemoteAddressEntity to a RemoteAddress.
static RemoteAddressEntitySet toRemoteAddressEntities(java.util.Set<RemoteAddress> remoteAddresses, java.net.URI baseUri)
          Translate from a set of RemoteAddresses to RemoteAddressEntitySet.
static RemoteAddressEntity toRemoteAddressEntity(RemoteAddress remoteAddress, java.net.URI baseUri)
          Translate from a RemoteAddress to a RemoteAddressEntity.
static java.util.Set<RemoteAddress> toRemoteAddresses(RemoteAddressEntitySet remoteAddressEntities)
          Translates from a RemoteAddressEntitySet to a set of RemoteAddress.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toApplicationWithNoDirectoryMappings

public static Application toApplicationWithNoDirectoryMappings(ApplicationEntity applicationEntity)
Translates from an ApplicationEntity to an Application with no directory mappings.

Parameters:
applicationEntity - ApplicationEntity to convert
Returns:
Application if applicationEntity is not null, otherwise null

toApplicationEntity

public static ApplicationEntity toApplicationEntity(Application application,
                                                    com.atlassian.plugins.rest.common.Link link)
Translates from an Application to an ApplicationEntity.

Parameters:
application - Application to convert
link - Link to the Application
Returns:
ApplicationEntity if application is not null, otherwise null

toApplicationEntity

public static ApplicationEntity toApplicationEntity(Application application,
                                                    com.atlassian.plugins.rest.common.Link link,
                                                    ApplicationEntityTranslator.PasswordMode passwordMode)
Translates from an Application to an ApplicationEntity.

Parameters:
application - Application to convert
link - Link to the Application
passwordMode - whether to include the password in the application entity
Returns:
ApplicationEntity if application is not null, otherwise null

toPasswordCredential

public static PasswordCredential toPasswordCredential(PasswordEntity passwordEntity)
Translates from a PasswordEntity to a PasswordCredential.

Parameters:
passwordEntity - password entity to translate
Returns:
PasswordCredential or null if the input was null

toDirectoryMappings

public static java.util.List<DirectoryMapping> toDirectoryMappings(DirectoryMappingEntityList directoryMappingEntities,
                                                                   Application application,
                                                                   DirectoryManager directoryManager)
                                                            throws DirectoryNotFoundException
Translates from a DirectoryMappingEntityList to a list of DirectoryMapping.

Parameters:
directoryMappingEntities - list of directory mapping entities
application - the application being mapped
directoryManager - the DirectoryManager
Returns:
list of directory mappings or null if the input was null
Throws:
DirectoryNotFoundException - if the directory being mapped could not be found

toDirectoryMapping

public static DirectoryMapping toDirectoryMapping(DirectoryMappingEntity directoryMappingEntity,
                                                  Application application,
                                                  Directory directory)
Translates from a DirectoryMappingEntity to a DirectoryMapping.

Parameters:
directoryMappingEntity - directory mapping entity
application - the application to map
directory - the directory to map
Returns:
directory mapping

toDirectoryMappingEntities

public static DirectoryMappingEntityList toDirectoryMappingEntities(java.util.List<DirectoryMapping> directoryMappings,
                                                                    java.net.URI applicationUri)
Translates from a list of DirectoryMapping to a DirectoryMappingEntityList.

Parameters:
directoryMappings - list of directory mappings
applicationUri - URI for the application resource
Returns:
list of directory mapping entities or null if the input was null

toDirectoryMappingEntity

public static DirectoryMappingEntity toDirectoryMappingEntity(DirectoryMapping directoryMapping,
                                                              java.net.URI directoryMappingsUri)
Translates from a DirectoryMapping to a DirectoryMappingEntity.

Parameters:
directoryMapping - directory mapping
directoryMappingsUri - URI to the application directory mappings resource
Returns:
directory mapping entity

toRemoteAddresses

public static java.util.Set<RemoteAddress> toRemoteAddresses(RemoteAddressEntitySet remoteAddressEntities)
Translates from a RemoteAddressEntitySet to a set of RemoteAddress.

Parameters:
remoteAddressEntities - set of remote address entities
Returns:
set of remote addresses, or null if the input was null

toApplicationEntities

public static ApplicationEntityList toApplicationEntities(java.util.Collection<Application> applications,
                                                          java.net.URI baseUri)
Translates from a collection of Applications to a list of ApplicationEntitys.

Parameters:
applications - collection of applications to translate
baseUri - base URI of the REST service
Returns:
list of application entities

toRemoteAddress

public static RemoteAddress toRemoteAddress(RemoteAddressEntity remoteAddressEntity)
Translates from a RemoteAddressEntity to a RemoteAddress.

Parameters:
remoteAddressEntity - remote address entity
Returns:
RemoteAddress or null if the input was null

toRemoteAddressEntities

public static RemoteAddressEntitySet toRemoteAddressEntities(java.util.Set<RemoteAddress> remoteAddresses,
                                                             java.net.URI baseUri)
Translate from a set of RemoteAddresses to RemoteAddressEntitySet.

Parameters:
remoteAddresses - Remote addresses
baseUri - base URI of the application
Returns:
RemoteAddressEntitySet

toRemoteAddressEntity

public static RemoteAddressEntity toRemoteAddressEntity(RemoteAddress remoteAddress,
                                                        java.net.URI baseUri)
Translate from a RemoteAddress to a RemoteAddressEntity.

Parameters:
remoteAddress - Remote address
baseUri - base URI of the application remote addresses
Returns:
RemoteAddressEntity

toOperationTypes

public static java.util.Set<OperationType> toOperationTypes(java.util.Set<java.lang.String> types)
Translates from a set of operation type strings to a set of OperationType.

Parameters:
types - operation types in string
Returns:
set of OperationTypes

toOperationType

public static OperationType toOperationType(java.lang.String type)
Translates from an operation type string to an OperationType.

Parameters:
type - operation type in string
Returns:
OperationType

toOperationTypeStrings

public static java.util.Set<java.lang.String> toOperationTypeStrings(java.util.Set<OperationType> types)
Translates from a set of OperationTypes to a set of operation type strings.

Parameters:
types - a set of OperationTypes
Returns:
a set of operation type strings

toOperationTypeString

public static java.lang.String toOperationTypeString(OperationType type)
Translates from an OperationType to an operation type string.

Parameters:
type - OperationType
Returns:
operation type in string

toApplicationType

public static ApplicationType toApplicationType(java.lang.String type)
Translates from an application type string to an ApplicationType.

Parameters:
type - application type in string
Returns:
ApplicationType

toAttributeEntities

public static AttributeEntityList toAttributeEntities(java.util.Map<java.lang.String,java.lang.String> attributes)
Translates attributes to AttributeEntityList.

Parameters:
attributes - Attributes of an entity
Returns:
AttributeEntityList if attributes is not null, otherwise null

getBoolean

public static java.lang.Boolean getBoolean(java.lang.Boolean b)
Returns the boolean if not null, otherwise returns false.

Parameters:
b - boolean value
Returns:
b if not null, otherwise returns false


Copyright © 2011 Atlassian. All Rights Reserved.