[gatein-issues] [JBoss JIRA] (GTNPORTAL-3013) UserProfileDAOImpl not distinguishing creating and updating user profile when firing preSave/postSave events

Marek Posolda (JIRA) jira-events at lists.jboss.org
Mon May 13 13:22:06 EDT 2013


Marek Posolda created GTNPORTAL-3013:
----------------------------------------

             Summary: 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