Interface AccountService
public interface AccountService
Requires one of WorklogPRO administrator, Jira Administrator or Jira System Administrator performance.
Allows user to configure Accounts.
-
Method Summary
Modifier and Type Method Description void
addAccountListener(AccountListener accountListener)
Adds a new account listener.AccountWorklog
addAccountToWorklog(java.lang.Long worklogId, int accountId, java.util.Date workStart)
Associates a worklog with an account.AccountImp
createAccount(AccountImp accountImp)
Creates account specified.void
deleteAccount(int accountId)
Deletes specified account.java.util.Optional<AccountImp>
getAccountById(int id)
java.util.Optional<AccountImp>
getAccountByName(java.lang.String name)
Fonds all accounts with given name.java.util.Optional<com.atlassian.jira.issue.fields.CustomField>
getAccountCustomField()
Returns reference to account custom field.java.util.Optional<AccountImp>
getAccountForWorklog(java.lang.Long worklogId)
returns account associated with worklogjava.util.Set<AccountImp>
getAccountHierarchy(boolean onlyOpenAccounts)
Returns hierarchical account structure.java.lang.Integer[]
getAccountIdsInHierarchies(java.lang.Integer[] accountIds)
java.util.Optional<AccountImp>
getAccountImp(java.lang.Integer accountId)
Returns account with given id.java.util.Set<AccountImp>
getAccounts(AccountStatus status)
Returns accounts with requested status.java.util.Set<AccountImp>
getAccountsInHierarchy(int accountId)
java.util.Map<java.lang.Long,AccountImp>
getAccountsMap(java.lang.Long[] workLogIdList)
Returns a map from worklog id to account.java.util.Set<AccountImp>
getApplicableAccountsForIssue(AccountStatus status, com.atlassian.jira.issue.Issue issue)
Returns accounts for the issue.java.util.Set<AccountImp>
getApplicableAccountsForProject(AccountStatus status, java.lang.Long projectId)
Returns accounts for the project with given status.java.util.Set<AccountImp>
getGlobalAccounts(AccountStatus status)
java.util.Optional<AccountImp>
getSelectedAccountForIssue(com.atlassian.jira.issue.Issue issue)
Returns currently selected account for issue.java.util.Set<java.lang.Long>
getWorklogsForAccountsBetweenDates(java.lang.Integer[] accountIds, java.time.ZonedDateTime startDate, java.time.ZonedDateTime endDate)
boolean
hasAccountConfigurationPermission(com.atlassian.jira.user.ApplicationUser userParam)
Checks whether given user has permission to modify accounts.AccountImp
moveAccount(int accountId, int parentAccountId)
Moves account to new parent.void
removeAccountFromWorklog(java.lang.Long worklogId)
Removes account association from worklogAccountImp
updateAccount(AccountImp accountImp)
Updates account.
-
Method Details
-
getAccountHierarchy
Returns hierarchical account structure. -
createAccount
Creates account specified.- Parameters:
accountImp
- account creation params- Returns:
- returns account with new account id.
-
updateAccount
Updates account. Account need to be exist.- Parameters:
accountImp
- account parameters- Returns:
- returns updated account.
-
deleteAccount
void deleteAccount(int accountId)Deletes specified account.- Parameters:
accountId
- id of the account to be deleted.
-
hasAccountConfigurationPermission
boolean hasAccountConfigurationPermission(com.atlassian.jira.user.ApplicationUser userParam)Checks whether given user has permission to modify accounts.- Parameters:
userParam
- user to check. Can be null and if null uses currently logged in user.- Returns:
- true if user has permission.
-
moveAccount
Moves account to new parent. Pass -1 to move to the root.- Parameters:
accountId
- id of the account to be movedparentAccountId
- new parent of account- Returns:
- updated account
-
getAccountImp
Returns account with given id.- Parameters:
accountId
- account id.- Returns:
- account with given id.
-
addAccountListener
Adds a new account listener.- Parameters:
accountListener
- account listener.
-
getAccountByName
Fonds all accounts with given name.- Parameters:
name
- name of account- Returns:
- accounts or empty list.
-
getAccountById
-
getAccounts
Returns accounts with requested status.- Parameters:
status
- status filter. if null all accounts are returned.- Returns:
- all accounts
-
getAccountCustomField
java.util.Optional<com.atlassian.jira.issue.fields.CustomField> getAccountCustomField()Returns reference to account custom field.- Returns:
- account custom field.
-
getSelectedAccountForIssue
Returns currently selected account for issue.- Parameters:
issue
- issue, can't be null- Returns:
- selected account if exist.
-
getAccountsMap
Returns a map from worklog id to account.- Parameters:
workLogIdList
- list of worklog ids.- Returns:
- worklog id to account map.
-
getGlobalAccounts
-
getApplicableAccountsForIssue
java.util.Set<AccountImp> getApplicableAccountsForIssue(AccountStatus status, com.atlassian.jira.issue.Issue issue)Returns accounts for the issue. Different than getApplicableAccountsForProject this method also returns existing account on the issue even if account is no longer applicable for the project of the issue.- Parameters:
status
- account status requested. pass null for all statuses.issue
- issue can't be null- Returns:
- applicable accounts
-
getApplicableAccountsForProject
java.util.Set<AccountImp> getApplicableAccountsForProject(AccountStatus status, java.lang.Long projectId)Returns accounts for the project with given status.- Parameters:
status
- account status requested. pass null for all statuses.projectId
- project id.- Returns:
- accounts applicable for the project with given status.
-
removeAccountFromWorklog
void removeAccountFromWorklog(java.lang.Long worklogId)Removes account association from worklog- Parameters:
worklogId
- worklog id
-
addAccountToWorklog
AccountWorklog addAccountToWorklog(java.lang.Long worklogId, int accountId, java.util.Date workStart)Associates a worklog with an account.- Parameters:
worklogId
- worklog idaccountId
- account idworkStart
- the same with Worklog.workStart- Returns:
- created association
-
getAccountForWorklog
returns account associated with worklog- Parameters:
worklogId
- id of worklog- Returns:
- account for worklog
-
getWorklogsForAccountsBetweenDates
java.util.Set<java.lang.Long> getWorklogsForAccountsBetweenDates(java.lang.Integer[] accountIds, java.time.ZonedDateTime startDate, java.time.ZonedDateTime endDate) -
getAccountIdsInHierarchies
@Nonnull java.lang.Integer[] getAccountIdsInHierarchies(java.lang.Integer[] accountIds) -
getAccountsInHierarchy
-