Examples of IPortletEntity


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

        }
       
        // TODO Need to decide how to deal with 'secure' URL requests

        final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
        final IPortletEntity parentPortletEntity = this.portletWindowRegistry.getParentPortletEntity(request, portletWindowId);
        final String channelSubscribeId = parentPortletEntity.getChannelSubscribeId();

        WindowState windowState = portletUrl.getWindowState();
        PortletMode portletMode = portletUrl.getPortletMode();
       
        final WindowState previousWindowState = portletWindow.getWindowState();
View Full Code Here

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

     */
    public InternalPortletPreference[] getStoredPreferences(PortletWindow plutoPortletWindow, PortletRequest portletRequest) throws PortletContainerException {
        final HttpServletRequest httpServletRequest = this.portalRequestUtils.getOriginalPortletAdaptorRequest(portletRequest);
       
        final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(httpServletRequest, plutoPortletWindow);
        final IPortletEntity portletEntity = this.portletWindowRegistry.getParentPortletEntity(httpServletRequest, portletWindow.getPortletWindowId());
        final IPortletDefinition portletDefinition = this.portletEntityRegistry.getParentPortletDefinition(portletEntity.getPortletEntityId());
        final PortletDD portletDescriptor = this.portletDefinitionRegistry.getParentPortletDescriptor(portletDefinition.getPortletDefinitionId());

       
        //Linked hash map used to add preferences in order loaded from the descriptor, definition and entity
        final LinkedHashMap<String, InternalPortletPreference> preferencesMap = new LinkedHashMap<String, InternalPortletPreference>();
       
        //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()]));
                }
            }
            //If a guest and storing non-shared guest prefs get the prefs from the session
            if (this.isLoadFromMemory(portletRequest)) {
                //Add memory preferences
                final List<IPortletPreference> entityPreferencesList = this.getSessionPreferences(portletEntity.getPortletEntityId(), httpServletRequest);
                this.addPreferencesToMap(entityPreferencesList, preferencesMap);
            }
        }

        return preferencesMap.values().toArray(new InternalPortletPreference[preferencesMap.size()]);
View Full Code Here

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

        if (isGuest && !(this.isStoreInEntity(portletRequest) || this.isStoreInMemory(portletRequest))) {
            return;
        }

        final IPortletWindow portletWindow = this.portletWindowRegistry.convertPortletWindow(httpServletRequest, plutoPortletWindow);
        final IPortletEntity portletEntity = this.portletWindowRegistry.getParentPortletEntity(httpServletRequest, portletWindow.getPortletWindowId());
        final IPortletDefinition portletDefinition = this.portletEntityRegistry.getParentPortletDefinition(portletEntity.getPortletEntityId());
        final PortletDD portletDescriptor = this.portletDefinitionRegistry.getParentPortletDescriptor(portletDefinition.getPortletDefinitionId());

        //Is this CONFIG mode
        final boolean configMode = IPortletAdaptor.CONFIG.equals(portletWindow.getPortletMode());
       
        //Get Map of descriptor and definition preferences to check new preferences against
        final Map<String, InternalPortletPreference> basePreferences = new HashMap<String, InternalPortletPreference>();
       
        //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
            this.storeSessionPreferences(portletEntity.getPortletEntityId(), httpServletRequest, preferencesList);
        }
    }
View Full Code Here

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

        final HttpServletRequest request = this.portalRequestUtils.getOriginalPortalRequest(portletRequest);
        final HttpServletResponse response = this.portalRequestUtils.getOriginalPortalResponse(portletRequest);
        final IPerson person = this.personManager.getPerson(request);
       
        final String transientChannelSubscribeId = "CONFIG_" + portletDefinitionId;
        final IPortletEntity portletEntity = this.portletEntityRegistry.getOrCreatePortletEntity(portletDefinitionId, transientChannelSubscribeId, person.getID());
       
        final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId();

        final InternalPortletWindow internalPortletWindow = ((InternalPortletRequest)portletRequest).getInternalPortletWindow();
        final IPortletWindow parentPortletWindow = this.portletWindowRegistry.convertPortletWindow(request, internalPortletWindow);
        final IPortletWindowId parentPortletWindowId = parentPortletWindow.getPortletWindowId();
        final IPortletWindow portletWindow = this.portletWindowRegistry.createDelegatePortletWindow(request, portletEntityId, parentPortletWindowId);
View Full Code Here

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

   
    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.IPortletEntity

       
        return portletEntities;
    }

    public void setEntityPreference(String fName, String channelSubscribeId, Integer userId, LinkedHashMap<String, List<String>> preferencesMap) {
        final IPortletEntity portletEntity = this.getPortletEntity(fName, channelSubscribeId, userId);
       
        //Convert the Map to a List of IPortletPreference objects
        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();
        portletPreferences.setPortletPreferences(portletPreferencesList);
        this.portletEntityRegistry.storePortletEntity(portletEntity);
    }
View Full Code Here

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

    public void testNoopOperations() throws Exception {
        final IPortletDefinitionId portletDefinitionId = new PortletDefinitionIdImpl(1);
        final IPortletDefinition nullPortDef1 = this.jpaPortletDefinitionDao.getPortletDefinition(portletDefinitionId);
        assertNull(nullPortDef1);
       
        final IPortletEntity nullPortEnt1 = this.jpaPortletEntityDao.getPortletEntity("chanSub1", 1);
        assertNull(nullPortEnt1);
       
        final Set<IPortletEntity> portEnts = this.jpaPortletEntityDao.getPortletEntities(new PortletDefinitionIdImpl(1));
        assertEquals(Collections.emptySet(), portEnts);
    }
View Full Code Here

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

        //Create a definition
        final IChannelDefinition chanDef1 = this.jpaChannelDefinitionDao.createChannelDefinition(channelType, "fname1", IPortletAdaptor.class.getName(), "Test Portlet 1", "Test Portlet 1 Title");
        IPortletDefinition portDef1 = this.jpaPortletDefinitionDao.getPortletDefinition(chanDef1.getId());
        this.checkPoint();
       
        IPortletEntity portEnt1 = this.jpaPortletEntityDao.createPortletEntity(portDef1.getPortletDefinitionId(), "chanSub1", 1);
        this.checkPoint();
       
       
        final IPortletEntity portEnt1a = this.jpaPortletEntityDao.getPortletEntity(portEnt1.getPortletEntityId());
        assertEquals(portEnt1, portEnt1a);
       
        final IPortletEntity portEnt1b = this.jpaPortletEntityDao.getPortletEntity("chanSub1", 1);
        assertEquals(portEnt1, portEnt1b);
       
        final Set<IPortletEntity> portletEntities1 = this.jpaPortletEntityDao.getPortletEntities(portDef1.getPortletDefinitionId());
        assertEquals(Collections.singleton(portEnt1), portletEntities1);
       
View Full Code Here

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

        final IPortletWindow sourcePortletWindow = EasyMock.createMock(IPortletWindow.class);
        final IPortletEntityId portletEntityId = EasyMock.createMock(IPortletEntityId.class);
        final IPortletEntityRegistry portletEntityRegistry = EasyMock.createMock(IPortletEntityRegistry.class);
        final IPortletDefinitionRegistry portletDefinitionRegistry = EasyMock.createMock(IPortletDefinitionRegistry.class);
        final IPortletDefinition portletDefinition = EasyMock.createMock(IPortletDefinition.class);
        final IPortletEntity portletEntity = EasyMock.createMock(IPortletEntity.class);
       
        final ConcurrentHashMap<Object, Object> transientPortletWindowMap = new ConcurrentHashMap<Object, Object>();
       
        final ConcurrentHashMap<Object, Object> portletWindowMap = new ConcurrentHashMap<Object, Object>();
        portletWindowMap.put(sourcePortletWindowId, sourcePortletWindow);
       
        EasyMock.expect(sourcePortletWindowId.getStringId()).andReturn("pwid1");
        EasyMock.expect(request.getSession(false)).andReturn(session);
        EasyMock.expect(session.getAttribute(WebUtils.SESSION_MUTEX_ATTRIBUTE)).andReturn(session);
        EasyMock.expect(session.getAttribute(PortletWindowRegistryImpl.PORTLET_WINDOW_MAP_ATTRIBUTE)).andReturn(portletWindowMap);
        EasyMock.expect(sourcePortletWindow.getPortletEntityId()).andReturn(portletEntityId);
        EasyMock.expect(request.getAttribute(PortalWebUtils.REQUEST_MUTEX_ATTRIBUTE)).andReturn(request).times(2);
        EasyMock.expect(request.getAttribute(TransientPortletWindowRegistryImpl.TRANSIENT_PORTLET_WINDOW_MAP_ATTRIBUTE)).andReturn(transientPortletWindowMap).times(2);
        EasyMock.expect(portletEntityId.getStringId()).andReturn("peid1").times(2);
        EasyMock.expect(portletEntityRegistry.getParentPortletDefinition(portletEntityId)).andReturn(portletDefinition);
        EasyMock.expect(portletDefinitionRegistry.getPortletDescriptorKeys(portletDefinition)).andReturn(new Tuple<String, String>("pdk1.k", "pdk1.v"));
        EasyMock.expect(portletEntityRegistry.getPortletEntity("peid1")).andReturn(portletEntity);               
        EasyMock.expect(portletEntity.getPortletEntityId()).andReturn(portletEntityId);
               
       
        EasyMock.replay(request, session, sourcePortletWindowId, sourcePortletWindow, portletEntityId,
                portletEntityRegistry, portletDefinitionRegistry, portletDefinition, portletEntity);
       
View Full Code Here

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

        final IPortletDefinitionRegistry portletDefinitionRegistry = createMock(IPortletDefinitionRegistry.class);
        final IPortletDefinition portletDefinition = createMock(IPortletDefinition.class);
        final IChannelDefinition channelDefinition = createMock(IChannelDefinition.class);
        final IPerson person = createMock(IPerson.class);
        final IPortletEntityRegistry portletEntityRegistry = createMock(IPortletEntityRegistry.class);
        final IPortletEntity portletEntity = createMock(IPortletEntity.class);
        final IPortletWindow portletWindow = createMock(IPortletWindow.class);
       
        final MockPortletDefinitionId portletDefinitionId = new MockPortletDefinitionId("42");
        final MockPortletEntityId portletEntityId = new MockPortletEntityId("subId1");
        final MockPortletWindowId portletWindowId = new MockPortletWindowId("windowId1");
       
        expect(userInstanceManager.getUserInstance(request)).andReturn(userInstance);
        expect(userInstance.getPreferencesManager()).andReturn(userPreferencesManager);
        expect(userPreferencesManager.getUserLayoutManager()).andReturn(userLayoutManager);
        expect(userLayoutManager.getSubscribeId("my-info-student-center-home")).andReturn("subId1");
        expect(userLayoutManager.getNode("subId1")).andReturn(userLayoutChannelDescription);
        expect(userLayoutChannelDescription.getChannelPublishId()).andReturn("42");
        expect(portletDefinitionRegistry.getPortletDefinition(42)).andReturn(portletDefinition);
        expect(portletDefinition.getChannelDefinition()).andReturn(channelDefinition);
        expect(channelDefinition.isPortlet()).andReturn(true);
        expect(userInstance.getPerson()).andReturn(person);
        expect(portletDefinition.getPortletDefinitionId()).andReturn(portletDefinitionId);
        expect(person.getID()).andReturn(37);
        expect(portletEntityRegistry.getOrCreatePortletEntity(portletDefinitionId, "subId1", 37)).andReturn(portletEntity);
        expect(portletEntity.getPortletEntityId()).andReturn(portletEntityId);
        expect(portletWindowRegistry.createDefaultPortletWindow(request, portletEntityId)).andReturn(portletWindow);
        expect(portletWindow.getPortletWindowId()).andReturn(portletWindowId);
        expect(portletWindowRegistry.createTransientPortletWindowId(request, portletWindowId)).andReturn(portletWindowId);
       
        replay(portletWindowRegistry, userInstanceManager, userInstance, userPreferencesManager, userLayoutManager,
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.