Package org.apache.jetspeed.om.portlet

Examples of org.apache.jetspeed.om.portlet.Preference


    @Override
    protected Preference load()
    {
        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
        PortletDefinition def = app.getPortlet(paNodeBean.getName());
        Preference preference = (Preference) def.getPortletPreferences().getPortletPreference(name);
        return preference;
    }
View Full Code Here


        }
    }

    private boolean addPref(String prefName, String keywords, Preferences prefs)
    {
        Preference pref = prefs.getPortletPreference(prefName);
        if (pref == null)
        {
            pref = prefs.addPreference(prefName);
            pref.setReadOnly(false);
            pref.addValue(keywords);           
        }
        else
        {
            return modifyPref(prefName, keywords, prefs);          
        }       
View Full Code Here

        return true;
    }
   
    private boolean modifyPref(String prefName, String keywords, Preferences prefs)
    {
        Preference pref = prefs.getPortletPreference(prefName);
        if (pref == null)
        {
            return addPref(prefName, keywords, prefs);
        }
        else
        {
            List<String> values = pref.getValues();
            if (!values.get(0).equals(keywords))
            {
                values.set(0, keywords);
                return true;
            }
View Full Code Here

            {
                return false;               
            }
            if (val > max)
                return false;
            Preference pref = (Preference) prefs.getPortletPreference(prefName);
            List<String> values = pref.getValues();
            if(!values.get(0).equals(param))
            {
                values.set(0, param);
                return true;
            }                          
View Full Code Here

                        ((AbstractAdminWebApplication) getApplication()).getServiceLocator()
                        .getService(CommonPortletServices.CPS_PORTLET_PREFERENCES_PROVIDER);
                   
                    if (newName != null && newValue != null)
                    {
                        Preference pref = def.getPortletPreferences().addPreference(newName);
                        pref.addValue(newValue);
                       
                        prefProvider.storeDefaults(def, pref);
                       
                        newName = null;
                        newValue = null;
View Full Code Here

        Map<String, PortletPreference> prefMap = PortletDefinitionImpl.portletPreferencesProvider.retrieveDefaultPreferences(this);       
        Preferences preferences = new PreferencesImpl();
        List<Preference> list = preferences.getPortletPreferences();
        for (PortletPreference pref : prefMap.values())
        {
            Preference p = preferences.addPreference(pref.getName());
            p.setReadOnly(pref.isReadOnly());
            for (String s : pref.getValues())
            {
                p.addValue(s);
            }
        }
        return preferences;
    }
View Full Code Here

        {
            throw new FailedToStorePortletDefinitionException(e);
        }
        for (Preference pref : source.getPortletPreferences().getPortletPreferences())
        {
            Preference copyPref = copy.addDescriptorPreference(pref.getName());
            copyPref.setReadOnly(pref.isReadOnly());
           
            for (String value : pref.getValues())
            {
                copyPref.addValue(value);
            }           
        }
        try
        {
            preferenceService.storeDefaults(copy, (Preferences)null);
View Full Code Here

                        ((AbstractAdminWebApplication) getApplication()).getServiceLocator()
                        .getService(CommonPortletServices.CPS_PORTLET_PREFERENCES_PROVIDER);
                   
                    if (newName != null && newValue != null)
                    {
                        Preference pref = def.getPortletPreferences().addPreference(newName);
                        pref.addValue(newValue);
                       
                        prefProvider.storeDefaults(def, pref);
                       
                        newName = null;
                        newValue = null;
View Full Code Here

    @Override
    protected Preference load()
    {
        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
        PortletDefinition def = PortletApplicationUtils.getPortletOrClone(app, paNodeBean.getName());
        Preference preference = (Preference) def.getPortletPreferences().getPortletPreference(name);
        return preference;
    }
View Full Code Here

            for (Map.Entry<String, List<String>> entry : clonePortletInfo.getPortletPreferences().entrySet())
            {
                String prefName = entry.getKey();
                List<String> prefValues = entry.getValue();
                Preferences prefs = clone.getPortletPreferences();
                Preference pref = prefs.getPortletPreference(prefName);
               
                if (pref == null)
                {
                    pref = prefs.addPreference(prefName);
                }
               
                List<String> values = pref.getValues();
                values.clear();
                values.addAll(prefValues);
               
                prefProvider.storeDefaults(clone, pref);
            }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.portlet.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.