grouper-users - RE: [grouper-users] RE: Grouper 1.4.0: Using hooks
Subject: Grouper Users - Open Discussion List
List archive
- From: Chris Hyzer <>
- To: "" <>
- Cc: Grouper Users Mailing List <>
- Subject: RE: [grouper-users] RE: Grouper 1.4.0: Using hooks
- Date: Tue, 3 Feb 2009 23:32:47 -0500
- Accept-language: en-US
- Acceptlanguage: en-US
Ive been thinking about your issue, and if your question is, why should you
use the failsafe group type call since the type hasn’t been applied yet, it
might be because when you add a type to a group, it might update the group
lastUpdated col, and invoke the update hook again. Then, the second time, it
does have that type, and you cant add it again. This is something we are
exploring for 1.5 (not setting the Group lastUpdated for each peripheral
operation like memberships, types, etc). However, for 1.4, the group object
might be saved for any related change, which fires the hooks again... so if
you use the failsafe method per one of my previous emails, then the second
time the hook is called, it doesn’t fail.
Hope this helps, if not, send your code and description again and I will take
a look. :)
Kind regards,
Chris
> -----Original Message-----
> From: Dr. Loris Bennett
> [mailto:]
> Sent: Tuesday, February 03, 2009 9:37 AM
> To: Chris Hyzer
> Cc: Grouper Users Mailing List
> Subject: RE: [grouper-users] RE: Grouper 1.4.0: Using hooks
>
> Hi Chris,
>
> I don't understand what is going on here. If I create a new group via
> the UI without selecting any custom type, the code
>
> Group g = postInsertBean.getGroup();
> Set<GroupType> types = g.getTypes();
>
> tells me that the new group has just one type, namely 'base'. I then
> get
> the error
>
> ERROR JDBCExceptionReporter.logExceptions(78) - ERROR:
> duplicate
> key violates unique constraint "grouptypetyple_grouptype_idx"
>
> But how can the group already have the type at this point? The
> following
> error appears in the UI:
>
> Error: Could not create group. Error is 'cannot create child
> group: Problem create child stem:
> Stem[displayName=test,name=test,uuid=029bc9c2-50bd-4122-891c-
> ffdf252744b8,creator=fd703376-4f16-47df-b707-
> 64d8c5953d04,modifier=fd703376-4f16-47df-b707-64d8c5953d04], child:
> Group[name=test:xyz,uuid=dc2a2fa6-4fad-446e-bf5c-d08dba8d0b33],
> memberDto: 'dc2a2fa6-4fad-446e-bf5c-d08dba8d0b33'/'group'/'g:gsa',
> Problem in HibernateSession: HibernateSession: isNew: false,
> isReadonly: false, grouperTransactionType: READ_WRITE_NEW, Exception in
> uniqueResult: (class java.lang.Object), ByHqlStatic, query: 'select
> m.id from Member as m where m.uuid = :uuid', cacheable: false,
> cacheRegion:
> edu.internet2.middleware.grouper.internal.dao.hib3.Hib3MemberDAO.Exists
> , tx type: nullBind var[0]: 'Param (class java.lang.String): 'uuid'-
> >'b412a97d-080a-4b68-a856-5a237a041e06', , Problem in HibernateSession:
> HibernateSession: isNew: false, isReadonly: false,
> grouperTransactionType: READ_WRITE_NEW'.
>
> Any ideas what I am doing wrong?
>
> Cheers
>
> Loris
>
> On Fri, 2009-01-30 at 15:36 -0500, Chris Hyzer wrote:
> > That index "grouptypetyple_grouptype_idx" is a unique index on
> > grouper_group_types cols: group_uuid and type_uuid.
> >
> > So that error means that the group already has the type.
> >
> >
> >
> > I have also found it unnatural that the default Grouper API behavior
> > is to throw exceptions if the task is already done. E.g.
> >
> >
> >
> > group.addType(someType);
> >
> >
> >
> > Will throw an exception if the type is already there... I have been
> > slowly overloading these types of methods with their safe
> > equivalents... so if you change it to:
> >
> >
> >
> > //false means don’t throw exception if type is already assigned
> >
> > group.addType(someType, false);
> >
> >
> >
> > It should do the trick. Let me know if not.
> >
> >
> >
> > Thanks,
> >
> > Chris
> >
> >
> >
> > Ps. Btw, web services do not behave that way... e.g. if you add a
> > member to a group that already has the member, it will be a no-op,
> > return SUCCESS, and let you know exactly what happened (e.g. success,
> > but it already had the assignment)
> >
> >
> >
> >
> >
> > > -----Original Message-----
> >
> > > From: Dr. Loris Bennett
> > > [mailto:]
> >
> > > Sent: Friday, January 30, 2009 8:27 AM
> >
> > > To: Chris Hyzer
> >
> > > Cc: Grouper Users Mailing List
> >
> > > Subject: RE: [grouper-users] RE: Grouper 1.4.0: Using hooks
> >
> > >
> >
> > > However, when I try to add the type in groupPostInsert, I get
> >
> > >
> >
> > > ERROR JDBCExceptionReporter.logExceptions(78) - ERROR:
> >
> > > duplicate
> >
> > > key violates unique constraint
> > "grouptypetyple_grouptype_idx"
> >
> > >
> >
> > > Any ideas?
> >
> > >
> >
> > > Loris
> >
> > >
> >
> > > On Fri, 2009-01-30 at 07:34 -0500, Chris Hyzer wrote:
> >
> > > > Good catch! Thanks!
> >
> > > >
> >
> > > > > -----Original Message-----
> >
> > > > > From: Dr. Loris Bennett
> > > > > [mailto:]
> >
> > > > > Sent: Friday, January 30, 2009 7:31 AM
> >
> > > > > To: Chris Hyzer
> >
> > > > > Cc: Grouper Users Mailing List
> >
> > > > > Subject: RE: [grouper-users] RE: Grouper 1.4.0: Using hooks
> >
> > > > >
> >
> > > > > OK, I see what I am doing wrong. I have the addType in my
> >
> > > > > groupPreInsert, whereas the group must already exist before I
> > can
> >
> > > add
> >
> > > > > anything to it.
> >
> > > > >
> >
> > > > > On Fri, 2009-01-30 at 11:39 +0100, Dr. Loris Bennett wrote:
> >
> > > > > > Hi Chris,
> >
> > > > > >
> >
> > > > > > Using
> >
> > > > > >
> >
> > > > > > fubGroup = GroupTypeFinder.find(groupTypeName);
> >
> > > > > >
> >
> > > > > > I can get my custom group type, but when I try to add this
> > with
> >
> > > > > >
> >
> > > > > > g.addType(fubGroup);
> >
> > > > > >
> >
> > > > > > I get the error:
> >
> > > > > >
> >
> > > > > > ERROR JDBCExceptionReporter.logExceptions(78) -
> ERROR:
> >
> > > insert
> >
> > > > > or
> >
> > > > > > update on table "grouper_groups_types" violates
> > foreign
> >
> > > key
> >
> > > > > > constraint "fk_groups_types_group_uuid"
> >
> > > > > > Detail: Key
> >
> > > > > > (group_uuid)=(6ea9f650-cdc8-4e69-93df-5b35a87351fe)
> is
> >
> > > not
> >
> > > > > > present in table "grouper_groups".
> >
> > > > > >
> >
> > > > > > Am I doing something wrong here?
> >
> > > > > >
> >
> > > > > > TIA
> >
> > > > > >
> >
> > > > > > Loris
> >
> > > > > >
> >
> > > > > >
> >
> > > > > > On Thu, 2009-01-29 at 03:21 -0500, Chris Hyzer wrote:
> >
> > > > > > > >
> >
> > > > > > > > So the pre-insert would also set the custom attribute,
> > right?
> >
> > > > > > >
> >
> > > > > > > OK, didn’t know we were talking about a custom attribute.
> > It’s
> >
> > > a
> >
> > > > > little tricky since the set of attributes is known when the
> > group
> >
> > > SQL
> >
> > > > > is written, but you are making changes (I guess to that
> > attribute
> >
> > > set).
> >
> > > > > I would think a post insert is the best bet, and you don’t need
> > the
> >
> > > > > pre, but play around and try different things, and if you cant
> > get
> >
> > > > > anything to work let me know.
> >
> > > > > > >
> >
> > > > > > > Chris
> >
> > > > > > >
> >
> > > > > > >
> >
> > > > > --
> >
> > > > > Dr. Loris Bennett (Mr.)
> >
> > > > > Freie Universität Berlin
> >
> > > > > ZEDAT - Zentraleinrichtung für Datenverarbeitung / Computer
> > Center
> >
> > > > > Compute & Media Service
> >
> > > > > Fabeckstr. 32, Room 221
> >
> > > > > D-14195 Berlin
> >
> > > > > Tel ++49 30 838 51024
> >
> > > > > Fax ++49 30 838 56721
> >
> > > > >
> >
> > > > > Web www.zedat.fu-berlin.de
> >
> > > >
> >
> > > --
> >
> > > Dr. Loris Bennett (Mr.)
> >
> > > Freie Universität Berlin
> >
> > > ZEDAT - Zentraleinrichtung für Datenverarbeitung / Computer Center
> >
> > > Compute & Media Service
> >
> > > Fabeckstr. 32, Room 221
> >
> > > D-14195 Berlin
> >
> > > Tel ++49 30 838 51024
> >
> > > Fax ++49 30 838 56721
> >
> > >
> >
> > > Web www.zedat.fu-berlin.de
> >
> >
> >
> >
> --
> Dr. Loris Bennett (Mr.)
> Freie Universität Berlin
> ZEDAT - Zentraleinrichtung für Datenverarbeitung / Computer Center
> Compute & Media Service
> Fabeckstr. 32, Room 221
> D-14195 Berlin
> Tel ++49 30 838 51024
> Fax ++49 30 838 56721
>
> Web www.zedat.fu-berlin.de
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Dr. Loris Bennett, 02/03/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Chris Hyzer, 02/03/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Chris Hyzer, 02/03/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Dr. Loris Bennett, 02/04/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Chris Hyzer, 02/04/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Dr. Loris Bennett, 02/05/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Chris Hyzer, 02/05/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Dr. Loris Bennett, 02/09/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Chris Hyzer, 02/09/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Dr. Loris Bennett, 02/09/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Chris Hyzer, 02/09/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Dr. Loris Bennett, 02/09/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Chris Hyzer, 02/09/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Dr. Loris Bennett, 02/09/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Chris Hyzer, 02/05/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Dr. Loris Bennett, 02/05/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Chris Hyzer, 02/04/2009
- RE: [grouper-users] RE: Grouper 1.4.0: Using hooks, Dr. Loris Bennett, 02/04/2009
Archive powered by MHonArc 2.6.16.