Examples of IUserInstance


Examples of org.jasig.portal.user.IUserInstance

    /* (non-Javadoc)
     * @see org.jasig.portal.url.AbstractHttpServletRequestWrapper#getLocales()
     */
    @Override
    public Enumeration<Locale> getLocales() {
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(this.getWrappedRequest());
        final LocaleManager localeManager = userInstance.getLocaleManager();
        final Locale[] locales = localeManager.getLocales();
        return new ArrayEnumerator<Locale>(locales);
    }
View Full Code Here

Examples of org.jasig.portal.user.IUserInstance

       
    }

    public boolean processParameters(IWritableHttpServletRequest req, HttpServletResponse res) {
       
        final IUserInstance user = this.userInstanceManager.getUserInstance(req);
        final UserPreferences preferences = user.getPreferencesManager().getUserPreferences();
       
        final String requestUrl = req.getRequestURL().toString();
       
        // Process Structure Parameters...
        final StructureStylesheetUserPreferences ssup = preferences.getStructureStylesheetUserPreferences();
View Full Code Here

Examples of org.jasig.portal.user.IUserInstance

     * @return The targeted channel ID, null if no channel is targeted.
     */
    protected String getTargetChannelId(IWritableHttpServletRequest request) {
        String targetChannelId = null;
       
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final IUserPreferencesManager userPreferencesManager = userInstance.getPreferencesManager();
        final IUserLayoutManager userLayoutManger = userPreferencesManager.getUserLayoutManager();

        // see if this is targeted at an fname channel. if so then it takes
        // precedence. This is done so that a baseActionURL can be used for
        // the basis of an fname targeted channel with the fname query parm
View Full Code Here

Examples of org.jasig.portal.user.IUserInstance

        }
       
       
        final IPortletWindowRegistry portletWindowRegistry = createMock(IPortletWindowRegistry.class);
        final IUserInstanceManager userInstanceManager = createMock(IUserInstanceManager.class);
        final IUserInstance userInstance = createMock(IUserInstance.class);
        final IUserPreferencesManager userPreferencesManager = createMock(IUserPreferencesManager.class);
        final IUserLayoutManager userLayoutManager = createMock(IUserLayoutManager.class);
        final IUserLayoutChannelDescription userLayoutChannelDescription = createMock(IUserLayoutChannelDescription.class);
        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);
View Full Code Here

Examples of org.jasig.portal.user.IUserInstance

        request.getSession(); //initialize the session
        final IStylesheetDescriptorDao stylesheetDescriptorDao = mock(IStylesheetDescriptorDao.class);
        final IUserInstanceManager userInstanceManager = mock(IUserInstanceManager.class);
        final IStylesheetUserPreferencesDao stylesheetUserPreferencesDao = mock(IStylesheetUserPreferencesDao.class);
       
        final IUserInstance userInstance = mock(IUserInstance.class);
        when(userInstanceManager.getUserInstance(request)).thenReturn(userInstance);
       
        final IPerson person = mock(IPerson.class);
        when(userInstance.getPerson()).thenReturn(person);
       
        final IUserPreferencesManager preferencesManager = mock(IUserPreferencesManager.class);
        when(userInstance.getPreferencesManager()).thenReturn(preferencesManager);
       
        final IUserProfile userProfile = mock(IUserProfile.class);
        when(preferencesManager.getUserProfile()).thenReturn(userProfile);
       
        final IUserLayoutManager userLayoutManager = mock(IUserLayoutManager.class);
View Full Code Here

Examples of org.jasig.portal.user.IUserInstance

    public void setUserInstanceManager(IUserInstanceManager userInstanceManager) {
        this.userInstanceManager = userInstanceManager;
    }
   
    private LocaleManager getLocaleManager(HttpServletRequest request) {
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        return userInstance.getLocaleManager();
    }
View Full Code Here

Examples of org.jasig.portal.user.IUserInstance

        this.groupToSkinMap = groupToSkinMap;
    }

    protected String getSkinName(HttpServletRequest request) {
     
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final IPerson person = userInstance.getPerson();

        final EntityIdentifier personIdentifier = person.getEntityIdentifier();
        final IGroupMember groupMember = GroupService.getGroupMember(personIdentifier);

        final Map<IGroupMember, String> groupMemberToSkinMapping = groupMemberToSkinMappingCreator.get();
View Full Code Here

Examples of org.jasig.portal.user.IUserInstance

    public void setAttributeToSkinMap(Map<Pattern, String> attributeToSkinMap) {
        this.attributeToSkinMap = attributeToSkinMap;
    }

    protected String getSkinName(HttpServletRequest request) {
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final IPerson person = userInstance.getPerson();
        final IPersonAttributes personAttrs = this.personAttributeDao.getPerson(person.getUserName());
        if (personAttrs == null) {
            logger.debug("No user attributes found for {} no skin override will be done", person.getUserName());
            return null;
        }
View Full Code Here

Examples of org.jasig.portal.user.IUserInstance

        // Maintenance Mode?
        if (cause != null && cause instanceof MaintenanceModeException) {
            return "/jsp/PortletError/maintenance";
        }

    IUserInstance userInstance = this.userInstanceManager.getUserInstance(httpRequest);
    if(hasAdminPrivileges(userInstance)) {
      IPortletWindow window = this.portletWindowRegistry.getPortletWindow(httpRequest, currentFailedPortletWindowId);
      window.setRenderParameters(new ParameterMap());
      IPortalUrlBuilder adminRetryUrl = this.portalUrlProvider.getPortalUrlBuilderByPortletWindow(httpRequest, currentFailedPortletWindowId, UrlType.RENDER);
      model.addAttribute("adminRetryUrl", adminRetryUrl.getUrlString());
View Full Code Here

Examples of org.jasig.portal.user.IUserInstance

        if (events.isEmpty()) {
            return;
        }
       
        //Get all the portlets the user is subscribed to
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
        final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();
       
        //Make a local copy so we can remove data from it
        final Set<String> allLayoutNodeIds = new LinkedHashSet<String>(userLayoutManager.getAllSubscribedChannels());
       
        final Map<String, IPortletEntity> portletEntityCache = new LinkedHashMap<String, IPortletEntity>();
       
        while (!events.isEmpty()) {
            final QueuedEvent queuedEvent = events.poll();
            if (queuedEvent == null) {
                //no more queued events, done resolving
                return;
            }
           
            final IPortletWindowId sourceWindowId = queuedEvent.getPortletWindowId();
            final Event event = queuedEvent.getEvent();
           
          final boolean globalEvent = isGlobalEvent(request, sourceWindowId, event);
         
          final Set<IPortletDefinition> portletDefinitions = new LinkedHashSet<IPortletDefinition>();
          if (globalEvent) {
            portletDefinitions.addAll(this.portletDefinitionRegistry.getAllPortletDefinitions());
          }
           
            //Check each subscription to see what events it is registered to see
            for (final Iterator<String> layoutNodeIdItr = allLayoutNodeIds.iterator(); layoutNodeIdItr.hasNext(); ) {
                final String layoutNodeId = layoutNodeIdItr.next();
               
                IPortletEntity portletEntity = portletEntityCache.get(layoutNodeId);
                if (portletEntity == null) {
                    portletEntity = this.portletEntityRegistry.getOrCreatePortletEntity(request, userInstance, layoutNodeId);
                   
                    // if portlet entity registry returned null, then portlet has been deleted - remove it (see UP-3378)
                    if (portletEntity == null) {
                      layoutNodeIdItr.remove();
                      continue;
                    }
                   
                    final IPortletDefinitionId portletDefinitionId = portletEntity.getPortletDefinitionId();
                    final PortletDefinition portletDescriptor = this.portletDefinitionRegistry.getParentPortletDescriptor(portletDefinitionId);
                    if (portletDescriptor == null) {
                        //Missconfigured portlet, remove it from the list so we don't check again and ignore it
                        layoutNodeIdItr.remove();
                        continue;
                    }
                   
                    final List<? extends EventDefinitionReference> supportedProcessingEvents = portletDescriptor.getSupportedProcessingEvents();
                    //Skip portlets that don't handle any events and remove them from the set so they are not checked again
                    if (supportedProcessingEvents == null || supportedProcessingEvents.size() == 0) {
                        layoutNodeIdItr.remove();
                        continue;
                    }
                   
                    portletEntityCache.put(layoutNodeId, portletEntity);
                }
               
                final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
                final IPortletDefinitionId portletDefinitionId = portletDefinition.getPortletDefinitionId();
                if (this.supportsEvent(event, portletDefinitionId)) {
                  this.logger.debug("{} supports event {}", portletDefinition, event);
                 
                  //If this is the default portlet entity remove the definition from the all defs set to avoid duplicate processing
                  final IPortletEntity defaultPortletEntity = this.portletEntityRegistry.getOrCreateDefaultPortletEntity(request, portletDefinitionId);
                  if (defaultPortletEntity.equals(portletEntity)) {
                    portletDefinitions.remove(portletDefinition);
                  }
                 
                    final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId();
                    final Set<IPortletWindow> portletWindows = this.portletWindowRegistry.getAllPortletWindowsForEntity(request, portletEntityId);
                   
                    for (final IPortletWindow portletWindow : portletWindows) {
                        this.logger.debug("{} resolved target {}", event, portletWindow);
                        final IPortletWindowId portletWindowId = portletWindow.getPortletWindowId();
                        final Event unmarshalledEvent = this.unmarshall(portletWindow, event);
                        portletEventQueue.offerEvent(portletWindowId, new QueuedEvent(sourceWindowId, unmarshalledEvent) );
                    }
                }
                else {
                  portletDefinitions.remove(portletDefinition);
                }
            }
           
            if (!portletDefinitions.isEmpty()) {
              final IPerson user = userInstance.getPerson();
            final EntityIdentifier ei = user.getEntityIdentifier();
            final IAuthorizationPrincipal ap = AuthorizationService.instance().newPrincipal(ei.getKey(), ei.getType());
             
              //If the event is global there might still be portlet definitions that need targeting
              for (final IPortletDefinition portletDefinition : portletDefinitions) {
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.