grouper-users - Re: [grouper-users] Recursive stem delete?
Subject: Grouper Users - Open Discussion List
List archive
- From: Colin Hudler <>
- To: Grouper Users Mailing List <>
- Subject: Re: [grouper-users] Recursive stem delete?
- Date: Wed, 19 Nov 2008 11:40:04 -0600
Tom Zeller wrote:
Since the Grouper 1.2.1 API, perhaps :
for(Group child : stem.getChildGroups(Scope.SUB)) {
child.delete();
}
for(Stem child : stem.getChildStems(Scope.SUB)) {
child.delete();
}
That's very close to how I do it, except it probably needs to recurse.
Here is an example written in JRuby
include Java
Dir["/srv/grouper/api/dist/lib/grouper.jar"].each { |jar| require jar }
Grouper = Java::edu.internet2.middleware.grouper
Stem = Grouper.StemFinder
Session = Grouper.GrouperSession.start(Grouper.SubjectFinder.find_by_id('GrouperSystem'))
def delete_groups(stem)
stem.get_child_groups.each { |group| group.delete }
end
def delete_stems(stem)
stem.get_child_stems.each { |stem| delete_groups(stem);delete_stems(stem) }
stem.delete
end
stem = Stem.find_by_name(Session, ARGV[0])
delete_groups(stem)
delete_stems(stem)
- Recursive stem delete?, Dr. Loris Bennett, 11/19/2008
- Re: [grouper-users] Recursive stem delete?, Tom Zeller, 11/19/2008
- Re: [grouper-users] Recursive stem delete?, Colin Hudler, 11/19/2008
- RE: [grouper-users] Recursive stem delete?, Chris Hyzer, 11/19/2008
- Re: [grouper-users] Recursive stem delete?, Tom Zeller, 11/19/2008
- RE: [grouper-users] Recursive stem delete?, Chris Hyzer, 11/19/2008
- Re: [grouper-users] Recursive stem delete?, Colin Hudler, 11/19/2008
- Re: [grouper-users] Recursive stem delete?, Tom Zeller, 11/19/2008
Archive powered by MHonArc 2.6.16.