Class DefaultJaacsService
java.lang.Object
com.atlassian.jira.crowd.embedded.DefaultJaacsService
- All Implemented Interfaces:
JaacsService
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultJaacsService(com.atlassian.crowd.manager.application.ApplicationManager applicationManager, PermissionManager permissionManager, I18nHelper.BeanFactory i18nFactory) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddRemoteAddress(JiraServiceContext jiraServiceContext, String remoteAddress, long applicationId) Adding a new remote address.voidcreate(ApplicationUser remoteUser, com.atlassian.crowd.model.application.Application application) Creates a new ApplicationbooleandeleteApplication(JiraServiceContext jiraServiceContext, long applicationId) Delete a remote address.protected StringdisplayName(ApplicationUser remoteUser, Long applicationId) Attempts to read the the Application with the given id from the database, and returns its display name.protected voidensureIsAdmin(ApplicationUser remoteUser) If the remote user is not an administrator, throws a ValidationFailureException with the appropriate error.List<com.atlassian.crowd.model.application.Application>findAll(ApplicationUser remoteUser) Returns a list containing all non-permanent Crowd applications.com.atlassian.crowd.model.application.ApplicationImplfindById(ApplicationUser 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 I18nHelperi18n(ApplicationUser user) Returns an I18nHelper for the given user.booleanresetPassword(JiraServiceContext jiraServiceContext, String password, long applicationId) Reset a password.voidupdate(ApplicationUser remoteUser, com.atlassian.crowd.model.application.Application updatedApplication) Updates an Application.booleanvalidateAddRemoteAddress(JiraServiceContext jiraServiceContext, String remoteAddress, long applicationId) Validate adding a new remote address.protected voidvalidateApplication(ApplicationUser user, com.atlassian.crowd.model.application.Application application) Validates the application's name, password, and remote addresses fields.booleanvalidateDeleteApplication(JiraServiceContext jiraServiceContext, long applicationId) Validate deleting a remote address.protected voidvalidateJiraServiceContext(JiraServiceContext jiraServiceContext) booleanvalidateResetPassword(JiraServiceContext jiraServiceContext, String password, long applicationId) Validate resetting a password.
-
Constructor Details
-
DefaultJaacsService
public DefaultJaacsService(com.atlassian.crowd.manager.application.ApplicationManager applicationManager, PermissionManager permissionManager, I18nHelper.BeanFactory i18nFactory)
-
-
Method Details
-
getRemoteAddresses
public Set<com.atlassian.crowd.model.application.RemoteAddress> getRemoteAddresses(JiraServiceContext jiraServiceContext, long applicationId) Description copied from interface:JaacsServiceRetrieve a list of configured remote addresses.- Specified by:
getRemoteAddressesin interfaceJaacsService- 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:JaacsServiceValidate adding a new remote address.- Specified by:
validateAddRemoteAddressin interfaceJaacsService- Parameters:
jiraServiceContext- The service context.remoteAddress- A new address to addapplicationId- Application Id- Returns:
- true if validation passes
-
addRemoteAddress
public boolean addRemoteAddress(JiraServiceContext jiraServiceContext, String remoteAddress, long applicationId) Description copied from interface:JaacsServiceAdding a new remote address.- Specified by:
addRemoteAddressin interfaceJaacsService- Parameters:
jiraServiceContext- The service context.remoteAddress- A new address to addapplicationId- Application Id- Returns:
- true if validation passes
-
validateDeleteApplication
Description copied from interface:JaacsServiceValidate deleting a remote address.- Specified by:
validateDeleteApplicationin interfaceJaacsService- Parameters:
jiraServiceContext- The service context.applicationId- Application Id- Returns:
- true if validation passes and action succeeds
-
deleteApplication
Description copied from interface:JaacsServiceDelete a remote address.- Specified by:
deleteApplicationin interfaceJaacsService- 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:JaacsServiceValidate resetting a password.- Specified by:
validateResetPasswordin interfaceJaacsService- Parameters:
jiraServiceContext- The service context.password- A password stringapplicationId- Application Id- Returns:
- true if validation passes
-
resetPassword
public boolean resetPassword(JiraServiceContext jiraServiceContext, String password, long applicationId) Description copied from interface:JaacsServiceReset a password.- Specified by:
resetPasswordin interfaceJaacsService- Parameters:
jiraServiceContext- The service context.password- A password stringapplicationId- Application Id- Returns:
- true if validation passes and action succeeds
-
findAll
Description copied from interface:JaacsServiceReturns a list containing all non-permanent Crowd applications.- Specified by:
findAllin interfaceJaacsService- 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(ApplicationUser remoteUser, Long applicationId) Description copied from interface:JaacsServiceReturns the Application having the given id.- Specified by:
findByIdin interfaceJaacsService- Parameters:
remoteUser- a User representing the user on whose behalf to perform the callapplicationId- a Long containing an application id, or null if it doesn't exist- Returns:
- an Application
-
create
public void create(ApplicationUser remoteUser, com.atlassian.crowd.model.application.Application application) Description copied from interface:JaacsServiceCreates a new Application- Specified by:
createin interfaceJaacsService- Parameters:
remoteUser- a User representing the user on whose behalf to perform the callapplication- an Application to create
-
update
public void update(ApplicationUser remoteUser, com.atlassian.crowd.model.application.Application updatedApplication) Description copied from interface:JaacsServiceUpdates an Application. The application having the given id will be updated with the remaining contents.- Specified by:
updatein interfaceJaacsService- Parameters:
remoteUser- a User representing the user on whose behalf to perform the callupdatedApplication- an Application to update
-
validateJiraServiceContext
-
ensureIsAdmin
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(ApplicationUser 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 behalfapplication- the Application to validate- Throws:
ValidationFailureException- if any of the field values is not valid
-
displayName
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 operatingapplicationId- a Long containing an application id- Returns:
- a String containing the application's display name, or its id
-
i18n
Returns an I18nHelper for the given user.- Parameters:
user- a User- Returns:
- an I18nHelper
-