SHOW:
|
|
- or go back to the newest paste.
1 | - | /***********************/ |
1 | + | /*************************/ |
2 | - | /* GROOVY - Varios */ |
2 | + | /* GROOVY - Strings */ |
3 | - | /***********************/ |
3 | + | /*************************/ |
4 | ||
5 | - | // Lanzar excepción (validador) |
5 | + | // Comparar cadena de texto con expresión regular |
6 | - | // Obtener el action que se está ejecutando en una PF |
6 | + | // Extraer subcadena de un texto |
7 | - | // Mostrar popup flag |
7 | + | // Comprobaciones |
8 | ||
9 | /************************************************************************/ | |
10 | ||
11 | - | // Lanzar excepción (validador) |
11 | + | // Comparar cadena de texto con expresión regular |
12 | - | throw new InvalidInputException("customfield_20109", "Default value must be modified") |
12 | + | import java.util.regex.Matcher |
13 | import java.util.regex.Pattern | |
14 | ..... | |
15 | - | // Obtener el action que se está ejecutando en una PF |
15 | + | Pattern pattern = Pattern.compile("[^N]OK|^OK"); |
16 | - | def actionID = transientVars["actionId"] |
16 | + | Matcher match = pattern.matcher(requirementStatusValue.toString()); |
17 | - | JiraWorkflow workflow = ComponentAccessor.getWorkflowManager().getWorkflow(issue) |
17 | + | if (match.find()) { ..... } |
18 | - | def wfd = workflow.getDescriptor() |
18 | + | |
19 | - | def actionName = wfd.getAction(transientVars["actionId"]).getName() |
19 | + | |
20 | // Extraer subcadena de un texto | |
21 | if(issue.description?.length() > 3000){ // Comprobación necesaria para evitar excepción (IndexOutOfBounds) | |
22 | - | // Mostrar popup flag |
22 | + | params.put("description",issue.description.substring(0, 3000)); |
23 | - | import com.onresolve.scriptrunner.runner.util.UserMessageUtil |
23 | + | }else{ |
24 | - | UserMessageUtil.success('Good job! ') |
24 | + | params.put("description",issue.description); |
25 | - | UserMessageUtil.info("Something interesting") |
25 | + | } |
26 | - | UserMessageUtil.warning("Danger") |
26 | + | |
27 | - | UserMessageUtil.error("Error") |
27 | + | |
28 | // Comprobaciones | |
29 | - | //// Opcion 2 |
29 | + | Objects.isNull(regTestCycleValue) |
30 | - | import com.onresolve.scriptrunner.runner.util.UserMessageUtil |
30 | + | Objects.nonNull(regTestCycleValue) |
31 | - | def flag = [ |
31 | + | StringUtils.isBlank(regTestCycleValue) |
32 | - | type: "warning", // Other possible options are "info", "success", "error" |
32 | + | |
33 | - | body: "Please Request for retrofit codes if not already done.", |
33 | + |