Skip to Content.
Sympa Menu

grouper-users - [grouper-users] gsh scripting

Subject: Grouper Users - Open Discussion List

List archive

[grouper-users] gsh scripting


Chronological Thread 
  • From: mohan shamachar <>
  • To:
  • Subject: [grouper-users] gsh scripting
  • Date: Fri, 19 Apr 2013 13:42:28 -0400 (EDT)

Hi Chris,

I have used the following script to clean the stems and groups. I tried a
script, in a similar fashion to remove the attributes, using a wildcard (like
folder, remove all permissions assigned to a role, etc), but I couldn't. Any
pointers?

Clean Stems/Groups:

grouperSession = GrouperSession.startRootSession();
stem = StemFinder.findByName(grouperSession, "<folder>");
for(child : stem.getChildGroups(Stem.Scope.SUB)) {
System.out.println("deleting: " + child.getName()); child.delete(); }
stemList = new ArrayList(stem.getChildStems(Stem.Scope.SUB));
Collections.sort(stemList);
Collections.reverse(stemList);
for(childStem : stemList) { System.out.println("deleting: " +
childStem.getName()); childStem.delete(); }
stem.delete();

My attempt to remove attributes in a folder.

for(theAttr :
GrouperDAOFactory.getFactory().getAttributeDef().findByStem("<folder>"))
{
// I like to iterate through the attributes or delete each.
}

similarly... an example to iterate all attributes assigned to a role...


Thank you,
mohan



Archive powered by MHonArc 2.6.16.

Top of Page