Package com.codebarrel.jira.issues
Class NativeIssueClient
java.lang.Object
com.codebarrel.jira.issues.NativeIssueClient
- All Implemented Interfaces:
IssueClient
-
Constructor Summary
ConstructorsConstructorDescriptionNativeIssueClient(JiraAuthenticationContext authenticationContext, CommentService commentService, IssueService issueService, SearchServiceCompatibilityFactory searchServiceCompatibilityFactory, FieldManager fieldManager, SearchHandlerManager searchHandlerManager, WatcherService watcherService, UserManager userManager, IssueWorkflowManager issueWorkflowManager, BeanBuilderFactory beanBuilderFactory, SubTaskManager subTaskManager, ProjectRoleManager projectRoleManager, EventTypeManager eventTypeManager, AttachmentService attachmentService, ChangeHistoryManager changeHistoryManager, com.atlassian.event.api.EventPublisher eventPublisher, IssueLinkTypeManager issueLinkTypeManager, IssueLinkService issueLinkService, IssueInputParametersBuilderFactory issueInputParametersBuilderFactory, CreateIssueProjectMetaSupplier createIssueProjectMetaSupplier, EditIssueMetaSupplier editIssueMetaSupplier, TransitionMetaSupplier transitionMetaSupplier, UserService userService, IssueBeanTransformer issueBeanTransformer, ChangeLogBeanTransformer changeLogBeanTransformer, I18nHelper.BeanFactory i18nFactory, ApplicationUser currentUser, UserBeanTransformer userBeanTransformer, VoteService voteService, AttachmentManager attachmentManager, WorklogService worklogService, IssueEventManager issueEventManager, IssueEventBundleFactory issueEventBundleFactory, FieldLayoutManager fieldLayoutManager, RendererManager rendererManager, IssueLinkManager issueLinkManager, ArchivedIssueService archivedIssueService) NativeIssueClient(JiraAuthenticationContext authenticationContext, CommentService commentService, IssueService issueService, SearchServiceCompatibilityFactory searchServiceCompatibilityFactory, FieldManager fieldManager, SearchHandlerManager searchHandlerManager, WatcherService watcherService, UserManager userManager, IssueWorkflowManager issueWorkflowManager, BeanBuilderFactory beanBuilderFactory, SubTaskManager subTaskManager, ProjectRoleManager projectRoleManager, EventTypeManager eventTypeManager, AttachmentService attachmentService, ChangeHistoryManager changeHistoryManager, com.atlassian.event.api.EventPublisher eventPublisher, IssueLinkTypeManager issueLinkTypeManager, IssueLinkService issueLinkService, IssueInputParametersBuilderFactory issueInputParametersBuilderFactory, CreateIssueProjectMetaSupplier createIssueProjectMetaSupplier, EditIssueMetaSupplier editIssueMetaSupplier, TransitionMetaSupplier transitionMetaSupplier, UserService userService, IssueBeanTransformer issueBeanTransformer, ChangeLogBeanTransformer changeLogBeanTransformer, I18nHelper.BeanFactory i18nFactory, ApplicationUser currentUser, UserBeanTransformer userBeanTransformer, VoteService voteService, AttachmentManager attachmentManager, WorklogService worklogService, IssueEventManager issueEventManager, IssueEventBundleFactory issueEventBundleFactory, FieldLayoutManager fieldLayoutManager, RendererManager rendererManager, IssueLinkManager issueLinkManager, ArchivedIssueService archivedIssueService, org.slf4j.Logger log) -
Method Summary
Modifier and TypeMethodDescriptionio.atlassian.fugue.Either<ErrorCollection, CommentBean> addComment(String issueKey, CommentRequest commentRequest, IssueRequestOptions options) Adds a comment to the issue with the given issue key.addWorklog(@NotNull String issueKey, @NotNull AddWorklogRequest request, @NotNull AdjustEstimate adjustEstimate, String remainingEstimateValue) Logs work against an issuearchiveIssue(String issueKey, IssueRequestOptions options) Archives an issueassignIssue(String issueKey, String username, IssueRequestOptions options) Assigns the provided issue to the user provided in the userId.copyAttachments(String fromIssueKey, String toIssueKey, List<AttachmentBean> attachments, boolean sendNotification) io.atlassian.fugue.Either<ErrorCollection, CreateIssueResponse> createIssue(IssueRequest request, IssueRequestOptions options) Create an issueio.atlassian.fugue.Either<ErrorCollection, CreateIssuesResponse> createIssues(List<IssueRequest> requests, IssueRequestOptions options) Bulk creates the issues specifieddeleteAttachment(Long id, IssueRequestOptions options) Deletes an attachmentdeleteComment(String issueKey, long id, IssueRequestOptions options) Deletes a commentdeleteIssue(String issueKey, IssueRequestOptions options) Deletes an issuedeleteIssueLink(Long issueLinkId) Deletes and issue link by it's ID.editIssue(String issueKey, IssueRequest request, IssueRequestOptions options) Edits an issuegetAttachments(String issueKey) Returns list of attachments in the issue.getComments(String issueKey) getCreateIssueMetaData(String projectKeyOrId, String issueTypeNameOrId, Set<String> fieldsToInclude) Retreive given a project and issue type and all the field configgetCreateIssueMetaData(List<String> projectKeysOrIds, List<String> issueTypeNamesOrIds, Set<String> fieldsToInclude) Retrieve given projects and issue types.getCreateIssueMetaData(Set<String> fieldsToInclude) Retrieve all the project ans issue types for creation.getEditIssueMetaData(String issueKey, IssueRequestOptions options, Set<String> fieldsToInclude) Retrieve edit meta data for a given issuegetFieldOptions(String fieldId, String userKey) Gets the list of options for a custom field.Gets the issue fields for the system.Get an issueReturns a list of available issue events (both system and custom);getIssueHistory(String key) getIssueLinks(String issueKey) Get issue links for an issueReturns all globally configured issue link types.getParentIssue(IssueBean subTask) This shouldn't really be called or necessary, but due to issues with server and it not always having the issue parent link populated, we need cloud vs server dependant implementations.getRenderedCommentBody(String issueKey, Long commentId) Get the rendered body of a commentgetRenderedFields(String issueKeyOrId, List<String> fieldIds) Get a rendered fields for issuegetRenderedWorklogBody(String issueKey, Long worklogId) Get the rendered body of a workloggetTransitions(String issueKey, boolean includeFields, IssueRequestOptions options) Retrieves all valid transitions available on the provided issue.getTransitions(String issueKey, IssueRequestOptions options) Retrieves all valid transitions available on the provided issue.getWatchers(String issueKey) getWorklogs(String issueKey) linkIssueTo(LinkIssueRequest request) Links an issue to another issue.voidpublishEvent(Long eventId, Long issueId, boolean publishBundle) Publishes the provided issue event with the issue payload.io.atlassian.fugue.Either<SearchErrors, SearchResult> search(String jql, SearchParams params) Executes the JQL search provided with the search parameters passed in.transitionIssue(String issueKey, TransitionRequest request, IssueRequestOptions options) Transitions the provided issue using the given transition id.unwatchIssue(String issueKey, String watcherKey) Remove a user as a watcher to the specified issue.validateSearch(String jql, SearchParams params) Validates that the passed in query and parameters are valid.watchIssue(String issueKey, String watcherKey) Add a user as a watcher to the specified issue.
-
Constructor Details
-
NativeIssueClient
public NativeIssueClient(JiraAuthenticationContext authenticationContext, CommentService commentService, IssueService issueService, SearchServiceCompatibilityFactory searchServiceCompatibilityFactory, FieldManager fieldManager, SearchHandlerManager searchHandlerManager, WatcherService watcherService, UserManager userManager, IssueWorkflowManager issueWorkflowManager, BeanBuilderFactory beanBuilderFactory, SubTaskManager subTaskManager, ProjectRoleManager projectRoleManager, EventTypeManager eventTypeManager, AttachmentService attachmentService, ChangeHistoryManager changeHistoryManager, com.atlassian.event.api.EventPublisher eventPublisher, IssueLinkTypeManager issueLinkTypeManager, IssueLinkService issueLinkService, IssueInputParametersBuilderFactory issueInputParametersBuilderFactory, CreateIssueProjectMetaSupplier createIssueProjectMetaSupplier, EditIssueMetaSupplier editIssueMetaSupplier, TransitionMetaSupplier transitionMetaSupplier, UserService userService, IssueBeanTransformer issueBeanTransformer, ChangeLogBeanTransformer changeLogBeanTransformer, I18nHelper.BeanFactory i18nFactory, ApplicationUser currentUser, UserBeanTransformer userBeanTransformer, VoteService voteService, AttachmentManager attachmentManager, WorklogService worklogService, IssueEventManager issueEventManager, IssueEventBundleFactory issueEventBundleFactory, FieldLayoutManager fieldLayoutManager, RendererManager rendererManager, IssueLinkManager issueLinkManager, ArchivedIssueService archivedIssueService) -
NativeIssueClient
public NativeIssueClient(JiraAuthenticationContext authenticationContext, CommentService commentService, IssueService issueService, SearchServiceCompatibilityFactory searchServiceCompatibilityFactory, FieldManager fieldManager, SearchHandlerManager searchHandlerManager, WatcherService watcherService, UserManager userManager, IssueWorkflowManager issueWorkflowManager, BeanBuilderFactory beanBuilderFactory, SubTaskManager subTaskManager, ProjectRoleManager projectRoleManager, EventTypeManager eventTypeManager, AttachmentService attachmentService, ChangeHistoryManager changeHistoryManager, com.atlassian.event.api.EventPublisher eventPublisher, IssueLinkTypeManager issueLinkTypeManager, IssueLinkService issueLinkService, IssueInputParametersBuilderFactory issueInputParametersBuilderFactory, CreateIssueProjectMetaSupplier createIssueProjectMetaSupplier, EditIssueMetaSupplier editIssueMetaSupplier, TransitionMetaSupplier transitionMetaSupplier, UserService userService, IssueBeanTransformer issueBeanTransformer, ChangeLogBeanTransformer changeLogBeanTransformer, I18nHelper.BeanFactory i18nFactory, ApplicationUser currentUser, UserBeanTransformer userBeanTransformer, VoteService voteService, AttachmentManager attachmentManager, WorklogService worklogService, IssueEventManager issueEventManager, IssueEventBundleFactory issueEventBundleFactory, FieldLayoutManager fieldLayoutManager, RendererManager rendererManager, IssueLinkManager issueLinkManager, ArchivedIssueService archivedIssueService, org.slf4j.Logger log)
-
-
Method Details
-
getCreateIssueMetaData
Description copied from interface:IssueClientRetrieve all the project ans issue types for creation. Does not contain field information.- Specified by:
getCreateIssueMetaDatain interfaceIssueClient- Returns:
- Projects and issue types
-
getCreateIssueMetaData
public Optional<CreateIssueMetaData> getCreateIssueMetaData(List<String> projectKeysOrIds, List<String> issueTypeNamesOrIds, Set<String> fieldsToInclude) Description copied from interface:IssueClientRetrieve given projects and issue types. Optionally return field data.- Specified by:
getCreateIssueMetaDatain interfaceIssueClient- Parameters:
projectKeysOrIds- projects to retrieve meta for. If strings contains only numeric values, it is interpreted as Ids, otherwise keys.issueTypeNamesOrIds- issue types to retrieve meta for. If strings contains only numeric values, it is interpreted as Ids, otherwise keys.fieldsToInclude- the set of fields we're trying to include in the create request.- Returns:
- Meta data for crete issue
-
getCreateIssueMetaData
public Optional<CreateIssueMetaData> getCreateIssueMetaData(String projectKeyOrId, String issueTypeNameOrId, Set<String> fieldsToInclude) Description copied from interface:IssueClientRetreive given a project and issue type and all the field config- Specified by:
getCreateIssueMetaDatain interfaceIssueClient- Parameters:
projectKeyOrId- project to retrieve meta for. If string contains only numeric values, it is interpreted as Id, otherwise key.issueTypeNameOrId- issue type to retrieve meta for. If string contains only numeric values, it is interpreted as Id, otherwise key.fieldsToInclude- the set of fields we're trying to include in the create request.- Returns:
- Meta data for crete issue
-
getEditIssueMetaData
public Optional<EditIssueMetaData> getEditIssueMetaData(String issueKey, IssueRequestOptions options, Set<String> fieldsToInclude) Description copied from interface:IssueClientRetrieve edit meta data for a given issue- Specified by:
getEditIssueMetaDatain interfaceIssueClient- Parameters:
issueKey- issue key of the issue to get meta data foroptions- options for the request. e.g. overrideScreenSecurityfieldsToInclude- the set of fields we're trying to edit in the request.- Returns:
- Meta data for edit issue
-
getIssue
Description copied from interface:IssueClientGet an issue- Specified by:
getIssuein interfaceIssueClient- Parameters:
issueKeyOrId- issue key or id- Returns:
- a reference to the issue
-
getRenderedFields
Description copied from interface:IssueClientGet a rendered fields for issue- Specified by:
getRenderedFieldsin interfaceIssueClient- Parameters:
issueKeyOrId- issue key or idfieldIds- ids of fields to retrieve- Returns:
- a map containing the rendered version of the specified fields
-
getIssueHistory
- Specified by:
getIssueHistoryin interfaceIssueClient
-
createIssue
public io.atlassian.fugue.Either<ErrorCollection,CreateIssueResponse> createIssue(IssueRequest request, IssueRequestOptions options) Description copied from interface:IssueClientCreate an issue- Specified by:
createIssuein interfaceIssueClient- Parameters:
request- contains all the field informationoptions- options for the request. e.g. send notifications- Returns:
- a reference to the issue created
-
createIssues
public io.atlassian.fugue.Either<ErrorCollection,CreateIssuesResponse> createIssues(List<IssueRequest> requests, IssueRequestOptions options) Description copied from interface:IssueClientBulk creates the issues specified- Specified by:
createIssuesin interfaceIssueClient- Parameters:
requests- contains all issues to createoptions- options for the request. e.g. send notifications- Returns:
- references to the issues created
-
deleteIssue
Description copied from interface:IssueClientDeletes an issue- Specified by:
deleteIssuein interfaceIssueClient- Parameters:
issueKey- the issue to delete.options- options for the request. e.g. send notifications
-
archiveIssue
Description copied from interface:IssueClientArchives an issue- Specified by:
archiveIssuein interfaceIssueClient- Parameters:
issueKey- the issue to archive.options- options for the request. e.g. send notifications- Returns:
- empty
ErrorCollectionon success, collection of errors inErrorCollectionotherwise
-
deleteComment
Description copied from interface:IssueClientDeletes a comment- Specified by:
deleteCommentin interfaceIssueClient- Parameters:
issueKey- the issue the comment belongs to.id- the comment to delete.options- options for the request. e.g. send notifications
-
deleteAttachment
Description copied from interface:IssueClientDeletes an attachment- Specified by:
deleteAttachmentin interfaceIssueClient- Parameters:
id- the id of the attachment to delete.
-
getAttachments
Description copied from interface:IssueClientReturns list of attachments in the issue.- Specified by:
getAttachmentsin interfaceIssueClient- Parameters:
issueKey- key of the issue to get attachments from- Returns:
- list of attachment beans, when no result empty list is returned
-
editIssue
public ErrorCollection editIssue(String issueKey, IssueRequest request, IssueRequestOptions options) Description copied from interface:IssueClientEdits an issue- Specified by:
editIssuein interfaceIssueClient- Parameters:
issueKey- the issue to edit.request- contains all the field informationoptions- options for the request. e.g. send notifications- Returns:
- An error collection if any errors occurred during the operation.
-
addComment
public io.atlassian.fugue.Either<ErrorCollection,CommentBean> addComment(String issueKey, CommentRequest commentRequest, IssueRequestOptions options) Description copied from interface:IssueClientAdds a comment to the issue with the given issue key.- Specified by:
addCommentin interfaceIssueClient- Parameters:
issueKey- The issue to add a comment tocommentRequest- The comment parameters.options- options for the request. e.g. send notifications- Returns:
- The newly added comment.
-
assignIssue
Description copied from interface:IssueClientAssigns the provided issue to the user provided in the userId. This method may return an error collection containing errors if the assign failed.- Specified by:
assignIssuein interfaceIssueClient- Parameters:
issueKey- the issue to change the assignee forusername- the new assignee for the issue. Can be -1 for automatic, null for unassignoptions- options for the request. e.g. send notifications- Returns:
- Any errors
-
getTransitions
Description copied from interface:IssueClientRetrieves all valid transitions available on the provided issue.- Specified by:
getTransitionsin interfaceIssueClient- Parameters:
issueKey- the issue to retrieve transitions foroptions- options for the request. e.g. ignore conditions- Returns:
- all valid transitions available on the provided issue.
-
getTransitions
public Optional<TransitionsBean> getTransitions(String issueKey, boolean includeFields, IssueRequestOptions options) Description copied from interface:IssueClientRetrieves all valid transitions available on the provided issue.- Specified by:
getTransitionsin interfaceIssueClient- Parameters:
issueKey- the issue to retrieve transitions forincludeFields- whther to return the fields on the transition screenoptions- options for the request. e.g. ignore conditions- Returns:
- all valid transitions available on the provided issue.
-
transitionIssue
public ErrorCollection transitionIssue(String issueKey, TransitionRequest request, IssueRequestOptions options) Description copied from interface:IssueClientTransitions the provided issue using the given transition id.- Specified by:
transitionIssuein interfaceIssueClient- Parameters:
issueKey- the issue to transitionrequest- the transition to useoptions- options for the request. e.g. ignore conditions- Returns:
- Any errors
-
search
Description copied from interface:IssueClientExecutes the JQL search provided with the search parameters passed in.- Specified by:
searchin interfaceIssueClient- Parameters:
jql- the jql string to search forparams- Additional parameters to page results or return certain fields- Returns:
- The results of running the search.
-
validateSearch
Description copied from interface:IssueClientValidates that the passed in query and parameters are valid.- Specified by:
validateSearchin interfaceIssueClient- Parameters:
jql- the jql string to search forparams- Additional parameters to page results or return certain fields- Returns:
- An error collection containing any JQL validation errors returned by Jira
-
getFields
Description copied from interface:IssueClientGets the issue fields for the system.- Specified by:
getFieldsin interfaceIssueClient- Parameters:
userKey- Fields will be looked up as the passed in user (this may end up returning field names translated in a different locale)- Returns:
- The a list of fields.
-
getFieldOptions
Description copied from interface:IssueClientGets the list of options for a custom field. If the custom field type does not suport options, an Optional.empty() is returned- Specified by:
getFieldOptionsin interfaceIssueClient- Parameters:
fieldId- id of the custom fielduserKey- Fields will be looked up as the passed in user (this may end up returning field names translated in a different locale)- Returns:
- The list of options
-
watchIssue
Description copied from interface:IssueClientAdd a user as a watcher to the specified issue.- Specified by:
watchIssuein interfaceIssueClient- Parameters:
issueKey- the issue to watchwatcherKey- the key of the user to add as a watcher- Returns:
- and ErrorCollection if there's any errors
-
unwatchIssue
Description copied from interface:IssueClientRemove a user as a watcher to the specified issue.- Specified by:
unwatchIssuein interfaceIssueClient- Parameters:
issueKey- the issue to unwatchwatcherKey- the key of the user to remove as a watcher- Returns:
- and ErrorCollection if there's any errors
-
getIssueEvents
Description copied from interface:IssueClientReturns a list of available issue events (both system and custom);- Specified by:
getIssueEventsin interfaceIssueClient- Returns:
- A list of all issue events in the system.
-
publishEvent
Description copied from interface:IssueClientPublishes the provided issue event with the issue payload.- Specified by:
publishEventin interfaceIssueClient
-
getLinkTypes
Description copied from interface:IssueClientReturns all globally configured issue link types.- Specified by:
getLinkTypesin interfaceIssueClient
-
linkIssueTo
Description copied from interface:IssueClientLinks an issue to another issue.- Specified by:
linkIssueToin interfaceIssueClient- Parameters:
request- contains the details of the link to establish (type and destination issue)- Returns:
- an errorcollection containing any errors.
-
deleteIssueLink
Description copied from interface:IssueClientDeletes and issue link by it's ID.- Specified by:
deleteIssueLinkin interfaceIssueClient- Parameters:
issueLinkId- The issue link ID to delete.- Returns:
- an errorcollection containing any errors.
-
getComments
- Specified by:
getCommentsin interfaceIssueClient
-
getRenderedCommentBody
Description copied from interface:IssueClientGet the rendered body of a comment- Specified by:
getRenderedCommentBodyin interfaceIssueClient
-
getRenderedWorklogBody
Description copied from interface:IssueClientGet the rendered body of a worklog- Specified by:
getRenderedWorklogBodyin interfaceIssueClient
-
getWorklogs
- Specified by:
getWorklogsin interfaceIssueClient
-
addWorklog
public ErrorCollection addWorklog(@NotNull @NotNull String issueKey, @NotNull @NotNull AddWorklogRequest request, @NotNull @NotNull AdjustEstimate adjustEstimate, @Nullable String remainingEstimateValue) Description copied from interface:IssueClientLogs work against an issue- Specified by:
addWorklogin interfaceIssueClient- Parameters:
issueKey- key of the issue to log the work againstrequest- details of the worklogadjustEstimate- how to adjust the remaining estimateremainingEstimateValue- value for adjusting the remaining estimate, if required- Returns:
- an
ErrorCollectioncontaining any errors
-
getWatchers
- Specified by:
getWatchersin interfaceIssueClient
-
getVoters
- Specified by:
getVotersin interfaceIssueClient
-
copyAttachments
public ErrorCollection copyAttachments(String fromIssueKey, String toIssueKey, List<AttachmentBean> attachments, boolean sendNotification) - Specified by:
copyAttachmentsin interfaceIssueClient
-
getParentIssue
Description copied from interface:IssueClientThis shouldn't really be called or necessary, but due to issues with server and it not always having the issue parent link populated, we need cloud vs server dependant implementations.- Specified by:
getParentIssuein interfaceIssueClient
-
getIssueLinks
Description copied from interface:IssueClientGet issue links for an issue- Specified by:
getIssueLinksin interfaceIssueClient- Parameters:
issueKey- the issue key- Returns:
- list of issue links, empty list if none found
-