com.atlassian.jira.bc.license
Class MockLicenseRoleService

java.lang.Object
  extended by com.atlassian.jira.bc.license.MockLicenseRoleService
All Implemented Interfaces:
LicenseRoleAdminService, LicenseRoleService

public class MockLicenseRoleService
extends Object
implements LicenseRoleService


Field Summary
static String NOT_FOUND
           
 
Fields inherited from interface com.atlassian.jira.bc.license.LicenseRoleAdminService
ERROR_GROUPS, ERROR_PRIMARY
 
Constructor Summary
MockLicenseRoleService()
           
 
Method Summary
 MockLicenseRole addLicenseRole(String id)
           
 ServiceOutcome<LicenseRole> getRole(LicenseRoleId licenseRoleId)
          Return the LicenseRole identified by the passed LicenseRoleId.
 ServiceOutcome<Set<LicenseRole>> getRoles()
          Return the collection of all the roles defined in the system or an error.
 ServiceOutcome<LicenseRole> setGroups(LicenseRoleId licenseRoleId, Iterable<String> groups)
          Set the groups associated with the passed LicenseRoleId.
 ServiceOutcome<LicenseRole> setRole(LicenseRole role)
          Save the passed LicenseRole information to the database.
 boolean userHasRole(ApplicationUser user, LicenseRoleId licenseRoleId)
          Returns true if the given user has the given license role regardless of whether a license for that role is present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_FOUND

public static final String NOT_FOUND
See Also:
Constant Field Values
Constructor Detail

MockLicenseRoleService

public MockLicenseRoleService()
Method Detail

userHasRole

public boolean userHasRole(@Nullable
                           ApplicationUser user,
                           @Nonnull
                           LicenseRoleId licenseRoleId)
Description copied from interface: LicenseRoleService
Returns true if the given user has the given license role regardless of whether a license for that role is present.

Specified by:
userHasRole in interface LicenseRoleService
Parameters:
user - the user to check - if this is null, this method returns false
licenseRoleId - the license role to check - if this is null, you'll get an exception :)

getRoles

@Nonnull
public ServiceOutcome<Set<LicenseRole>> getRoles()
Description copied from interface: LicenseRoleAdminService
Return the collection of all the roles defined in the system or an error.

Specified by:
getRoles in interface LicenseRoleAdminService
Returns:
the collection of all the roles defined in the system or an error.

getRole

@Nonnull
public ServiceOutcome<LicenseRole> getRole(@Nonnull
                                                   LicenseRoleId licenseRoleId)
Description copied from interface: LicenseRoleAdminService
Return the LicenseRole identified by the passed LicenseRoleId.

Specified by:
getRole in interface LicenseRoleAdminService
Parameters:
licenseRoleId - the id of the role to find.
Returns:
the LicenseRole with the passed LicenseRoleId or an error if such a LicenseRole is not currently installed in JIRA.

setRole

@Nonnull
public ServiceOutcome<LicenseRole> setRole(@Nonnull
                                                   LicenseRole role)
Description copied from interface: LicenseRoleAdminService
Save the passed LicenseRole information to the database. This method will only accept the passed role if:
  1. The role is authorised.
  2. The role only contains currently valid groups.
  3. The primary group is contained within the role.

Specified by:
setRole in interface LicenseRoleAdminService
Parameters:
role - the role to save.
Returns:
the role as persisted to the database or an error.

setGroups

@Nonnull
public ServiceOutcome<LicenseRole> setGroups(@Nonnull
                                                     LicenseRoleId licenseRoleId,
                                                     @Nonnull
                                                     Iterable<String> groups)
Description copied from interface: LicenseRoleAdminService
Set the groups associated with the passed LicenseRoleId. The primary group for the role will be unset.

Specified by:
setGroups in interface LicenseRoleAdminService
Parameters:
licenseRoleId - the id of the license role to update.
groups - the groups to associated with the passed license role.
Returns:
the updated LicenseRole or an error.

addLicenseRole

public MockLicenseRole addLicenseRole(String id)


Copyright © 2002-2014 Atlassian. All Rights Reserved.