import groovy.transform.BaseScript
import com.atlassian.jira.issue.Issue;
import javax.ws.rs.core.Response
import org.apache.log4j.Logger
import groovy.transform.BaseScript
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import javax.ws.rs.core.MultivaluedMap
import com.atlassian.jira.component.ComponentAccessor
import javax.ws.rs.core.Response
import CreateMultipleSubtasks.Configuration_CreateMultipleSubtasks
import com.atlassian.jira.project.Project
@BaseScript CustomEndpointDelegate delegate
callSubTaskCreator(httpMethod: "GET", groups: ["jira-users"]) {MultivaluedMap queryParams, String body ->
def log1 = Logger.getLogger("atlassian-jira.log")
log1.warn("MOUNA CAMELIA223");
Configuration_CreateMultipleSubtasks conf =new Configuration_CreateMultipleSubtasks()
def MultipleSubtasksHashMap= conf.getSubTaskCreatorHashMap()
String itracCreatemultiplesubtasksProjectCategoriesURL = MultipleSubtasksHashMap["itracCreatemultiplesubtasksProjectCategoriesURL"] as String;
log1.warn("MOUNA CAMELIA223 "+itracCreatemultiplesubtasksProjectCategoriesURL);
def user = ComponentAccessor.jiraAuthenticationContext?.loggedInUser
def issueId = queryParams.getFirst("issueId") as Long
Issue myissue = ComponentAccessor.getIssueManager().getIssueObject(issueId)
def issueKey = myissue.getKey()
def itracCreatemultiplesubtasksProjectCategoriesURL2 = itracCreatemultiplesubtasksProjectCategoriesURL.replaceAll(":1:", issueKey)
def itracCreatemultiplesubtasksProjectCategoriesURL3 = itracCreatemultiplesubtasksProjectCategoriesURL2.replaceAll(":2:", user.getUsername())
log1.warn("The rest endpoint has been executed by the user " +user)
Response.temporaryRedirect(URI.create(itracCreatemultiplesubtasksProjectCategoriesURL3)).build()
}
We need a package declatation at the top of the code so we need **package BulkSplitter** at the top of the code. We need to go to REST endpoint and execute an update. Otherwise, Jira doesn't recognize our changes.
package BulkSplitter
import groovy.transform.BaseScript
import com.atlassian.jira.issue.Issue;
import javax.ws.rs.core.Response
import org.apache.log4j.Logger
import groovy.transform.BaseScript
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import javax.ws.rs.core.MultivaluedMap
import com.atlassian.jira.component.ComponentAccessor
import javax.ws.rs.core.Response
import CreateMultipleSubtasks.Configuration_CreateMultipleSubtasks
import com.atlassian.jira.project.Project
@BaseScript CustomEndpointDelegate delegate
callSubTaskCreator(httpMethod: "GET", groups: ["jira-users"]) {MultivaluedMap queryParams, String body ->
def log1 = Logger.getLogger("atlassian-jira.log")
log1.warn("MOUNA CAMELIA223");
Configuration_CreateMultipleSubtasks conf =new Configuration_CreateMultipleSubtasks()
def MultipleSubtasksHashMap= conf.getSubTaskCreatorHashMap()
String itracCreatemultiplesubtasksProjectCategoriesURL = MultipleSubtasksHashMap["itracCreatemultiplesubtasksProjectCategoriesURL"] as String;
log1.warn("MOUNA CAMELIA223 "+itracCreatemultiplesubtasksProjectCategoriesURL);
def user = ComponentAccessor.jiraAuthenticationContext?.loggedInUser
def issueId = queryParams.getFirst("issueId") as Long
Issue myissue = ComponentAccessor.getIssueManager().getIssueObject(issueId)
def issueKey = myissue.getKey()
def itracCreatemultiplesubtasksProjectCategoriesURL2 = itracCreatemultiplesubtasksProjectCategoriesURL.replaceAll(":1:", issueKey)
def itracCreatemultiplesubtasksProjectCategoriesURL3 = itracCreatemultiplesubtasksProjectCategoriesURL2.replaceAll(":2:", user.getUsername())
log1.warn("The rest endpoint has been executed by the user " +user)
Response.temporaryRedirect(URI.create(itracCreatemultiplesubtasksProjectCategoriesURL3)).build()
}
did you get an answer for this?
I am having the same problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.