com.atlassian.jira.crowd.embedded
Class DefaultJaacsService

java.lang.Object
  extended by com.atlassian.jira.crowd.embedded.DefaultJaacsService
All Implemented Interfaces:
JaacsService

public class DefaultJaacsService
extends Object
implements JaacsService


Nested Class Summary
protected static class DefaultJaacsService.ExcludeNonPermanent
          Excluded the permanent application, which is the built-in crowd-embedded application.
 
Constructor Summary
DefaultJaacsService(com.atlassian.crowd.manager.application.ApplicationManager applicationManager, PermissionManager permissionManager, I18nHelper.BeanFactory i18nFactory)
           
 
Method Summary
 boolean addRemoteAddress(JiraServiceContext jiraServiceContext, String remoteAddress, long applicationId)
          Adding a new remote address.
 void create(com.atlassian.crowd.embedded.api.User remoteUser, com.atlassian.crowd.model.application.Application application)
          Creates a new Application
 boolean deleteApplication(JiraServiceContext jiraServiceContext, long applicationId)
          Delete a remote address.
protected  String displayName(com.atlassian.crowd.embedded.api.User remoteUser, Long applicationId)
          Attempts to read the the Application with the given id from the database, and returns its display name.
protected  void ensureIsAdmin(com.atlassian.crowd.embedded.api.User remoteUser)
          If the remote user is not an administrator, throws a ValidationFailureException with the appropriate error.
 List<com.atlassian.crowd.model.application.Application> findAll(com.atlassian.crowd.embedded.api.User remoteUser)
          Returns a list containing all non-permanent Crowd applications.
 com.atlassian.crowd.model.application.ApplicationImpl findById(com.atlassian.crowd.embedded.api.User remoteUser, Long applicationId)
          Returns the Application having the given id.
 Set<com.atlassian.crowd.model.application.RemoteAddress> getRemoteAddresses(JiraServiceContext jiraServiceContext, long applicationId)
          Retrieve a list of configured remote addresses.
protected  I18nHelper i18n(com.atlassian.crowd.embedded.api.User user)
          Returns an I18nHelper for the given user.
 boolean resetPassword(JiraServiceContext jiraServiceContext, String password, long applicationId)
          Reset a password.
 void update(com.atlassian.crowd.embedded.api.User remoteUser, com.atlassian.crowd.model.application.Application updatedApplication)
          Updates an Application.
 boolean validateAddRemoteAddress(JiraServiceContext jiraServiceContext, String remoteAddress, long applicationId)
          Validate adding a new remote address.
protected  void validateApplication(com.atlassian.crowd.embedded.api.User user, com.atlassian.crowd.model.application.Application application)
          Validates the application's name, password, and remote addresses fields.
 boolean validateDeleteApplication(JiraServiceContext jiraServiceContext, long applicationId)
          Validate deleting a remote address.
protected  void validateJiraServiceContext(JiraServiceContext jiraServiceContext)
           
 boolean validateResetPassword(JiraServiceContext jiraServiceContext, String password, long applicationId)
          Validate resetting a password.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultJaacsService

public DefaultJaacsService(com.atlassian.crowd.manager.application.ApplicationManager applicationManager,
                           PermissionManager permissionManager,
                           I18nHelper.BeanFactory i18nFactory)
Method Detail

getRemoteAddresses

public Set<com.atlassian.crowd.model.application.RemoteAddress> getRemoteAddresses(JiraServiceContext jiraServiceContext,
                                                                                   long applicationId)
Description copied from interface: JaacsService
Retrieve a list of configured remote addresses.

Specified by:
getRemoteAddresses in interface JaacsService
Parameters:
jiraServiceContext - The service context.
applicationId - Application Id
Returns:
List of configured remote addresses.

validateAddRemoteAddress

public boolean validateAddRemoteAddress(JiraServiceContext jiraServiceContext,
                                        String remoteAddress,
                                        long applicationId)
Description copied from interface: JaacsService
Validate adding a new remote address.

Specified by:
validateAddRemoteAddress in interface JaacsService
Parameters:
jiraServiceContext - The service context.
remoteAddress - A new address to add
applicationId - Application Id
Returns:
true if validation passes

addRemoteAddress

public boolean addRemoteAddress(JiraServiceContext jiraServiceContext,
                                String remoteAddress,
                                long applicationId)
Description copied from interface: JaacsService
Adding a new remote address.

Specified by:
addRemoteAddress in interface JaacsService
Parameters:
jiraServiceContext - The service context.
remoteAddress - A new address to add
applicationId - Application Id
Returns:
true if validation passes

validateDeleteApplication

public boolean validateDeleteApplication(JiraServiceContext jiraServiceContext,
                                         long applicationId)
Description copied from interface: JaacsService
Validate deleting a remote address.

Specified by:
validateDeleteApplication in interface JaacsService
Parameters:
jiraServiceContext - The service context.
applicationId - Application Id
Returns:
true if validation passes and action succeeds

deleteApplication

public boolean deleteApplication(JiraServiceContext jiraServiceContext,
                                 long applicationId)
Description copied from interface: JaacsService
Delete a remote address.

Specified by:
deleteApplication in interface JaacsService
Parameters:
jiraServiceContext - The service context.
applicationId - Application Id
Returns:
true if validation passes

validateResetPassword

public boolean validateResetPassword(JiraServiceContext jiraServiceContext,
                                     String password,
                                     long applicationId)
Description copied from interface: JaacsService
Validate resetting a password.

Specified by:
validateResetPassword in interface JaacsService
Parameters:
jiraServiceContext - The service context.
password - A password string
applicationId - Application Id
Returns:
true if validation passes

resetPassword

public boolean resetPassword(JiraServiceContext jiraServiceContext,
                             String password,
                             long applicationId)
Description copied from interface: JaacsService
Reset a password.

Specified by:
resetPassword in interface JaacsService
Parameters:
jiraServiceContext - The service context.
password - A password string
applicationId - Application Id
Returns:
true if validation passes and action succeeds

findAll

public List<com.atlassian.crowd.model.application.Application> findAll(com.atlassian.crowd.embedded.api.User remoteUser)
Description copied from interface: JaacsService
Returns a list containing all non-permanent Crowd applications.

Specified by:
findAll in interface JaacsService
Parameters:
remoteUser - a User representing the user on whose behalf to perform the call
Returns:
a new List

findById

public com.atlassian.crowd.model.application.ApplicationImpl findById(com.atlassian.crowd.embedded.api.User remoteUser,
                                                                      Long applicationId)
Description copied from interface: JaacsService
Returns the Application having the given id.

Specified by:
findById in interface JaacsService
Parameters:
remoteUser - a User representing the user on whose behalf to perform the call
applicationId - a Long containing an application id, or null if it doesn't exist
Returns:
an Application

create

public void create(com.atlassian.crowd.embedded.api.User remoteUser,
                   com.atlassian.crowd.model.application.Application application)
Description copied from interface: JaacsService
Creates a new Application

Specified by:
create in interface JaacsService
Parameters:
remoteUser - a User representing the user on whose behalf to perform the call
application - an Application to create

update

public void update(com.atlassian.crowd.embedded.api.User remoteUser,
                   com.atlassian.crowd.model.application.Application updatedApplication)
Description copied from interface: JaacsService
Updates an Application. The application having the given id will be updated with the remaining contents.

Specified by:
update in interface JaacsService
Parameters:
remoteUser - a User representing the user on whose behalf to perform the call
updatedApplication - an Application to update

validateJiraServiceContext

protected void validateJiraServiceContext(JiraServiceContext jiraServiceContext)

ensureIsAdmin

protected void ensureIsAdmin(com.atlassian.crowd.embedded.api.User remoteUser)
                      throws ValidationFailureException
If the remote user is not an administrator, throws a ValidationFailureException with the appropriate error.

Parameters:
remoteUser - a User representing the user on whose behalf to perform the call
Throws:
ValidationFailureException - if the user is not an admin

validateApplication

protected void validateApplication(com.atlassian.crowd.embedded.api.User user,
                                   com.atlassian.crowd.model.application.Application application)
                            throws ValidationFailureException
Validates the application's name, password, and remote addresses fields.

Parameters:
user - a User on whose behalf
application - the Application to validate
Throws:
ValidationFailureException - if any of the field values is not valid

displayName

protected String displayName(com.atlassian.crowd.embedded.api.User remoteUser,
                             Long applicationId)
Attempts to read the the Application with the given id from the database, and returns its display name. If there is a problem reading the application from the database, this method returns the application's id.

Parameters:
remoteUser - the User on whose behalf this service is operating
applicationId - a Long containing an application id
Returns:
a String containing the application's display name, or its id

i18n

protected I18nHelper i18n(com.atlassian.crowd.embedded.api.User user)
Returns an I18nHelper for the given user.

Parameters:
user - a User
Returns:
an I18nHelper


Copyright © 2002-2013 Atlassian. All Rights Reserved.