Examples of IPortletPreference


Examples of org.jasig.portal.portlet.om.IPortletPreference

        return portletPreference != null && portletPreference.isReadOnly();
    }

    @Override
    public final String getValue(String key, String def) {
        final IPortletPreference portletPreference = this.getPortletPreference(key);
       
        if (portletPreference != null) {
            final String[] values = portletPreference.getValues();
            if (values == null || values.length == 0) {
                return def;
            }
           
            return values[0];
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletPreference

        return def;
    }

    @Override
    public final String[] getValues(String key, String[] def) {
        final IPortletPreference portletPreference = this.getPortletPreference(key);
       
        if (portletPreference != null) {
            return portletPreference.getValues();
        }
       
        return def;
    }
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletPreference

       
        final Map<String, IPortletPreference> targetPortletPreferences = this.getTargetPortletPreferences();
       
        //Check if there is a base preference for the key
        final Map<String, IPortletPreference> basePortletPreferences = this.getBasePortletPreferences();
        final IPortletPreference basePreference = basePortletPreferences.get(key);
        if (basePreference != null) {
            if (this.isReadOnly(basePreference)) {
                throw new ReadOnlyException("Preference '" + key + "' is read only");
            }

            //if the set value matches base value, delete any target pref
            if (Arrays.equals(values, basePreference.getValues())) {
                this.reset(key);
                return;
            }
        }
       
        IPortletPreference portletPreference = targetPortletPreferences.get(key);
        //No target preference exists yet, create it and then update the composite map
        if (portletPreference == null) {
            portletPreference = new PortletPreferenceImpl(key, false, values != null ? values.clone() : null);
            targetPortletPreferences.put(key, portletPreference);
           
            final Map<String, IPortletPreference> compositePortletPreferences = this.getCompositePortletPreferences();
            compositePortletPreferences.put(key, portletPreference);
           
            this.modified = true;
        }
        //Update the existing preference if the values array is different
        else if (!Arrays.equals(values, portletPreference.getValues())) {
            portletPreference.setValues(values != null ? values.clone() : null);
           
            this.modified = true;
        }
    }
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletPreference

    }

    @Override
    public final void reset(String key) throws ReadOnlyException {
        final Map<String, IPortletPreference> basePortletPreferences = this.getBasePortletPreferences();
        final IPortletPreference basePreference = basePortletPreferences.get(key);
        if (this.isReadOnly(basePreference)) {
            throw new ReadOnlyException("Preference '" + key + "' is read only");
        }
       
        final Map<String, IPortletPreference> targetPortletPreferences = this.getTargetPortletPreferences();
        final IPortletPreference removed = targetPortletPreferences.remove(key);

        //There was a target preference with that key, update the composite preferences map
        if (removed != null) {
            final Map<String, IPortletPreference> compositePortletPreferences = this.getCompositePortletPreferences();
            if (basePreference != null) {
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletPreference

        //Add descriptor prefs to base Map
        final IPortletDefinitionId portletDefinitionId = portletDefinition.getPortletDefinitionId();
        final PortletDefinition portletDescriptor = this.portletDefinitionRegistry.getParentPortletDescriptor(portletDefinitionId);
        final Preferences descriptorPreferences = portletDescriptor.getPortletPreferences();
        for (final Preference preference : descriptorPreferences.getPortletPreferences()) {
            final IPortletPreference preferenceWrapper = new PortletPreferenceImpl(preference);
            basePortletPreferences.put(preferenceWrapper.getName(), preferenceWrapper);
        }

        //Add definition prefs to base Map
        final List<IPortletPreference> definitionPreferences = portletDefinition.getPortletPreferences();
        for (final IPortletPreference preference : definitionPreferences) {
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletPreference

        //Add descriptor prefs to base Map
        final IPortletDefinitionId portletDefinitionId = portletDefinition.getPortletDefinitionId();
        final PortletDefinition portletDescriptor = this.portletDefinitionRegistry.getParentPortletDescriptor(portletDefinitionId);
        final Preferences descriptorPreferences = portletDescriptor.getPortletPreferences();
        for (final Preference preference : descriptorPreferences.getPortletPreferences()) {
            final IPortletPreference preferenceWrapper = new PortletPreferenceImpl(preference);
            basePortletPreferences.put(preferenceWrapper.getName(), preferenceWrapper);
        }

        //Add definition prefs to base Map
        final List<IPortletPreference> definitionPreferences = portletDefinition.getPortletPreferences();
        for (final IPortletPreference preference : definitionPreferences) {
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletPreference

        for (final IPortletPreference preference : newPreferences) {
            final String name = preference.getName();

            //Remove the existing preference from the map since it is supposed to be persisted
            final IPortletPreference existingPreference = oldPreferences.remove(name);
            if (existingPreference == null) {
                modified = true;
               
                //New preference, add it to the list
                this.portletPreferences.add(preference);
            }
            else {
                modified = modified || !existingPreference.equals(preference);
               
                //Existing preference, update the fields
                existingPreference.setValues(preference.getValues());
                existingPreference.setReadOnly(preference.isReadOnly());
                this.portletPreferences.add(existingPreference);
            }
        }
       
        return modified;
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletPreference

        //Add descriptor prefs to base Map
        final IPortletDefinitionId portletDefinitionId = portletDefinition.getPortletDefinitionId();
        final PortletDefinition portletDescriptor = this.portletDefinitionRegistry.getParentPortletDescriptor(portletDefinitionId);
        final Preferences descriptorPreferences = portletDescriptor.getPortletPreferences();
        for (final Preference preference : descriptorPreferences.getPortletPreferences()) {
            final IPortletPreference preferenceWrapper = new PortletPreferenceImpl(preference);
            basePortletPreferences.put(preferenceWrapper.getName(), preferenceWrapper);
        }
    }
View Full Code Here

Examples of org.jasig.portal.portlet.om.IPortletPreference

        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.
        portletEntity.setPortletPreferences(portletPreferencesList);
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.