Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def getJIRARESTClient(): Option[JiraRestClient] = {
try {
val asyncClientFactory: AsynchronousJiraRestClientFactory = new AsynchronousJiraRestClientFactory()
result = Some(asyncClientFactory.createWithBasicHttpAuthentication(
new URI(baseUrl),
case(e: Exception) => {
logger.error(s"The atlassian jira erest client could not be created. Reason: ${e}")
throw new JIRAException()
def createNewJIRAItemAndWriteFeatureInto(rf: RequirementFeature): Unit ={
val defaultIssueType = configuration.envOrElseConfig("data.destination.jira.defaultIssueType")
val issueTypes = client.getMetadataClient.getIssueTypes.claim().asScala
for(it <- issueTypes) yield {
val projectId: Long = client.getProjectClient.getProject(rf.projectKey).claim().getId
val newIssueInput: IssueInput = new IssueInputBuilder(rf.projectKey,it.getId, rf.jiraIssue.get.summary).build()
val newIssue: BasicIssue = client.getIssueClient.createIssue(newIssueInput).claim()
updateDescriptionIntoExistingJIRAIssue(updateJIRAItemInRF(newIssue, rf))
case e: Exception => {
logger.error(s"Error trying to create a new JIRA issue. feature: '${}'. Reason: ${e}")
throw new JIRAException(s"Error trying to create a new JIRA issue. feature: '${}'. Reason: ${e}")
private def updateJIRAItemInRF(newIssue: BasicIssue, rf: RequirementFeature): RequirementFeature ={
val newJIRAItem: JIRAIssue = new JIRAIssue(newIssue.getId, newIssue.getKey,
new RequirementFeature(rf.feature_id,, rf.projectKey, rf.component, rf.scenarios, Some(newJIRAItem), rf.lastUpdateTime)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.