public class

DefaultJaacsService

extends Object
implements JaacsService
java.lang.Object
   ↳ com.atlassian.jira.crowd.embedded.DefaultJaacsService

Summary

Public Constructors
DefaultJaacsService(ApplicationManager applicationManager, PermissionManager permissionManager, I18nHelper.BeanFactory i18nFactory)
Public Methods
boolean addRemoteAddress(JiraServiceContext jiraServiceContext, String remoteAddress, long applicationId)
Adding a new remote address.
void create(ApplicationUser remoteUser, Application application)
Creates a new Application
boolean deleteApplication(JiraServiceContext jiraServiceContext, long applicationId)
Delete a remote address.
List<Application> findAll(ApplicationUser remoteUser)
Returns a list containing all non-permanent Crowd applications.
ApplicationImpl findById(ApplicationUser remoteUser, Long applicationId)
Returns the Application having the given id.
Set<RemoteAddress> getRemoteAddresses(JiraServiceContext jiraServiceContext, long applicationId)
Retrieve a list of configured remote addresses.
boolean resetPassword(JiraServiceContext jiraServiceContext, String password, long applicationId)
Reset a password.
void update(ApplicationUser remoteUser, Application updatedApplication)
Updates an Application.
boolean validateAddRemoteAddress(JiraServiceContext jiraServiceContext, String remoteAddress, long applicationId)
Validate adding a new remote address.
boolean validateDeleteApplication(JiraServiceContext jiraServiceContext, long applicationId)
Validate deleting a remote address.
boolean validateResetPassword(JiraServiceContext jiraServiceContext, String password, long applicationId)
Validate resetting a password.
Protected Methods
String displayName(ApplicationUser remoteUser, Long applicationId)
Attempts to read the the Application with the given id from the database, and returns its display name.
void ensureIsAdmin(ApplicationUser remoteUser)
If the remote user is not an administrator, throws a ValidationFailureException with the appropriate error.
I18nHelper i18n(ApplicationUser user)
Returns an I18nHelper for the given user.
void validateApplication(ApplicationUser user, Application application)
Validates the application's name, password, and remote addresses fields.
void validateJiraServiceContext(JiraServiceContext jiraServiceContext)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.crowd.embedded.JaacsService

Public Constructors

public DefaultJaacsService (ApplicationManager applicationManager, PermissionManager permissionManager, I18nHelper.BeanFactory i18nFactory)

Public Methods

public boolean addRemoteAddress (JiraServiceContext jiraServiceContext, String remoteAddress, long applicationId)

Adding a new remote address.

Parameters
jiraServiceContext The service context.
remoteAddress A new address to add
applicationId Application Id
Returns
  • true if validation passes

public void create (ApplicationUser remoteUser, Application application)

Creates a new Application

Parameters
remoteUser a User representing the user on whose behalf to perform the call
application an Application to create

public boolean deleteApplication (JiraServiceContext jiraServiceContext, long applicationId)

Delete a remote address.

Parameters
jiraServiceContext The service context.
applicationId Application Id
Returns
  • true if validation passes

public List<Application> findAll (ApplicationUser remoteUser)

Returns a list containing all non-permanent Crowd applications.

Parameters
remoteUser a User representing the user on whose behalf to perform the call
Returns
  • a new List

public ApplicationImpl findById (ApplicationUser remoteUser, Long applicationId)

Returns the Application having the given id.

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

public Set<RemoteAddress> getRemoteAddresses (JiraServiceContext jiraServiceContext, long applicationId)

Retrieve a list of configured remote addresses.

Parameters
jiraServiceContext The service context.
applicationId Application Id
Returns
  • List of configured remote addresses.

public boolean resetPassword (JiraServiceContext jiraServiceContext, String password, long applicationId)

Reset a password.

Parameters
jiraServiceContext The service context.
password A password string
applicationId Application Id
Returns
  • true if validation passes and action succeeds

public void update (ApplicationUser remoteUser, Application updatedApplication)

Updates an Application. The application having the given id will be updated with the remaining contents.

Parameters
remoteUser a User representing the user on whose behalf to perform the call
updatedApplication an Application to update

public boolean validateAddRemoteAddress (JiraServiceContext jiraServiceContext, String remoteAddress, long applicationId)

Validate adding a new remote address.

Parameters
jiraServiceContext The service context.
remoteAddress A new address to add
applicationId Application Id
Returns
  • true if validation passes

public boolean validateDeleteApplication (JiraServiceContext jiraServiceContext, long applicationId)

Validate deleting a remote address.

Parameters
jiraServiceContext The service context.
applicationId Application Id
Returns
  • true if validation passes and action succeeds

public boolean validateResetPassword (JiraServiceContext jiraServiceContext, String password, long applicationId)

Validate resetting a password.

Parameters
jiraServiceContext The service context.
password A password string
applicationId Application Id
Returns
  • true if validation passes

Protected Methods

protected String displayName (ApplicationUser 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

protected void ensureIsAdmin (ApplicationUser remoteUser)

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

protected I18nHelper i18n (ApplicationUser user)

Returns an I18nHelper for the given user.

Parameters
user a User
Returns
  • an I18nHelper

protected void validateApplication (ApplicationUser user, Application application)

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

protected void validateJiraServiceContext (JiraServiceContext jiraServiceContext)