I'm attempting to search all groups (not the groups for a specific user) via a groovy script in the Script Runner console using the following method:
List<com.atlassian.crowd.embedded.api.Group> findGroups(String query)
My script:
import com.atlassian.jira.bc.group.search.GroupPickerSearchServiceImpl
def searchString = "members"
def groupList = GroupPickerSearchServiceImpl.findGroups(searchString)
fails suggesting a string be supplied..
Error
No signature of method: static com.atlassian.jira.bc.group.search.GroupPickerSearchServiceImpl.findGroups() is applicable for argument types: (java.lang.String) values: [members] Possible solutions: findGroups(java.lang.String)
What am I doing wrong? Thanks for any help!
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.bc.group.search.GroupPickerSearchService
import com.atlassian.crowd.embedded.api.Group def groupSearch = ComponentAccessor.getComponent(GroupPickerSearchService)
def groupList = groupSearch.findGroups("a search string")
//print group names to log
for (Group group in groupList){
log.error group.getName().toString()
}
Sorted - need to import via ComponentAccessor first
How can I get the name of all groups inside a plugin? Same way doesn't work on Jira 7.6.3. it gives me the list but I can't access to the items(Group).
GroupPickerSearchService groupSearch = ComponentAccessor.getComponent(GroupPickerSearchService.class);
List<Group> groupList = groupSearch.findGroups("");
for (Group group : groupList){
System.out.println("Group:" + group.getName());
}
This are the values that it takes when I debug the code. ImmutableGroup??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For some reason when I do this, it works.
GroupPickerSearchService groupSearch = ComponentAccessor.getComponent(GroupPickerSearchService.class);
List<Group> groupList = new ArrayList<>();
groupList.addAll(groupSearch.findGroups(""));
for (Group gg : groupList){
System.out.println("Group:" + gg.getName());
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.