Package org.apache.jetspeed.om.preference.impl

Examples of org.apache.jetspeed.om.preference.impl.PrefsPreferenceSetImpl


    }

    public void removePortletEntity( PortletEntity portletEntity ) throws PortletEntityNotDeletedException
    {
        PrefsPreferenceSetImpl prefsSet  = (PrefsPreferenceSetImpl) portletEntity.getPreferenceSet();
        getPersistenceBrokerTemplate().delete(portletEntity);
        try
        {
            prefsSet.clear();
        }
        catch (BackingStoreException e)
        {
            throw new PortletEntityNotDeletedException("Failed to remove preferences for portlet entity "+portletEntity.getId()+".  "+e.getMessage(), e);
        }
View Full Code Here


     * @param prefSet
     * @throws IOException
     */
    public void storePreferenceSet( PreferenceSet prefSet, PortletEntity entity ) throws IOException
    {
        PrefsPreferenceSetImpl preferenceSet = (PrefsPreferenceSetImpl) prefSet;
        try
        {           
            getPersistenceBrokerTemplate().store(entity);
            if (preferenceSet != null)
            {
                preferenceSet.flush();
            }           

        }
        catch (Exception e)
        {
View Full Code Here

        return persistenceStore;
    }

    public void storePreferenceSet( PreferenceSet prefSet, PortletEntity entity ) throws IOException
    {
        PrefsPreferenceSetImpl preferenceSet = (PrefsPreferenceSetImpl) prefSet;
        try
        {
            prepareTransaction(persistenceStore);
            persistenceStore.lockForWrite(entity);
            if (preferenceSet != null)
            {
                preferenceSet.flush();
            }
            persistenceStore.getTransaction().checkpoint();

        }
        catch (Exception e)
View Full Code Here

                {
                    throw new IllegalStateException("Portlet Application must be defined before preferences can be accessed");
                }
               
                Preferences prefNode = PrefsPreference.createPrefenceNode(this);
                preferenceSet = new PrefsPreferenceSetImpl(prefNode);
            }
        }
        catch (BackingStoreException e)
        {
            String msg = "Preference backing store failed: " + e.toString();
View Full Code Here

    JSEntityPreference permission = new JSEntityPreference();
    permission.setName(child);

    try
    {
      PrefsPreferenceSetImpl preferenceSet = new PrefsPreferenceSetImpl(
          prefNode);
      if (preferenceSet.size() == 0)
        return null;
      Iterator it = preferenceSet.iterator();
      JSNVPElements v = new JSNVPElements();

      while (it.hasNext())
      {
        Preference pref = (Preference) it.next();
View Full Code Here

      return ;

    JSNVPElements prefList = preference.getPreferences();
    try
    {
      PrefsPreferenceSetImpl preferenceSet = new PrefsPreferenceSetImpl(
          prefNode);
     
      Iterator it = prefList.getMyMap().keySet().iterator();
     
      while (it.hasNext())
      {
        String key = (String)it.next();
        String value = (String)prefList.getMyMap().get(key);
        Preference p = preferenceSet.get(key);
        if ((p == null) || (overwrite))
        {
         
          Vector v = new Vector();
          v.add(value);
          preferenceSet.add(key, v);
System.out.println("Entity " + entity.getId() + " updated with preference " + key + "=" + value);         
        }
      }
      preferenceSet.flush();
      return;
    } catch (Exception e)
    {
      e.printStackTrace();
      return;
View Full Code Here

        return getPreferenceSet(currentUser);
    }

    public PreferenceSet getPreferenceSet(Principal principal)
    {
        PrefsPreferenceSetImpl preferenceSet = (PrefsPreferenceSetImpl) perPrincipalPrefs.get(principal);
        try
        {
            if (preferenceSet == null || !dirty)
            {
                String prefNodePath = MutablePortletEntity.PORTLET_ENTITY_ROOT + "/" + getId() +"/"+ principal.getName() +"/"
                        + PrefsPreference.PORTLET_PREFERENCES_ROOT;
                Preferences prefNode = Preferences.userRoot().node(prefNodePath);              
                preferenceSet = new PrefsPreferenceSetImpl(prefNode);
                perPrincipalPrefs.put(principal, preferenceSet);
                if (pac.isMergeSharedPreferences())
                {
                    mergePreferencesSet(preferenceSet);
                }
View Full Code Here

                                getId() +"/"+ NO_PRINCIPAL +"/" +
                                PrefsPreference.PORTLET_PREFERENCES_ROOT;               
        Preferences sharedNode = Preferences.userRoot().node(sharedNodePath);    
        if (sharedNode == null)
            return;
        PrefsPreferenceSetImpl sharedSet = new PrefsPreferenceSetImpl(sharedNode);
        if (sharedSet.size() == 0)
            return;
        Set names = userPrefSet.getNames();
        Iterator sharedPrefs = sharedSet.iterator();
        int index = 0;
        while (sharedPrefs.hasNext())
        {
            PrefsPreference sharedPref = (PrefsPreference) sharedPrefs.next();
// this seems limiting, removing if (names.contains(sharedPref.getName()))
View Full Code Here

    JSEntityPreference permission = new JSEntityPreference();
    permission.setName(child);

    try
    {
      PrefsPreferenceSetImpl preferenceSet = new PrefsPreferenceSetImpl(
          prefNode);
      if (preferenceSet.size() == 0)
        return null;
      Iterator it = preferenceSet.iterator();
      JSNVPElements v = new JSNVPElements();

      while (it.hasNext())
      {
        Preference pref = (Preference) it.next();
View Full Code Here

    
     */

    public void reset() throws IOException
    {
        PrefsPreferenceSetImpl preferenceSet = (PrefsPreferenceSetImpl) perPrincipalPrefs.get(getPrincipal());
        try
        {
            if (originalValues != null && preferenceSet != null)
            {
                Iterator prefs = preferenceSet.iterator();

                while (prefs.hasNext())
                {
                    PrefsPreference pref = (PrefsPreference) prefs.next();
                    if (originalValues.containsKey(pref.getName()))
                    {
                        pref.setValues((String[]) originalValues.get(pref.getName()));
                    }
                    else
                    {
                        preferenceSet.remove(pref);
                    }
                    preferenceSet.flush();
                }

                Iterator keys = originalValues.keySet().iterator();
                while (keys.hasNext())
                {
                    String key = (String) keys.next();
                    if (preferenceSet.get(key) == null)
                    {
                        preferenceSet.add(key, Arrays.asList((String[]) originalValues.get(key)));
                    }
                }
            }
            dirty = false;
            backupValues(preferenceSet);
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.preference.impl.PrefsPreferenceSetImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.