[gatein-issues] [JBoss JIRA] (GTNPORTAL-3013) UserProfileDAOImpl not distinguishing creating and updating user profile when firing preSave/postSave events
RH Bugzilla Integration (JIRA)
jira-events at lists.jboss.org
Thu Aug 15 09:11:26 EDT 2013
[ https://issues.jboss.org/browse/GTNPORTAL-3013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12797067#comment-12797067 ]
RH Bugzilla Integration commented on GTNPORTAL-3013:
----------------------------------------------------
Tomas Kyjovsky <tkyjovsk at redhat.com> made a comment on [bug 947956|https://bugzilla.redhat.com/show_bug.cgi?id=947956]
Verified with 6.1.0.ER01.1 and ER04 using a custom UserEventListener.
Creating new user "test":
15:07:08,804 INFO [stdout] (http-/127.0.0.1:8080-1) preSave(user:test, isNew:true)
15:07:08,804 INFO [stdout] (http-/127.0.0.1:8080-1) preSave(user:test, isNew:true)
15:07:08,830 INFO [stdout] (http-/127.0.0.1:8080-1) postSave(user:test, isNew:true)
15:07:08,894 INFO [stdout] (http-/127.0.0.1:8080-1) postSave(user:test, isNew:true)
Updating created user "test":
15:07:18,435 INFO [stdout] (http-/127.0.0.1:8080-1) preSave(user:test, isNew:false)
15:07:18,435 INFO [stdout] (http-/127.0.0.1:8080-1) preSave(user:test, isNew:false)
15:07:18,443 INFO [stdout] (http-/127.0.0.1:8080-1) postSave(user:test, isNew:false)
15:07:18,447 INFO [stdout] (http-/127.0.0.1:8080-1) postSave(user:test, isNew:false)
> UserProfileDAOImpl not distinguishing creating and updating user profile when firing preSave/postSave events
> ------------------------------------------------------------------------------------------------------------
>
> Key: GTNPORTAL-3013
> URL: https://issues.jboss.org/browse/GTNPORTAL-3013
> Project: GateIn Portal
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: Identity integration
> Affects Versions: 3.6.0.Beta01
> Reporter: Marek Posolda
> Assignee: Marek Posolda
> Fix For: 3.6.0.Beta02
>
>
> org.exoplatform.services.organization.idm.UserProfileDAOImpl; the following is a code excerpt of the file included in the community version of the Maven artefact org.exoplatform.portal:exo.portal.component.identity:3.3.0-GA
> // void createUserProfileEntry(UserProfile up, IdentitySession session) throws Exception
> // {
> // UserProfileData upd = new UserProfileData();
> // upd.setUserProfile(up);
> // session.save(upd);
> // session.flush();
> // cache_.remove(up.getUserName());
> // }
> public void saveUserProfile(UserProfile profile, boolean broadcast) throws Exception
> {
> if (broadcast)
> {
> preSave(profile, true);
> }
> setProfile(profile.getUserName(), profile);
> if (broadcast)
> {
> postSave(profile, true);
> }
> }
> As you can see, the preSave() method is always called with "true". However, saveUserProfile() is the only available method for persisting UserProfile objects. From the commented-out createUserProfileEntry() method, I draw the conclusion that at some point, there was a distinction between methods to call for new and existing UserProfiles (just as there is for Users in the UserDAOImpl in the same package - there are a createUser() and a saveUser()).
> Where all this breaks down is in the listeners; upon saving the UserProfile, I want to send either a save or an update message over JMS to a SOA-P application that transforms the message and forwards it to a mainframe application that needs to know about user creation and modification. I need to pick the correct message format, but as it turns out, I can't use the isNew parameter to reliably determine which one to choose.
> I have tried to work around the problem by creating the UserProfile first and the User second, and sync from the User Listener, since the User preSave() does receive a correct value for isNew; however, Hibernate won't let me: new UserProfiles can not be saved if the User they are associated with does not yet exist in the database; they are a dependent entity.
> Can you provide a version of the Identity Component that can distinguish between updating and saving UserProfile objects, or a suitable workaround to that end?
> Version-Release number of selected component (if applicable):
> EPP 5
> JPP 6
> How reproducible:
> always
> Steps to Reproduce:
> please see attached customer case
>
> Actual results:
> true as the parameter even with update
> Expected results:
> true/false depending on create or update
> Additional info:
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the gatein-issues
mailing list