Package org.apache.pluto.om.common

Examples of org.apache.pluto.om.common.Preference


                deletePrefNamesPstmt.setString(3, chanDescId);
                deletePrefNamesPstmt.executeUpdate();
               
                //Loop through the prefs, inserting each name then the values
                for (Iterator prefItr = prefs.iterator(); prefItr.hasNext();) {
                    final Preference pref = (Preference)prefItr.next();
                    int prefId = -1;
                   
                    insertPrefNamePstmt.setInt(1, userId);
                    insertPrefNamePstmt.setInt(2, layoutId);
                    insertPrefNamePstmt.setString(3, chanDescId);
                    insertPrefNamePstmt.setString(4, pref.getName());
                   
                    //Use the list of removed ids to re-use IDs before generating new ones
                    if (prefIds.size() > 0) {
                        prefId = ((Integer)prefIds.removeLast()).intValue();
                    }
                    else {
                        final ICounterStore counterStore = CounterStoreFactory.getCounterStoreImpl();
                       
                        try {
                            prefId = counterStore.getIncrementIntegerId(UP_PORTLET_PREFERENCE_VALUE);
                        }
                        catch (Exception e) {
                            counterStore.createCounter(UP_PORTLET_PREFERENCE_VALUE);
                            prefId = counterStore.getIncrementIntegerId(UP_PORTLET_PREFERENCE_VALUE);
                        }
                    }
                   
                    insertPrefNamePstmt.setInt(5, prefId);
                   
                    //Insert the name row
                    if (log.isDebugEnabled())
                        log.debug("RDBMPortletPreferencesStore::setEntityPreferences(): " + insertPrefName);
                    insertPrefNamePstmt.executeUpdate();
                   
                    //For each value a row will be inserted in the values table
                    for (final Iterator valueItr = pref.getValues(); valueItr.hasNext();) {
                        String value = (String)valueItr.next();
                        if (log.isDebugEnabled())
                            log.debug("RDBMPortletPreferencesStore::setEntityPreferences(): " + insertPrefValue);
                        insertPrefValuePstmt.setInt(1, prefId);
                        insertPrefValuePstmt.setString(2, PREFIX + value);
View Full Code Here


    }

    public void addAll(PreferenceSet preferences) {
        Iterator iter = preferences.iterator();
        while (iter.hasNext()) {
            Preference preference = (Preference)iter.next();
            this.preferences.put(preference.getName(), preference);
        }
    }
View Full Code Here

        prefs.remove(pref.getName());
    }

    public Preference remove(String name)
    {
        Preference pref = (Preference) prefs.remove(name);
        return pref;
    }
View Full Code Here

        if (fragment != null && fragment.getPreferences() != null)
        {
            Iterator itr = fragment.getPreferences().iterator();       
            while(itr.hasNext())
            {
                Preference pref = (Preference) itr.next();
                prefs.put(pref.getName(), pref);
            }
        }
    }
View Full Code Here

      Iterator it = preferenceSet.iterator();
      JSNVPElements v = new JSNVPElements();

      while (it.hasNext())
      {
        Preference pref = (Preference) it.next();
        String name = pref.getName();
        Iterator ii = pref.getValues();
        while (ii.hasNext())
        {
          Object o = ii.next();
          v.add(name, o.toString());
        }
View Full Code Here

     
      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);
View Full Code Here

        assertNotNull(pd);

        assertNotNull(pd.getPreferenceSet());

        Preference pref1 = pd.getPreferenceSet().get("pref1");

        assertNotNull(pref1);

        Iterator itr = pref1.getValues();
        int count = 0;
        while (itr.hasNext())
        {
            count++;
            System.out.println("Value " + count + "=" + itr.next());
View Full Code Here

      Iterator it = preferenceSet.iterator();
      JSNVPElements v = new JSNVPElements();

      while (it.hasNext())
      {
        Preference pref = (Preference) it.next();
        String name = pref.getName();
        Iterator ii = pref.getValues();
        while (ii.hasNext())
        {
          Object o = ii.next();
          v.add(name, o.toString());
        }
View Full Code Here

     
      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);
View Full Code Here

        // if managing the first layer of the preferences
        // modifiable returns always true (for administration purposes)
        if (preferenceSetList.size() != 1)
        { // otherwise
            // iterate through all preferences
            Preference preference = null;
            ListIterator iter = preferenceSetList.listIterator();
            while ((preference == null) && (iter.hasNext()))
            {
                preference = ((PreferenceSet)iter.next()).get(key);
            }
            if (preference != null)
            {
                isReadOnly = preference.isReadOnly();
            }
        }
        return isReadOnly;
    }
View Full Code Here

TOP

Related Classes of org.apache.pluto.om.common.Preference

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.