You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by "Vitaly Baranovsky (JIRA)" <je...@portals.apache.org> on 2007/08/02 16:23:52 UTC

[jira] Updated: (JS2-765) Developed solution to achieve strictly old way behaviour of portlet preferences in 2.1.2 version (like 2.0, preference per entity, not per user)

     [ https://issues.apache.org/jira/browse/JS2-765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vitaly Baranovsky updated JS2-765:
----------------------------------

    Attachment: jetspeed-registry-2.1.2-oldwayprefs.jar

I've attached modification jetspeed-registry-2.1.2.jar with my changes.

I've posted my solution to JIRA, not to jetspeed-dev mailing list, because I can't attach file to mailing list

> Developed solution to achieve strictly old way behaviour of portlet preferences in 2.1.2 version (like 2.0, preference per entity, not per user)
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JS2-765
>                 URL: https://issues.apache.org/jira/browse/JS2-765
>             Project: Jetspeed 2
>          Issue Type: New Feature
>            Reporter: Vitaly Baranovsky
>         Attachments: jetspeed-registry-2.1.2-oldwayprefs.jar
>
>
> Good day!
> There is a quote from the post:
> http://www.nabble.com/forum/ViewPost.jtp?post=9047332&framed=y:
> "
> Do you still want users to override these default prefs, or strictly   
> the "old way"? 
> If you want the old way, 
> what about if I changed the PortletEntityImpl.getPreferenceSet to use   
> a conditional configuration: 
> if (PREFS_PER_USER) 
>                  prefNodePath =   
> MutablePortletEntity.PORTLET_ENTITY_ROOT + "/" + getId() +"/"+   
> principal.getName() +"/" 
>                          + PrefsPreference.PORTLET_PREFERENCES_ROOT; 
> else 
>                  prefNodePath =   
> MutablePortletEntity.PORTLET_ENTITY_ROOT + "/" + getId() +"/"+   
> NO_PRINCIPAL +"/" 
>                          + PrefsPreference.PORTLET_PREFERENCES_ROOT; 
> "
> But there is one moment. If just make this changes into the code, call to method mergePreferencesSet in method getPreferenceSet will take place anyway. This method makes big jetspeed performance degradation in this situation. So, I've commented out call of this method.
> So, method PortletEntityImpl.getPreferenceSet has to be:
>     public PreferenceSet getPreferenceSet(Principal principal)
>     {
>         PrefsPreferenceSetImpl preferenceSet = (PrefsPreferenceSetImpl) perPrincipalPrefs.get(principal);
>         try
>         {
>             if (preferenceSet == null || !dirty)
>             {
>                 String principalName;
>                 
>                 if (pac.isMergeSharedPreferences())
>                 {
>                     principalName = NO_PRINCIPAL;
>                 }else{
>                     principalName = principal.getName();
>                 }
>                 String prefNodePath = MutablePortletEntity.PORTLET_ENTITY_ROOT + "/" + getId() +"/"+ principalName +"/"
>                         + PrefsPreference.PORTLET_PREFERENCES_ROOT;
>                 Preferences prefNode = Preferences.userRoot().node(prefNodePath);               
>                 preferenceSet = new PrefsPreferenceSetImpl(prefNode);
>                 perPrincipalPrefs.put(principal, preferenceSet);
>                 /*
>                 if (pac.isMergeSharedPreferences())
>                 {
>                     mergePreferencesSet(preferenceSet);
>                 }*/
>                 backupValues(preferenceSet);
>                 dirty = true;
>             }
>         }
>         catch (BackingStoreException e)
>         {
>             String msg = "Preference backing store failed: " + e.toString();
>             IllegalStateException ise = new IllegalStateException(msg);
>             ise.initCause(e);
>             throw ise;
>         }
>         return preferenceSet;
>     }
> This solution can turn back jetspeed to strictly old way behaviour of portlet preferences in jetspeed 2.1.2. 
> So, preferences will be per entity, not per user, if setting up parameter to true in the registry.xml spring assembly for the portletEntityAccessImpl component: 
>      <!-- 
>              All preferences were shared. With JS2-449, preferences   
> are now 
>              stored 'per user'. The username is stored in the   
> preferences FULL_PATH 
>              To turn on mergeSharedPreferences configure this   
> property to true 
>              This will NOT turn off per user prefs, 
>               but instead merge with them, where user prefs override. 
>              boolean 
>            --> 
>          <constructor-arg type="boolean"> 
>              <value>false</value> 
>          </constructor-arg> 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org