com.atlassian.crowd.plugin.rest.service.controller
Class ApplicationController

java.lang.Object
  extended by com.atlassian.crowd.plugin.rest.service.controller.ApplicationController

public class ApplicationController
extends Object

Controller for the Application resource.

Since:
2.2

Constructor Summary
ApplicationController(ApplicationManager applicationManager, DirectoryManager directoryManager, TrustedProxyManager trustedProxyManager)
           
 
Method Summary
 com.atlassian.plugins.rest.common.Link addApplication(ApplicationEntity applicationEntity, URI baseUri)
          Adds a new application.
 com.atlassian.plugins.rest.common.Link addApplicationWithRequestAddress(ApplicationEntity applicationEntity, javax.servlet.http.HttpServletRequest request, URI baseUri)
          Adds a new application with the request address.
 void addRemoteAddress(long applicationId, RemoteAddressEntity remoteAddressEntity)
          Adds a remote address to the list of allowed addresses for the application.
 ApplicationEntityList getAllApplications(URI baseUri)
          Finds all applications.
 ApplicationEntity getApplicationById(long id, URI baseUri)
          Finds an application by ID.
 ApplicationEntity getApplicationByName(String name, URI baseUri)
          Finds an application by name.
 Set<String> getRequestAddresses(javax.servlet.http.HttpServletRequest request)
          Retrieves the list of request addresses.
 void removeApplication(long applicationId)
          Removes an application.
 void removeRemoteAddress(long applicationId, String remoteAddress)
          Removes a remote address from the list of allowed addresses for the application.
 void updateApplication(ApplicationEntity applicationEntity)
          Updates an existing application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationController

public ApplicationController(ApplicationManager applicationManager,
                             DirectoryManager directoryManager,
                             TrustedProxyManager trustedProxyManager)
Method Detail

getApplicationByName

public ApplicationEntity getApplicationByName(String name,
                                              URI baseUri)
                                       throws ApplicationNotFoundException
Finds an application by name.

Parameters:
name - name of the application
baseUri - base URI of the REST service
Returns:
ApplicationEntity
Throws:
ApplicationNotFoundException - if the application could not be found

getApplicationById

public ApplicationEntity getApplicationById(long id,
                                            URI baseUri)
                                     throws ApplicationNotFoundException
Finds an application by ID.

Parameters:
id - ID of the application
baseUri - baseURI of the applications resource
Returns:
ApplicationEntity
Throws:
ApplicationNotFoundException - if the application could not be found

getAllApplications

public ApplicationEntityList getAllApplications(URI baseUri)
                                         throws ApplicationNotFoundException
Finds all applications.

Parameters:
baseUri - base URI of the REST service
Returns:
ApplicationEntity
Throws:
ApplicationNotFoundException - if the application could not be found

addApplicationWithRequestAddress

public com.atlassian.plugins.rest.common.Link addApplicationWithRequestAddress(ApplicationEntity applicationEntity,
                                                                               javax.servlet.http.HttpServletRequest request,
                                                                               URI baseUri)
                                                                        throws InvalidCredentialException,
                                                                               DirectoryNotFoundException
Adds a new application with the request address.

Parameters:
applicationEntity - new application to add
request - HTTP request
baseUri - base URI of the REST service
Returns:
link to the new application
Throws:
InvalidCredentialException - if the given credentials are not valid
DirectoryNotFoundException - if the directory being mapped could not be found

addApplication

public com.atlassian.plugins.rest.common.Link addApplication(ApplicationEntity applicationEntity,
                                                             URI baseUri)
                                                      throws InvalidCredentialException,
                                                             DirectoryNotFoundException
Adds a new application.

Parameters:
applicationEntity - new application to add
baseUri - base URI of the REST service
Returns:
link to the new application
Throws:
InvalidCredentialException - if the given credentials are not valid
DirectoryNotFoundException - if the directory being mapped could not be found

removeApplication

public void removeApplication(long applicationId)
                       throws ApplicationManagerException
Removes an application.

Parameters:
applicationId - ID of the application
Throws:
ApplicationManagerException - if the remove operation is not permitted on the given application

updateApplication

public void updateApplication(ApplicationEntity applicationEntity)
                       throws ApplicationNotFoundException,
                              ApplicationManagerException,
                              DirectoryNotFoundException
Updates an existing application.

Parameters:
applicationEntity - application entity with the new details
Throws:
ApplicationNotFoundException - if the application could not be found
ApplicationManagerException - if there was an error updating the application
DirectoryNotFoundException - if a directory referenced by a directory mapping could not be found

addRemoteAddress

public void addRemoteAddress(long applicationId,
                             RemoteAddressEntity remoteAddressEntity)
                      throws ApplicationNotFoundException
Adds a remote address to the list of allowed addresses for the application.

Parameters:
applicationId - ID of the application
remoteAddressEntity - remote address entity to add
Throws:
ApplicationNotFoundException - if the application could not be found

removeRemoteAddress

public void removeRemoteAddress(long applicationId,
                                String remoteAddress)
                         throws ApplicationNotFoundException
Removes a remote address from the list of allowed addresses for the application.

Parameters:
applicationId - ID of the application
remoteAddress - remote address to remove
Throws:
ApplicationNotFoundException - if the application could not be found

getRequestAddresses

public Set<String> getRequestAddresses(javax.servlet.http.HttpServletRequest request)
Retrieves the list of request addresses.

Parameters:
request - HTTP request
Returns:
list of request addresses


Copyright © 2012 Atlassian. All Rights Reserved.