Skip to content

Instantly share code, notes, and snippets.

View vikrantyadav11's full-sized avatar
🏠
Working from home

vikrantyadav11

🏠
Working from home
View GitHub Profile
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")
{{issue.description.match("Submitted by: (\w+)@vmware\.com")}}
import groovy.transform.BaseScript
import com.onresolve.jira.groovy.user.FieldBehaviours
@BaseScript FieldBehaviours fieldBehaviours
final String screenName = 'Resolution screen'
//final String targetTransition = 'Accept'
def comment = getFieldById("comment")
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.issue.index.IssueIndexingService;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
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
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()
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' }
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'
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!'