Skip to Content.
Sympa Menu

grouper-users - Re: [grouper-users] Questions about Alternate ID

Subject: Grouper Users - Open Discussion List

List archive

Re: [grouper-users] Questions about Alternate ID


Chronological Thread 
  • From: Shilen Patel <>
  • To: Gagné Sébastien <>, "" <>
  • Subject: Re: [grouper-users] Questions about Alternate ID
  • Date: Tue, 15 Jan 2013 13:21:53 +0000
  • Accept-language: en-US

You can't have a group with a name that's the same as another group's alternate name.  So if you set SaveMode.INSERT, GroupSave will try to add the group and fail.

gsh 1% g = new GroupSave(session).assignName("test:testGroup").save()
group: name='test:testGroup' displayName='Test:testGroup' uuid='c7ae836ccd994e82b55e1d0be2b2fcc7' 
gsh 2% g.setExtension("testGroup2")
gsh 3% g.store()
gsh 4% // group's alternate name is now test:testGroup and the name is test:testGroup2
group: name='test:testGroup2' displayName='Test:testGroup' uuid='c7ae836ccd994e82b55e1d0be2b2fcc7' 
gsh 5% g = new GroupSave(session).assignName("test:testGroup").assignSaveMode(SaveMode.INSERT).save()
// Error: unable to evaluate command: Sourced file: inline evaluation of: ``g = new GroupSave(session).assignName("test:testGroup").assignSaveMode(SaveMode. . . . '' : Method Invocation save
// See error log for full stacktrace
// caused by: edu.internet2.middleware.grouper.exception.GroupAddAlreadyExistsException:
// group already exists with name: 'test:testGroup', stem name: test, group extension: testGroup, group dExtension: testGroup, uuid: null, typeOfGroup: null,
Problem in HibernateSession: HibernateSession: isNew: false, isReadonly: false, grouperTransactionType: READ_WRITE_NEW,
Problem in HibernateSession: HibernateSession: isNew: true, isReadonly: false, grouperTransactionType: READ_WRITE_NEW

Is that the behavior you want?

Thanks!

-- Shilen


From: Gagné Sébastien <>
Date: Mon, 14 Jan 2013 13:57:20 -0500
To: Shilen Patel <>, <>
Subject: RE: [grouper-users] Questions about Alternate ID

Now that I understand, it makes sense, I don’t think It would be wise to change it for everybody.

 

There could be a flag in Group Save that prevents the use of the Alternate ID. What if I used SaveMode.INSERT, would that force the creation of the second group ?

 

 

De : Shilen Patel []
Envoyé : 14 janvier 2013 13:21
À : Gagné Sébastien;
Objet : Re: [grouper-users] Questions about Alternate ID

 

Hi,

 

So the alternate group ID is typically set as the previous group ID when a group is moved or renamed.  The intention was for the API to continue to be able to find the group by its old name to potentially make it easier to transition from one name to another.  So given that, I think the behavior that you're seeing is expected.   Or do you disagree? :)

 

Thanks!

 

-- Shilen

 

From: Gagné Sébastien <>
Date: Mon, 14 Jan 2013 11:21:34 -0500
To: <>
Subject: [grouper-users] Questions about Alternate ID

 

Hi,

We ran into a “bug” and that made us realise we might have been wrong about how we thought of alternate IDs in Grouper.

 

First, our problem : I tried to automatically create (via GroupSave) a group with the same Name as another’s group Alternate ID. We thought we would get an error for a duplicate group extension (we have a Group Hook to check that), but we didn’t. Digging around I found that in the GroupSave method, it tries to find if the group already exists, but this method check both the current ID and the alternate ID. In this case a modify is detected, the group isn’t created and my logic based on duplicate group ID is bypassed.

 

So how should alternate group ID be treated ? In this case we wanted to keep a trace of where the group was before, but it seems Alternate IDs should be regarded as a copy of the group.

Is the GroupSave wrong to check the Alternate ID ?

 

Right now I did “set alternate ID = false”, to avoid the problem, but I’ll probably have to change my hook to take into account alternate IDs, that would probably be the best solution (albeit a little heavier processing when mass creating groups…)

 

 

Sébastien Gagné,     | Analyste en informatique

514-343-6111 x33844  | Université de Montréal,

                     | Pavillon Roger-Gaudry, local X-100-11

 




Archive powered by MHonArc 2.6.16.

Top of Page