Class DefaultJaacsService

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

public class DefaultJaacsService extends Object implements JaacsService
  • 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 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(ApplicationUser 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(ApplicationUser 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(ApplicationUser 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(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 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(ApplicationUser 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(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 behalf
      application - the Application to validate
      Throws:
      ValidationFailureException - if any of the field values is not valid
    • displayName

      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
    • i18n

      protected I18nHelper i18n(ApplicationUser user)
      Returns an I18nHelper for the given user.
      Parameters:
      user - a User
      Returns:
      an I18nHelper