Skip to content

Instantly share code, notes, and snippets.

@nickname55
nickname55 / IsNullOrEmpty.Groovy
Created April 17, 2022 18:28 — forked from ismits/IsNullOrEmpty.Groovy
Is null or empty check in Groovy
if (!someString?.trim()) {
logger.lifecycle("the string is null or empty.")
}
@nickname55
nickname55 / jql_jira.md
Created March 4, 2022 09:58
JQL Quries ( Jira )

Задачи созданные текущим пользователем в проекте X Tasks в текущем месяце, отсортированные от самых новых до самых старых

reporter = currentUser() and project="X Tasks" and created  > startOfMonth() and created < endOfMonth() order by created

Задачи, запись о работе над которыми начата после 9 апреля 2021 года, текущим пользователем

import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Level
import org.apache.log4j.Logger
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.bc.user.search.UserSearchService
import com.atlassian.jira.bc.user.search.UserSearchParams
import com.atlassian.jira.bc.user.ApplicationUserBuilderImpl
log.setLevel(Level.DEBUG)
//---------------------------------------------------------------------------
//
// This file is the copyrighted property of Tableau Software and is protected
// by registered patents and other applicable U.S. and international laws and
// regulations.
//
// You may adapt this file and modify it to fit into your context and use it
// as a template to start your own projects.
//
//---------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>java-examples</artifactId>
<version>1.0-SNAPSHOT</version>
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "Создана новая задача https://service-desk.com/browse/{{issueKey}}",
"sections": [{
"activityTitle": "Создана новая задача https://service-desk/browse/{{issueKey}}",
"activitySubtitle": "источник: Web-bot",
"facts": [{
"name": "Имя пользователя",
@nickname55
nickname55 / Поле underestimated [Duration (time-tracking)].groovy
Last active February 6, 2022 05:43
насколько времени мы потратили больше, чем изначально планировали (originalEstimate) - ScriptRunner, тип поля [Duration (time-tracking)]
def originalEstimate = issue.getOriginalEstimate();
def timeSpent = issue.getTimeSpent();
if (originalEstimate != null) {
if (originalEstimate < timeSpent) {
return timeSpent - originalEstimate;
} else {
return 0L;
}
} else {
return 0L;
@nickname55
nickname55 / readme.md
Created May 5, 2021 15:49
jira api - как получить список иконок применяемых для issue type

Отправить GET на

http://localhost:2990/jira/rest/api/2/avatar/issuetype/system

результат:

// http://localhost:2990/jira/rest/api/2/avatar/issuetype/system
@nickname55
nickname55 / 1.sql
Last active April 10, 2021 10:48
Запрос который выбирает типы Customer Request Type для Jira Service Desk
select vp.KEY as project_key, vpf.NAME as Request_type_Name, vpf.KEY AS request_type from AO_54307E_VIEWPORT vp join AO_54307E_VIEWPORTFORM vpf on vpf.VIEWPORT_ID = vp.ID;
+-------------+------------------------------------+--------------------------------------+
| project_key | Request_type_Name | request_type |
+-------------+------------------------------------+--------------------------------------+
| a1sd | Get IT help | getithelp |
| a1sd | Fix an account problem | accountproblem |
| a1sd | Get a guest wifi account | guestwifi |
| a1sd | Request admin access | adminaccess |
| a1sd | Request a new account | newaccount |
| a1sd | Onboard new employees | newhires |
@nickname55
nickname55 / example.groovy
Created April 9, 2021 18:42
неправильная выгрузка в CSV поля Customer Request Type
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObjectByName("Customer Request Type")
def cFieldValue = issue.getCustomFieldValue(cField).toString()
switch(cFieldValue) {