This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import com.atlassian.jira.security.roles.ProjectRoleManager | |
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() | |
def projectRoleManager = ComponentAccessor.getComponentOfType(com.atlassian.jira.security.roles.ProjectRoleManager) | |
def testerRole = projectRoleManager.getProjectRole("contractor") | |
def project = issue.getProjectObject() | |
log.warn project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import com.atlassian.jira.security.login.LoginManager | |
import java.text.SimpleDateFormat; | |
import java.util.Calendar; | |
import com.atlassian.jira.user.util.UserUtil | |
UserUtil userUtil = ComponentAccessor.getUserUtil() | |
def loginManager = ComponentAccessor.getComponentOfType(LoginManager.class) | |
def groupManager = ComponentAccessor.getGroupManager() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jsoup.Jsoup | |
def html = "<div class=\"table-wrap\"><table data-layout=\"wide\" data-local-id=\"fa416b5e-c36e-4c93-85b8-ac5652cdecf0\" class=\"confluenceTable\"><colgroup><col style=\"width: 320.0px;\"/><col style=\"width: 320.0px;\"/><col style=\"width: 320.0px;\"/></colgroup><tbody><tr><th class=\"confluenceTh\"><p><strong>Instance</strong></p></th><th class=\"confluenceTh\"><p><strong>Users</strong></p></th><th class=\"confluenceTh\"><p><strong>Projects</strong></p></th></tr><tr><th class=\"confluenceTh\"><p>JSD</p></th><td class=\"confluenceTd\"><p>1000</p></td><td class=\"confluenceTd\"><p>2000</p></td></tr><tr><th class=\"confluenceTh\"><p>Jira Core</p></th><td class=\"confluenceTd\"><p>2000</p></td><td class=\"confluenceTd\"><p>4000</p></td></tr></tbody></table></div><p />" | |
def table = Jsoup.parse(html).select('table').first() | |
def rows = table.select('tr') | |
// find the JSD row | |
def jsdRow = rows.find { it.select('th').first().text() == 'JSD' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.http.HttpResponse | |
import org.apache.http.client.HttpClient | |
import org.apache.http.client.methods.HttpPost | |
import org.apache.http.entity.StringEntity | |
import org.apache.http.impl.client.HttpClientBuilder | |
import org.apache.http.util.EntityUtils | |
import groovy.json.JsonSlurper | |
def url = 'https://api.openai.com/v1/chat/completions' | |
def apiKey = 'sk-j4qZQqwS5Lczu3wRgER3TFJbALfxVk99xgsfiJmTlm4' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.http.HttpResponse | |
import org.apache.http.client.HttpClient | |
import org.apache.http.client.methods.HttpPost | |
import org.apache.http.entity.StringEntity | |
import org.apache.http.impl.client.HttpClientBuilder | |
import org.apache.http.util.EntityUtils | |
def url = 'https://api.openai.com/v1/chat/completions' | |
def apiKey = 'sk-j4qZQqwS5Lczu3wRgER3T3BlbkFJbALfxVk99xgsmTlm4' | |
def prompt = 'Hello, ChatGPT!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import groovy.sql.Sql | |
import org.ofbiz.core.entity.ConnectionFactory | |
import org.ofbiz.core.entity.DelegatorInterface | |
import java.sql.Connection | |
def delegator = (DelegatorInterface) ComponentAccessor.getComponent(DelegatorInterface) | |
String helperName = delegator.getGroupHelperName("default") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import com.opensymphony.workflow.InvalidInputException | |
def assignee = issue.getAssignee() | |
log.warn(assignee) | |
int customFieldId = 14840 | |
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(customFieldId) | |
def customFieldValue = issue.getCustomFieldValue(customField) | |
log.warn(customFieldValue) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
import groovy.sql.Sql | |
import org.ofbiz.core.entity.ConnectionFactory | |
import org.ofbiz.core.entity.DelegatorInterface | |
import java.sql.Connection | |
def delegator = (DelegatorInterface) ComponentAccessor.getComponent(DelegatorInterface) | |
String helperName = delegator.getGroupHelperName("default") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select cf.cfname from customfield cf where cf.cfname not in (select cf.cfname from customfieldvalue cfv join customfield cf on cfv.customfield = cf.id join jiraissue ji on cfv.issue = ji.id join project p on ji.project = p.id ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.atlassian.jira.component.ComponentAccessor | |
def issuetype = getIssueContext().getIssueType().name | |
def optionsManager = ComponentAccessor.getOptionsManager() | |
def customFieldManager = ComponentAccessor.getCustomFieldManager() | |
def test_checkbox = getFieldByName("Test Checkbox") | |
def customField = customFieldManager.getCustomFieldObject(test_checkbox.getFieldId()) | |
def config = customField.getRelevantConfig(getIssueContext()) |