Examples of IPortletPreferences


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

            new BooleanAttribute(param.getOverride()));
      }
    }
   
    if (def.isPortlet()) {
            final IPortletPreferences prefs = portletDef.getPortletPreferences();
            for (IPortletPreference pref : prefs.getPortletPreferences()) {
        List<Attribute> attributes = new ArrayList<Attribute>();
        for (String value : pref.getValues()) {
          attributes.add(new Attribute(value));
        }
        this.portletPreferences.put(pref.getName(), new StringListAttribute(pref.getValues()));
View Full Code Here

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

        preferenceList.add(new PortletPreferenceImpl(key, readOnly, values));
      }
    }
   
    final IPortletDefinition portletDefinition = this.portletDefinitionRegistry.getPortletDefinition(channelDef.getId());
    final IPortletPreferences portletPreferences = portletDefinition.getPortletPreferences();
    portletPreferences.setPortletPreferences(preferenceList);
     
      channelPublishingService.saveChannelDefinition(channelDef, publisher, categories, groupMembers);

      return this.getChannelDefinitionForm(channelDef.getId());
  }
View Full Code Here

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

    @Override
    public void storePortletEntity(IPortletEntity portletEntity) {
        Validate.notNull(portletEntity, "portletEntity can not be null");
       
        final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId();
        final IPortletPreferences portletPreferences = portletEntity.getPortletPreferences();
        final List<IPortletPreference> preferences = portletPreferences.getPortletPreferences();
       
        if (portletEntity instanceof PersistentPortletEntityWrapper) {
            //Unwrap the persistent entity
            portletEntity = ((PersistentPortletEntityWrapper)portletEntity).getPersistentEntity();
           
View Full Code Here

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

            return true;
        }
        if (!(object instanceof IPortletPreferences)) {
            return false;
        }
        IPortletPreferences rhs = (IPortletPreferences) object;
        return new EqualsBuilder()
            .append(this.portletPreferences, rhs.getPortletPreferences())
            .isEquals();
    }
View Full Code Here

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

            }
        }
       
        final IPortletDefinitionRegistry portletDefinitionRegistry = PortletDefinitionRegistryLocator.getPortletDefinitionRegistry();
        final IPortletDefinition portletDefinition = portletDefinitionRegistry.getPortletDefinition(ci.chanDef.getId());
        final IPortletPreferences portletPreferences = portletDefinition.getPortletPreferences();
        portletPreferences.setPortletPreferences(preferences);
    }
View Full Code Here

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

        //Add deploy preferences
        final List<IPortletPreference> descriptorPreferencesList = this.getDescriptorPreferences(portletDescriptor);
        this.addPreferencesToMap(descriptorPreferencesList, basePreferences);
       
        //Add definition preferences if not config mode
        final IPortletPreferences definitionPreferences = portletDefinition.getPortletPreferences();
        if (!configMode) {
            final List<IPortletPreference> definitionPreferencesList = definitionPreferences.getPortletPreferences();
            this.addPreferencesToMap(definitionPreferencesList, basePreferences);
        }

        final List<IPortletPreference> preferencesList = new ArrayList<IPortletPreference>(newPreferences.length);
       
        for (InternalPortletPreference internalPreference : newPreferences) {
            //Ignore preferences with null names
            final String name = internalPreference.getName();
            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);
        }

        //If in config mode store the preferences on the definition
        if (configMode) {
            definitionPreferences.setPortletPreferences(preferencesList);
            this.portletDefinitionRegistry.updatePortletDefinition(portletDefinition);
        }
        //If not a guest or if guest prefs are shared store them on the entity
        else if (this.isStoreInEntity(portletRequest)) {
            //Update the portlet entity with the new preferences
            final IPortletPreferences entityPreferences = portletEntity.getPortletPreferences();
            entityPreferences.setPortletPreferences(preferencesList);
            this.portletEntityRegistry.storePortletEntity(portletEntity);
        }
        //Must be a guest and share must be off so store the prefs on the session
        else {
            //Store memory preferences
View Full Code Here

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

        //Add descriptor preferences
        final List<IPortletPreference> descriptorPreferencesList = this.getDescriptorPreferences(portletDescriptor);
        this.addPreferencesToMap(descriptorPreferencesList, preferencesMap);
       
        //Add definition preferences
        final IPortletPreferences definitionPreferences = portletDefinition.getPortletPreferences();
        final List<IPortletPreference> definitionPreferencesList = definitionPreferences.getPortletPreferences();
        this.addPreferencesToMap(definitionPreferencesList, preferencesMap);
       
        //Determine if the user is a guest
        final boolean isGuest = isGuestUser(httpServletRequest);
       
        if (!IPortletAdaptor.CONFIG.equals(portletWindow.getPortletMode())) {
            //If not guest or storing shared guest prefs get the prefs from the portlet entity
            if (this.isLoadFromEntity(portletRequest)) {
                //Add entity preferences
                final IPortletPreferences entityPreferences = portletEntity.getPortletPreferences();
                final List<IPortletPreference> entityPreferencesList = entityPreferences.getPortletPreferences();
                this.addPreferencesToMap(entityPreferencesList, preferencesMap);
   
                if (!this.isLoadFromMemory(portletRequest) && !this.isStoreInEntity(portletRequest) && this.isStoreInMemory(portletRequest)) {
                    store(plutoPortletWindow, portletRequest, preferencesMap.values().toArray(new InternalPortletPreference[preferencesMap.size()]));
                }
View Full Code Here

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

    public Set<IPortletEntity> getEntityPreferences(Integer userId) {
        final Set<IPortletEntity> portletEntities = this.portletEntityRegistry.getPortletEntitiesForUser(userId);
       
        for (final Iterator<IPortletEntity> entityItr = portletEntities.iterator(); entityItr.hasNext(); ) {
            final IPortletEntity portletEntity = entityItr.next();
            final IPortletPreferences portletPreferences = portletEntity.getPortletPreferences();
            final List<IPortletPreference> preferencesList = portletPreferences.getPortletPreferences();
           
            //Only bother with entities that have preferences
            if (preferencesList.size() <= 0) {
                entityItr.remove();
            }
View Full Code Here

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

            final IPortletPreference portletPreference = new PortletPreferenceImpl(prefName, false, prefValues.toArray(new String[prefValues.size()]));
            portletPreferencesList.add(portletPreference);
        }
       
        //Persist the changes.
        final IPortletPreferences portletPreferences = portletEntity.getPortletPreferences();
        portletPreferences.setPortletPreferences(portletPreferencesList);
        this.portletEntityRegistry.storePortletEntity(portletEntity);
    }
View Full Code Here

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

        this.checkPoint();
       
       
        // Add some preferences
        portDef2 = this.jpaPortletDefinitionDao.getPortletDefinition(portDef2.getPortletDefinitionId());
        final IPortletPreferences prefs2 = portDef2.getPortletPreferences();
        final List<IPortletPreference> prefsList2 = prefs2.getPortletPreferences();
        prefsList2.add(new PortletPreferenceImpl("prefName1", false, "val1", "val2"));
        prefsList2.add(new PortletPreferenceImpl("prefName2", true, "val3", "val4"));
       
        this.jpaPortletDefinitionDao.updatePortletDefinition(portDef2);
        this.checkPoint();
       
       
        // Check prefs, remove one and another
        final IPortletDefinition portDef3 = this.jpaPortletDefinitionDao.getPortletDefinition(portDef2.getPortletDefinitionId());
        final IPortletPreferences prefs3 = portDef3.getPortletPreferences();
        final List<IPortletPreference> prefsList3 = prefs3.getPortletPreferences();
       
        final List<IPortletPreference> expectedPrefsList3 = new ArrayList<IPortletPreference>();
        expectedPrefsList3.add(new PortletPreferenceImpl("prefName1", false, "val1", "val2"));
        expectedPrefsList3.add(new PortletPreferenceImpl("prefName2", true, "val3", "val4"));
       
        assertEquals(expectedPrefsList3, prefsList3);
       
       
        prefsList3.remove(1);
        prefsList3.add(new PortletPreferenceImpl("prefName3", false, "val5", "val6"));
       
        this.jpaPortletDefinitionDao.updatePortletDefinition(portDef3);
        this.checkPoint();
       

        // Check prefs
        final IPortletDefinition portDef4 = this.jpaPortletDefinitionDao.getPortletDefinition(portDef3.getPortletDefinitionId());
        final IPortletPreferences prefs4 = portDef4.getPortletPreferences();
        final List<IPortletPreference> prefsList4 = prefs4.getPortletPreferences();
       
        final List<IPortletPreference> expectedPrefsList4 = new ArrayList<IPortletPreference>();
        expectedPrefsList4.add(new PortletPreferenceImpl("prefName1", false, "val1", "val2"));
        expectedPrefsList4.add(new PortletPreferenceImpl("prefName3", false, "val5", "val6"));
       
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.