Examples of PortletPreferenceImpl


Examples of org.apache.pluto.container.impl.PortletPreferenceImpl

            }
            Map<String,PortletPreference> portletPreferences = new HashMap<String,PortletPreference>();

            for (JahiaPreference currentPreference : foundPreferences) {
                JahiaPortletPreference curPortletPreference = (JahiaPortletPreference) currentPreference.getNode();
                PortletPreferenceImpl portletPreferenceImpl = new PortletPreferenceImpl(curPortletPreference.getPrefName(), curPortletPreference.getValues(), curPortletPreference.getReadOnly());
                portletPreferences.put(portletPreferenceImpl.getName(),portletPreferenceImpl);
            }
            return portletPreferences;
        } catch (JahiaPreferenceProviderException e) {
            logger.error("Error while retrieving portlet preferences", e);
        } catch (RepositoryException e) {
View Full Code Here

Examples of org.apache.pluto.container.impl.PortletPreferenceImpl

            for (Preference pref : prefs.getPortletPreferences()) {
                String[] values = null;
                if (pref.getValues() != null && pref.getValues().size() > 0) {
                    values = pref.getValues().toArray(new String[pref.getValues().size()]);
                }
                preferences.put(pref.getName(), new PortletPreferenceImpl(pref.getName(), values, pref.isReadOnly()));
            }
        }
        return preferences;
    }
View Full Code Here

Examples of org.jasig.portal.portlet.dao.jpa.PortletPreferenceImpl

        boolean override = false;
        if (form.getParameterOverrides().containsKey(key)) {
          override = form.getParameterOverrides().get(key).getValue();
        }
        if (key.startsWith("PORTLET.")) {
          preferenceList.add(new PortletPreferenceImpl(key, !override, new String[]{value}));
        } else {
          channelDef.addParameter(key, value, override);
        }
      }
    }
   
    for (String key : form.getPortletPreferences().keySet()) {
      List<String> prefValues = form.getPortletPreferences().get(key).getValue();
      if (prefValues != null && prefValues.size() > 0) {
        String[] values = prefValues.toArray(new String[prefValues.size()]);
        boolean readOnly = true;
        if (form.getPortletPreferencesOverrides().containsKey(key)) {
          readOnly = !form.getPortletPreferencesOverrides().get(key).getValue();
        }
        preferenceList.add(new PortletPreferenceImpl(key, readOnly, values));
      }
    }
   
    final IPortletDefinition portletDefinition = this.portletDefinitionRegistry.getPortletDefinition(channelDef.getId());
    final IPortletPreferences portletPreferences = portletDefinition.getPortletPreferences();
View Full Code Here

Examples of org.jasig.portal.portlet.dao.jpa.PortletPreferenceImpl

                        final Element valueNode = (Element) valueNodes.item(valueNodeIndex);
                        values.add(XML.getElementText(valueNode).trim());
                    }
                }
               
                final PortletPreferenceImpl portletPreference = new PortletPreferenceImpl(name, readOnly, values.toArray(new String[values.size()]));
                preferences.add(portletPreference);
            }
        }
       
        final IPortletDefinitionRegistry portletDefinitionRegistry = PortletDefinitionRegistryLocator.getPortletDefinitionRegistry();
View Full Code Here

Examples of org.jasig.portal.portlet.dao.jpa.PortletPreferenceImpl

            if (name == null) {
                continue;
            }

            //Convert to a uPortal preference class to ensure quality check and persistence works
            final IPortletPreference preference = new PortletPreferenceImpl(internalPreference);
           
            //If the preference exactly equals a descriptor or definition preference ignore it
            final InternalPortletPreference basePreference = basePreferences.get(name);
            if (preference.equals(basePreference)) {
                continue;
            }
           
            //New preference, add it to the list
            preferencesList.add(preference);
View Full Code Here

Examples of org.jasig.portal.portlet.dao.jpa.PortletPreferenceImpl

       
        final PortletPreferencesDD descriptorPreferences = portletDescriptor.getPortletPreferences();
        if (descriptorPreferences != null) {
            final List<PortletPreferenceDD> descriptorPreferencesList = descriptorPreferences.getPortletPreferences();
            for (final PortletPreferenceDD descriptorPreference : descriptorPreferencesList) {
                final IPortletPreference internaldescriptorPreference = new PortletPreferenceImpl(descriptorPreference);
                preferences.add(internaldescriptorPreference);
            }
        }
       
        return preferences;
View Full Code Here

Examples of org.jasig.portal.portlet.dao.jpa.PortletPreferenceImpl

        if (preferencesList == null) {
            return;
        }

        for (final IPortletPreference definitionPreference : preferencesList) {
            preferencesMap.put(definitionPreference.getName(), new PortletPreferenceImpl(definitionPreference));
        }
    }
View Full Code Here

Examples of org.jasig.portal.portlet.dao.jpa.PortletPreferenceImpl

        final List<IPortletPreference> portletPreferencesList = new ArrayList<IPortletPreference>(preferencesMap.size());
        for (final Entry<String, List<String>> prefEntry : preferencesMap.entrySet()) {
            final String prefName = prefEntry.getKey();
            final List<String> prefValues = prefEntry.getValue();
           
            final IPortletPreference portletPreference = new PortletPreferenceImpl(prefName, false, prefValues.toArray(new String[prefValues.size()]));
            portletPreferencesList.add(portletPreference);
        }
       
        //Persist the changes.
        final IPortletPreferences portletPreferences = portletEntity.getPortletPreferences();
View Full Code Here

Examples of org.jasig.portal.portlet.dao.jpa.PortletPreferenceImpl

            }
        };
    }
   
    protected void addPref(Map<String, IPortletPreference> prefs, String name, boolean readOnly, String[] values) {
        final PortletPreferenceImpl preference = new PortletPreferenceImpl(name, readOnly);
        preference.setValues(values);
        prefs.put(name, preference);
    }
View Full Code Here

Examples of org.jasig.portal.portlet.dao.jpa.PortletPreferenceImpl

            public Object call() throws Exception {
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
               
                //Add a preference
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref", false, "value");
                preferences.add(portletPreference);
       
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return null;
            }
        });

        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //T1 - Verify it was converted from interim to persistent
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                assertEquals(1, preferences.size());
               
                //T2 - get the entity and add preferences
                final IPortletEntityId localPortletEntityId = executeInThread("T2.1", new Callable<IPortletEntityId>() {
                    @Override
                    public IPortletEntityId call() throws Exception {
                        //T2 - Get entity
                        final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId.getStringId());
                        assertEquals(portletEntity, portletEntity);
       
                        //T2 - add preference
                        final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                        preferences.clear();
                       
                        //T2 - Store the entity
                        portletEntityRegistry.storePortletEntity(request, portletEntity);
                       
                        return portletEntity.getPortletEntityId();
                    }
                });

                //T2 - verify entity was made persistent
                executeInThread("T2.2", new Callable<Object>() {
                    @Override
                    public Object call() throws Exception {
                       
                        //T2 - Verify it was converted from persistent to interim
                        final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, localPortletEntityId);
                        assertNotNull(portletEntity);
                        assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());
                        final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                        assertEquals(0, preferences.size());
                       
                        return null;
                    }
                });
       

                //T1 - add preference 2
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref2", false, "value");
                preferences.add(portletPreference);
       
                //T1 - Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.