ı有一个Groovy脚本,该脚本检查值列表中屏幕上的字段中的值(如果存在)。
import com.atlassian.jira.component.ComponentAccessor;
import org.apache.log4j.Logger
import org.apache.log4j.Level
import com.atlassian.jira.user.ApplicationUser;
import java.lang.Object
def groupManager = ComponentAccessor.getGroupManager();
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def eManagerCF = customFieldManager.getCustomFieldObjectByName("Ek Manager")
def dedManagerCF = customFieldManager.getCustomFieldObjectByName("Ded Manager")
def depManagerCF = customFieldManager.getCustomFieldObjectByName("Dep Manager ")
String eManager = issue.getCustomFieldValue(eManagerCF)
String dedManager = issue.getCustomFieldValue(dedManagerCF)
String depManager = issue.getCustomFieldValue(depManagerCF)
if (eManager) {
eManager = eManager.trim()
}
if (dedManager) {
dedManager = dedManager.trim()
}
if (depManager) {
depManager = depManager.trim()
}
cfValues['2. Onay'] ? .value == null && cfValues['1.Adim '] ? .value != "Helpdesk" && cfValues['1. Onay '] ? .value == "Ilgili Yönetici " &&
(!groupManager.getUsersInGroup('ITSM Onaya Gitmeyecek Personeller ').contains(eManager) ||
!groupManager.getUserNamesInGroup('ITSM Onaya Gitmeyecek Personeller ').contains(dedManager) ||
!groupManager.getUsersInGroup('ITSM Onaya Gitmeyecek Personeller ').contains(depManager))
所以我的问题是: 字符串dedManager = issue.getCustomFieldValue(dedManagerCF) 返回aaa.bbb@xx.com
groupManager.getUsersInGroup('ITSM Onaya Gitmeyecek Personeller) 返回带有用户名(如Aaa.Bbb@xx.com)的列表
所以方法 groupManager.getUsersInGroup('ITSM Onaya Gitmeyecek Personeller')。contains(depManager))始终返回false
可以帮忙吗?
答案 0 :(得分:1)
简化您的问题:如何在忽略大小写的列表中查找字符串值。
def str = 'Aaa.Bbb@xx.com'
def list = ['xxx.yyy@zz.com','aaa.bbb@xx.com']
if( list.find{e-> e.equalsIgnoreCase(str)} ){
println "found"
}
或者如果您确定列表中始终包含小写字母,则在应用contains
之前将字符串转换为小写字母
def str = 'Aaa.Bbb@xx.com'
def list = ['xxx.yyy@zz.com','aaa.bbb@xx.com']
str = str.toLowerCase()
if( str in list ){
println "found"
}