Yes I believe that would be the fix. I test the same thing for the Role Peer and it appears to be working correctly. I believe the change needs to be made for country and language for all the profile peers.
thanks for the quick response. marcus -----Original Message----- From: David Sean Taylor [mailto:[EMAIL PROTECTED]] Sent: Monday, November 18, 2002 4:19 PM To: Jetspeed Developers List Subject: RE: DBPSML fallback logic is incorrect > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 18, 2002 1:30 PM > To: [EMAIL PROTECTED] > Subject: DBPSML fallback logic is incorrect > > > Hello, > We are using the DBPSML and rely on the fallback logic to allow for > different role psmls based on different locales. At first this appears to > work correctly, until the user attempts to access a psml not present for > that users locale. The logic pulls the psml from a different locale > incorrectly allowing the user to see the profile. > > Example: > PAGE MEDIA_TYPE LANGUAGE COUNTRY PROFILE > --------------- ---------- -------- ------- ------- > Home.psml html en US ... > Home.psml html en CA ... > Shopping.psml html en US ... > Reference.psml html en null ... > > In the above example if the user with locale en_CA logs in and attempts to > access /page/Shopping they would be served the en_US Shopping psml. The > reason for this is in the SQL. > > - Returning locator string: > Role:Role100$Page:Shopping.psml$MediaType:html$Country:CA$Language:en > SELECT JETSPEED_ROLE_PROFILE.PSML_ID, JETSPEED_ROLE_PROFILE.ROLE_NAME, > JETSPEED_ROLE_PROFILE.MEDIA_TYPE, JETSPEED_ROLE_PROFILE.LANGUAGE, > JETSPEED_ROLE_PROFILE.COUNTRY, JETSPEED_ROLE_PROFILE.PAGE, > JETSPEED_ROLE_PROFILE.PROFILE > FROM JETSPEED_ROLE_PROFILE > WHERE (JETSPEED_ROLE_PROFILE.LANGUAGE='en') AND > (JETSPEED_ROLE_PROFILE.ROLE_NAME='Role100') AND > (JETSPEED_ROLE_PROFILE.PAGE='Shopping.psml') AND > (JETSPEED_ROLE_PROFILE.COUNTRY='CA') AND > (JETSPEED_ROLE_PROFILE.MEDIA_TYPE='html') > > **Null returned so it falls back by removing the country from the locator > > - Returning locator string: > Role:Role100$Page:Shopping.psml$MediaType:html$Language:en > SELECT JETSPEED_ROLE_PROFILE.PSML_ID, JETSPEED_ROLE_PROFILE.ROLE_NAME, > JETSPEED_ROLE_PROFILE.MEDIA_TYPE, JETSPEED_ROLE_PROFILE.LANGUAGE, > JETSPEED_ROLE_PROFILE.COUNTRY, JETSPEED_ROLE_PROFILE.PAGE, > JETSPEED_ROLE_PROFILE.PROFILE > FROM JETSPEED_ROLE_PROFILE > WHERE (JETSPEED_ROLE_PROFILE.LANGUAGE='en') AND > (JETSPEED_ROLE_PROFILE.ROLE_NAME='Role100') AND > (JETSPEED_ROLE_PROFILE.PAGE='Shopping.psml') AND > (JETSPEED_ROLE_PROFILE.MEDIA_TYPE='html') > > **The en_US Shopping.psml row meets the above criteria so it is returned. > The SQL for this should be: > > SELECT JETSPEED_ROLE_PROFILE.PSML_ID, JETSPEED_ROLE_PROFILE.ROLE_NAME, > JETSPEED_ROLE_PROFILE.MEDIA_TYPE, JETSPEED_ROLE_PROFILE.LANGUAGE, > JETSPEED_ROLE_PROFILE.COUNTRY, JETSPEED_ROLE_PROFILE.PAGE, > JETSPEED_ROLE_PROFILE.PROFILE > FROM JETSPEED_ROLE_PROFILE > WHERE (JETSPEED_ROLE_PROFILE.LANGUAGE='en') AND > (JETSPEED_ROLE_PROFILE.ROLE_NAME='Role100') AND > (JETSPEED_ROLE_PROFILE.PAGE='Shopping.psml') AND > (JETSPEED_ROLE_PROFILE.COUNTRY IS NULL) AND > (JETSPEED_ROLE_PROFILE.MEDIA_TYPE='html') > > **Note the selection for country being null. This causes the en_US > Shopping.psml to not meet the criteria. > > I believe the current behavior is incorrect and needs to be fixed. It > appears the fix requires a change the ProfilePeer classes to add the null > value to the criteria. Im looking at JetspeedUserProfilePeer. Could this change work (for all three ProfilePeer sources): From if (country != null && country.length() > 0) { criteria.add(COUNTRY, country); } To criteria.add(COUNTRY, country); I wrote a unittest to ensure that Torque generates the SQL correctly, and it does. Just added a unit test: org.apache.jetspeed.services.psmlmanager/TestDbCriteria.java AND JETSPEED_USER_PROFILE.COUNTRY IS NULL -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
