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 TypeMethodDescriptionboolean
addRemoteAddress
(JiraServiceContext jiraServiceContext, String remoteAddress, long applicationId) Adding a new remote address.void
create
(ApplicationUser remoteUser, com.atlassian.crowd.model.application.Application application) Creates a new Applicationboolean
deleteApplication
(JiraServiceContext jiraServiceContext, long applicationId) Delete a remote address.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.protected void
ensureIsAdmin
(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.ApplicationImpl
findById
(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 I18nHelper
i18n
(ApplicationUser user) Returns an I18nHelper for the given user.boolean
resetPassword
(JiraServiceContext jiraServiceContext, String password, long applicationId) Reset a password.void
update
(ApplicationUser 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
(ApplicationUser 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.
-
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:JaacsService
Retrieve a list of configured remote addresses.- Specified by:
getRemoteAddresses
in 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:JaacsService
Validate adding a new remote address.- Specified by:
validateAddRemoteAddress
in 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:JaacsService
Adding a new remote address.- Specified by:
addRemoteAddress
in interfaceJaacsService
- Parameters:
jiraServiceContext
- The service context.remoteAddress
- A new address to addapplicationId
- Application Id- Returns:
- true if validation passes
-
validateDeleteApplication
Description copied from interface:JaacsService
Validate deleting a remote address.- Specified by:
validateDeleteApplication
in interfaceJaacsService
- Parameters:
jiraServiceContext
- The service context.applicationId
- Application Id- Returns:
- true if validation passes and action succeeds
-
deleteApplication
Description copied from interface:JaacsService
Delete a remote address.- Specified by:
deleteApplication
in 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:JaacsService
Validate resetting a password.- Specified by:
validateResetPassword
in 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:JaacsService
Reset a password.- Specified by:
resetPassword
in 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:JaacsService
Returns a list containing all non-permanent Crowd applications.- Specified by:
findAll
in 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:JaacsService
Returns the Application having the given id.- Specified by:
findById
in 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:JaacsService
Creates a new Application- Specified by:
create
in 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:JaacsService
Updates an Application. The application having the given id will be updated with the remaining contents.- Specified by:
update
in 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
-