5 Replies Latest reply on Sep 14, 2007 5:25 PM by chennaikar

    Updated Preferences not available

    chennaikar

      Hi,

      I am trying to get the updated preferences from the PortletPreferences interfaces, but I keep getting the values set in the xml.

      Here is my Portlet code

      public void doView(RenderRequest request, RenderResponse response) {
      .........
      System.out.println("Name is:"+prefs.getValue("name", "AAAA"));
      .........
      }
      


      Here is my portlet-instances.xml
      <deployments>
       <deployment>
       <instance>
       <instance-id>myInstance</instance-id>
       <portlet-ref>MyPortlet</portlet-ref>
       <preferences>
       <preference>
       <name>name</name>
       <value>YYYY</value>
       </preference>
       </preferences>
       </instance>
       </deployment>
      </deployments>
      


      When I execute the portlet I get
      Name is:YYYY
      


      When I log into admin portal and change the value of the preference to "ZZZZ" and execute the portlet I sill get
      Name is:YYYY
      


      What am I missing.
      Please help.

      TIA
      Chennaikar

        • 1. Re: Updated Preferences not available
          peterj

          Preferences are stored in the database based on the portlet instance and user. If the user already viewed the protlet instance, then the database probably already contains the older preference.

          I know that if you start with a clean installation (new database, new portal install), and have preferences defined in portlet-instances.xml, that those preferences will show up.

          • 2. Re: Updated Preferences not available
            chennaikar

            Thanks for the reply Peter.

            I am looking for a solution where changes to portlet preferences do not require a server restart / clean install.
            Is there any way to do this?

            Also I want the changes to reflect for all users, I thought that logging in as Admin and changing the preferences in the admin portal would push the changes to all the users.
            Is this not the case?

            • 3. Re: Updated Preferences not available
              chennaikar

              Just a couple of clarifications.

              1) I am trying to have some bhevaiour like a Message Portlet. So the Portl admins can change the message displayed to all portal users. Non-admin portal users will not be able to edit portlets to set user specific preferences.

              So one day the admins may set the preferences to show "Good Day" and the next day they may change the preferences to show "Great Day!!".

              2) The admin user logs onto admin portal, changes Instance Window level preferences.

              • 4. Re: Updated Preferences not available
                peterj

                Once the user has changed the preferences, there is no way I know of to enable the admin to update those preferences. Perhaps you should look into a solution other than preferences.

                • 5. Re: Updated Preferences not available
                  chennaikar

                  No user will be updating the preferences. Edit option is not provided to users for this portlet.

                  Is there some configuration that can stop the portal from storing data per user?
                  If not is there any utility / api that can delete all user data for a given portlet? (To wipe off the caching, in a way.)