Skip to Content.
Sympa Menu

grouper-users - RE: [grouper-users] RE: Grouper 1.4.0: Using hooks

Subject: Grouper Users - Open Discussion List

List archive

RE: [grouper-users] RE: Grouper 1.4.0: Using hooks


Chronological Thread 
  • From: "Dr. Loris Bennett" <>
  • To: Chris Hyzer <>
  • Cc: Grouper Users Mailing List <>
  • Subject: RE: [grouper-users] RE: Grouper 1.4.0: Using hooks
  • Date: Mon, 09 Feb 2009 15:54:41 +0100
  • Organization: Freie Universität Berlin

Here is the console output:

$ ./bin/gsh.sh -registry -check
Using
GROUPER_HOME: /home/testwww/src/grouper/grouper.binary.1.4.1
Using
GROUPER_CONF: /home/testwww/src/grouper/grouper.binary.1.4.1/conf
Using JAVA: /home/testwww/java/jdk/bin/java
using MEMORY: 64m-512m
Grouper starting up: version: 1.4.1, build date: 2009/02/02
14:43:32, env: testing
grouper.properties read
from:
/home/testwww/src/grouper/grouper.binary.1.4.1/conf/grouper.properties
Grouper current directory
is: /home/testwww/src/grouper/grouper.binary.1.4.1
log4j.properties read
from:
/home/testwww/src/grouper/grouper.binary.1.4.1/conf/log4j.properties
Grouper is logging to
file:
/home/testwww/src/grouper/grouper.binary.1.4.1/logs/grouper_error.log, at min
level WARN for package: edu.internet2.middleware.grouper, based on
log4j.properties
grouper.hibernate.properties:
/home/testwww/src/grouper/grouper.binary.1.4.1/conf/grouper.hibernate.properties
grouper.hibernate.properties:

grouper@jdbc:postgresql://identity-store.zedat.fu-berlin.de:5713/testfurzdb
sources.xml read
from:
/home/testwww/src/grouper/grouper.binary.1.4.1/conf/sources.xml
sources.xml groupersource id: g:gsa
sources.xml jdbc source id: jdbc:
GrouperJdbcConnectionProvider
(note, might need to type in your response multiple times (Java
stdin is flaky))
(note, you can whitelist or blacklist db urls and users in the
grouper.properties)
Are you sure you want to schemaexport all tables
(dropThenCreate=F,writeAndRunScript=F) in db user 'grouper', db
url

'jdbc:postgresql://identity-store.zedat.fu-berlin.de:5713/testfurzdb'? (y|n):
y
Continuing...
Grouper ddl object type 'Grouper' has dbVersion: 12 and java
version: 13
org.apache.ddlutils.model.ModelException: There are multiple
column with the name id in the table grouper_attributes
at
org.apache.ddlutils.model.Database.initialize(Database.java:295)
at

org.apache.ddlutils.platform.JdbcModelReader.getDatabase(JdbcModelReader.java:484)
at

org.apache.ddlutils.platform.PlatformImplBase.readModelFromDatabase(PlatformImplBase.java:1920)
at

edu.internet2.middleware.grouper.ddl.GrouperDdlUtils.bootstrapHelper(GrouperDdlUtils.java:488)
at

edu.internet2.middleware.grouper.registry.RegistryInitializeSchema.main(RegistryInitializeSchema.java:155)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at

edu.internet2.middleware.grouper.app.gsh.GrouperShell.handleSpecialCase(GrouperShell.java:167)
at

edu.internet2.middleware.grouper.app.gsh.GrouperShell.main(GrouperShell.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.dawidweiss.invoker.Invoker.loader(Invoker.java:167)
at com.dawidweiss.invoker.Invoker.main(Invoker.java:303)
[com.dawidweiss.invoker.Invoker]
edu.internet2.middleware.grouper.app.gsh.GrouperShell has thrown
an exception.
java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
at

edu.internet2.middleware.grouper.app.gsh.GrouperShell.handleSpecialCase(GrouperShell.java:172)
at

edu.internet2.middleware.grouper.app.gsh.GrouperShell.main(GrouperShell.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.dawidweiss.invoker.Invoker.loader(Invoker.java:167)
at com.dawidweiss.invoker.Invoker.main(Invoker.java:303)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at

edu.internet2.middleware.grouper.app.gsh.GrouperShell.handleSpecialCase(GrouperShell.java:167)
... 7 more
Caused by: java.lang.RuntimeException:
org.apache.ddlutils.model.ModelException: There are multiple
column with the name id in the table grouper_attributes
at

edu.internet2.middleware.grouper.registry.RegistryInitializeSchema.main(RegistryInitializeSchema.java:176)
... 12 more
Caused by: org.apache.ddlutils.model.ModelException: There are
multiple column with the name id in the table grouper_attributes
at
org.apache.ddlutils.model.Database.initialize(Database.java:295)
at

org.apache.ddlutils.platform.JdbcModelReader.getDatabase(JdbcModelReader.java:484)
at

org.apache.ddlutils.platform.PlatformImplBase.readModelFromDatabase(PlatformImplBase.java:1920)
at

edu.internet2.middleware.grouper.ddl.GrouperDdlUtils.bootstrapHelper(GrouperDdlUtils.java:488)
at

edu.internet2.middleware.grouper.registry.RegistryInitializeSchema.main(RegistryInitializeSchema.java:155)
... 12 more

and here is grouper_error.log:

2009-02-09 15:50:26,049: [main] WARN
ApiConfig.printConfigOnce(186) - Grouper starting up: version:
1.4.1, build date: 2009/02/02 14:43:32, env: testing
grouper.properties read
from:
/home/testwww/src/grouper/grouper.binary.1.4.1/conf/grouper.properties
Grouper current directory
is: /home/testwww/src/grouper/grouper.binary.1.4.1
log4j.properties read
from:
/home/testwww/src/grouper/grouper.binary.1.4.1/conf/log4j.properties
Grouper is logging to
file:
/home/testwww/src/grouper/grouper.binary.1.4.1/logs/grouper_error.log, at min
level WARN for package: edu.internet2.middleware.grouper, based on
log4j.properties
grouper.hibernate.properties:
/home/testwww/src/grouper/grouper.binary.1.4.1/conf/grouper.hibernate.properties
grouper.hibernate.properties:

grouper@jdbc:postgresql://identity-store.zedat.fu-berlin.de:5713/testfurzdb
sources.xml read
from:
/home/testwww/src/grouper/grouper.binary.1.4.1/conf/sources.xml
sources.xml groupersource id: g:gsa
sources.xml jdbc source id: jdbc:
GrouperJdbcConnectionProvider
2009-02-09 15:50:35,664: [main] ERROR
GrouperDdlUtils.bootstrapHelper(393) - Grouper ddl object type
'Grouper' has dbVersion: 12 and java version: 13

HTH

Loris

On Mon, 2009-02-09 at 09:45 -0500, Chris Hyzer wrote:
> How did you try to upgrade the DB? With:
>
> gsh -registry -check -runscript
>
> Can you send me the entire log?
>
> As a workaround, you can either:
>
> 1. export to xml, recreate the db from scratch (delete data) with:
>
> gsh -registry -check -drop -runscript
>
> Then import the xml
>
> -or- 2. Change the grouper_stems stem name index to be unique (drop and
> recreate index), and change the grouper_ddl row for grouper to be version
> 13...
>
> Thanks,
> Chris
>
> > -----Original Message-----
> > From: Dr. Loris Bennett
> > [mailto:]
> > Sent: Monday, February 09, 2009 7:55 AM
> > To: Chris Hyzer
> > Cc: Grouper Users Mailing List
> > Subject: RE: [grouper-users] RE: Grouper 1.4.0: Using hooks
> >
> > Hi Chris,
> >
> > Using your code I got everything working for a groupPostCommit hook,
> > which is great.
> >
> > However, I can't try out the groupPostInsert hook with the CVS version,
> > because when I try to update the database from 1.4.0, I get the
> > following error:
> >
> > Grouper ddl object type 'Grouper' has dbVersion: 12 and java version:
> > 13
> > org.apache.ddlutils.model.ModelException: There are multiple
> > column with the name id in the table grouper_attributes
> >
> > The error message is misleading, since the table has in fact the
> > regular
> > 5 attributes - id, group_id, field_id, value, hibernate_version_number.
> >
> > Any ideas?
> >
> > TIA
> >
> > Loris
> >
> > On Thu, 2009-02-05 at 16:21 -0500, Chris Hyzer wrote:
> > > Ok, the workaround isn’t working, lets fix the real issues first...
> > >
> > > Those two bugs are fixed in the 1.4 branch, can you get latest from
> > 1.4 branch?
> > >
> > > https://bugs.internet2.edu/jira/browse/GRP-219
> > > https://bugs.internet2.edu/jira/browse/GRP-220
> > >
> > > cvs
> > > -d:pserver::/home/cvs/i2mi
> > > login
> > > cvs
> > > -d:pserver::/home/cvs/i2mi
> > > export -r
> > GROUPER_1_4_BRANCH grouper
> > >
> > > Now we should be able to do this the original way, with a postInsert
> > hook, and group.addType.
> > >
> > > Here is my testcase:
> > >
> > > public void groupPostInsert(HooksContext hooksContext,
> > > HooksGroupBean postInsertBean) {
> > >
> > > super.groupPostInsert(hooksContext, postInsertBean);
> > > try {
> > > Group group = postInsertBean.getGroup();
> > > GroupType fubGroup = GroupTypeFinder.find("fubGroup");
> > > group.addType(fubGroup);
> > > int sequenceNumber = 2;
> > > group.setAttribute("gid", sequenceNumber + "");
> > > group.store();
> > > } catch (Exception e) {
> > > throw new RuntimeException(e.getMessage(), e);
> > > }
> > > }
> > >
> > > Now, to get that "2", you want to use an oracle sequence? You should
> > be able to do something like this:
> > >
> > > int sequenceNumber =
> > HibernateSession.bySqlStatic().select(int.class,
> > > "select someSeq.nextval from dual");
> > >
> > > If you want to put it in a table, you can use hibernate, but unless
> > you are doing a lot of sql, might just want to use sql... if you want
> > hibernate, let me know and I can make an example...
> > >
> > > List<Object> params =
> > GrouperUtil.toList((Object)group.getUuid(), sequenceNumber);
> > > HibernateSession.bySqlStatic().executeSql("insert into
> > some_table (col1, col2) values (?, ?)",
> > > params);
> > >
> > >
> > > OK, all that being said, I think you have another problem... your
> > type has an extra attribute associated with it right (should only have
> > gid, but it also has "id")??? You should be able to run this query:
> > >
> > > select gt.name as type_name, gf.name as field_name,
> > > gf.is_nullable, gf.type as field_type, gf.read_privilege,
> > > gf.write_privilege, gt.is_assignable, gt.is_internal
> > > from grouper_fields gf, grouper_types gt where
> > > gf.grouptype_uuid = gt.id
> > >
> > > You should see that fubGroup has one attribute named "gid". If you
> > see multiple attributes, you can delete those attributes (assuming they
> > aren’t already being used :) ), with gsh... I usually make my group
> > types with java or gsh, not xml, but Im not sure what the issue is...
> > >
> > >
> > https://wiki.internet2.edu/confluence/display/GrouperWG/GrouperShell+(g
> > sh)
> > > typeDelField(type name, field name)
> > >
> > >
> > > Let me know the next step.
> > > Kind regards,
> > >
> > > Chris
> > >
> > >
> > >
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Dr. Loris Bennett
> > > > [mailto:]
> > > > Sent: Thursday, February 05, 2009 6:14 AM
> > > > To: Chris Hyzer
> > > > Cc: Grouper Users Mailing List
> > > > Subject: RE: [grouper-users] RE: Grouper 1.4.0: Using hooks
> > > >
> > > > On Wed, 2009-02-04 at 11:38 -0500, Chris Hyzer wrote:
> > > > > Ok, this is a problem with grouper. In addChildGroup in Stem, it
> > > > assume that the types aren’t saved yet right after the group insert
> > > > (since hooks didn’t exist back then, it was a safe assumption).
> > > > >
> > > > > I added a bug:
> > > > >
> > > > > https://bugs.internet2.edu/jira/browse/GRP-219
> > > > >
> > > > > We will be able to fix this no problem.
> > > > >
> > > > > In the meantime, you have two options:
> > > > >
> > > > > 1. Instead of adding a type, add it to the list of types that the
> > > > calling method will add:
> > > > >
> > > > > FROM:
> > > > > g.addType(fubGroup);
> > > > >
> > > > > TO:
> > > > > g.getTypesDb().add(fubGroup);
> > > > >
> > > > > This seems like the best temporary workaround until we fix the
> > real
> > > > issue. Though this using an internal method, so you should
> > definitely
> > > > switch it out when you get a fixed group. I tried it and it works.
> > > >
> > > > This gives me the error:
> > > >
> > > > 2009-02-05 09:11:54,097: [http-130.133.2.116-9080-
> > Processor21]
> > > > ERROR GrouperCapableAction.execute(281) -
> > > > java.lang.RuntimeException: edu.internet2.mid
> > > > dleware.grouper.exception.SchemaException: invalid group
> > type:
> > > > for group name: test:abc123,
> > > > GroupType[creatorUuid=b0bb6118-c6b9-4d37-8257-61dcee19b4c
> > > >
> > > >
> > 6,createTime=1231229012373,fields=12,isAssignable=false,isInternal=fals
> > > > e,name=base,uuid=fc8eff6c-6812-4a10-8891-133df83bfbb5]:extension
> > > >
> > > > The UI says that the group was saved successfully, but also that an
> > > > error occurred. When I click on the group in the UI to get the
> > group
> > > > summary, I get the standard error message.
> > > >
> > > > So I tried the second method (see below) ...
> > > >
> > > > > ################################
> > > > >
> > > > > -or- 2. Do a postCommitInsert hook. This will not be in the
> > same
> > > > transaction, but all the work of adding the group will be done, so
> > you
> > > > are safe to add a type.
> > > > > Again, if you pick this, then you might want to switch it back
> > when
> > > > you get a fixed grouper. I tried this and it didn’t commit the
> > changes
> > > > (something about post
> > > > > commit puts it in a transaction that doesn’t get committed). I
> > made
> > > > another bug:
> > > > >
> > > > > https://bugs.internet2.edu/jira/browse/GRP-220
> > > > >
> > > > > The workaround here is to just make a new transaction that will
> > > > commit when done. I tested it and it works:
> > > > >
> > > > > FROM:
> > > > > public void groupPostInsert(HooksContext hooksContext,
> > > > HooksGroupBean postInsertBean) {
> > > > >
> > > > > TO:
> > > > > public void groupPostCommitInsert(HooksContext hooksContext,
> > > > HooksGroupBean postInsertBean) {
> > > > >
> > > > > FROM:
> > > > > g.addType(fubGroup);
> > > > >
> > > > > TO:
> > > > > final Group G = g;
> > > > > final GroupType FUB_GROUP = fubGroup;
> > > > > HibernateSession.callbackHibernateSession(
> > > > > GrouperTransactionType.READ_WRITE_NEW, new
> > > > HibernateHandler() {
> > > > >
> > > > > public Object callback(HibernateSession
> > hibernateSession)
> > > > > throws GrouperDAOException {
> > > > > try {
> > > > > G.addType(FUB_GROUP);
> > > > > } catch (Exception e) {
> > > > > throw new RuntimeException(e);
> > > > > }
> > > > > return null;
> > > > > }
> > > > >
> > > > > });
> > > > >
> > > >
> > > > This works. The group type is added with the attributes
> > > >
> > > > gid <empty>
> > > > id <same as uuid>
> > > >
> > > > However, my definition of the group type looks like
> > > >
> > > > <registry>
> > > > <metadata>
> > > > <groupTypesMetaData>
> > > > <groupTypeDef name='fubGroup'>
> > > > <field name='gid' required='false' type='attribute'
> > > > readPriv='read' writePriv='admin'/>
> > > > </groupTypeDef>
> > > > </groupTypesMetaData>
> > > > </metadata>
> > > > </registry>
> > > >
> > > > so where does 'id' come from?
> > > >
> > > > > Let me know if you need more help.
> > > >
> > > > Another thing I am not sure about is how I would do an insert into
> > a
> > > > table such as "fub_group_ids" to get a gid from a sequence which I
> > can
> > > > then write into the 'gid' field of my customised type. I am not too
> > > > familiar with hibernate, but assume this would be the way to go,
> > right?
> > > >
> > > > Thanks for all your help,
> > > >
> > > > Loris
> > > >
> > > > > Kind regards,
> > > > > Chris
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Dr. Loris Bennett
> > > > > > [mailto:]
> > > > > > Sent: Wednesday, February 04, 2009 6:08 AM
> > > > > > To: Chris Hyzer
> > > > > > Cc: Grouper Users Mailing List
> > > > > > Subject: RE: [grouper-users] RE: Grouper 1.4.0: Using hooks
> > > > > >
> > > > > > Hi Chris,
> > > > > >
> > > > > > I tried the failsafe call, but got the same errors. 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:xxx,uuid=d559eccd-9be2-4555-ac1a-40ee72bb106e],
> > > > > > memberDto: 'd559eccd-9be2-4555-ac1a-
> > 40ee72bb106e'/'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'-
> > > > > > >'90e883dd-326e-40f1-9416-805d2770a9d6', , Problem in
> > > > HibernateSession:
> > > > > > HibernateSession: isNew: false, isReadonly: false,
> > > > > > grouperTransactionType: READ_WRITE_NEW'.
> > > > > >
> > > > > > I have attached an extract from the grouper log and the code.
> > > > > >
> > > > > > Thanks for all your help.
> > > > > >
> > > > > > Loris
> > > > > >
> > > > > >
> > > > > > On Tue, 2009-02-03 at 23:32 -0500, Chris Hyzer wrote:
> > > > > > > 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.Exi
> > > > > > > > sts , 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:loris.bennett@fu-
> > berlin.de]
> > > > > > > > >
> > > > > > > > > > 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:loris.bennett@fu-
> > > > berlin.de]
> > > > > > > > >
> > > > > > > > > > > > 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
> > > > > > > > >
> > > > > > > > > > > > Email
> > > > > > > > > > > >
> > > > > > > > >
> > > > > > > > > > > > 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
> > > > > > > > >
> > > > > > > > > > Email
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > > > 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
> > > > > > > > Email
> > > > > > > >
> > > > > > > > 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
> > > > > > Email
> > > > > >
> > > > > > 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
> > > > Email
> > > >
> > > > 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
> > Email
> >
> > 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
Email

Web www.zedat.fu-berlin.de




Archive powered by MHonArc 2.6.16.

Top of Page