/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package edu.uchicago.grouperabi;
import edu.internet2.middleware.grouperClient.api.GcFindGroups;
import edu.internet2.middleware.grouperClient.ws.beans.WsGroup;
import edu.internet2.middleware.grouperClient.ws.beans.WsQueryFilter;
import edu.internet2.middleware.grouperClient.ws.beans.WsStem;
import java.util.ArrayList;
/**
* The GrouperClient API is missing some very basic functionality. Implement
* convenience functions here in this wrapper class
*
* @author davel
*/
public class Stem {
private WsStem wsStem;
public Stem(WsStem aStem){
wsStem = aStem;
}
public String getName(){
return wsStem.getName();
}
public ArrayList<Group> getGroups() {
GcFindGroups gcf = new GcFindGroups();
WsQueryFilter wsqf = new WsQueryFilter();
wsqf.setStemName(wsStem.getName());
wsqf.setQueryFilterType("FIND_BY_STEM_NAME");
gcf.assignQueryFilter(wsqf);
ArrayList<Group> groupResults = new ArrayList();
WsGroup[] callResults = gcf.execute().getGroupResults();
for(WsGroup aGroup : callResults){
groupResults.add(new Group(aGroup, this));
}
return groupResults;
}
}