Package org.jasig.portal.portlet.om

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


        final IPortletEntityId portletEntityId = this.execute(new Callable<IPortletEntityId>() {
            @Override
            public IPortletEntityId call() throws Exception {
                //Create the entity
                IPortletEntity portletEntity = portletEntityRegistry.getOrCreatePortletEntity(request, portletDefId, nodeId, 12);
                assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());

                return portletEntity.getPortletEntityId();
            }
        });

        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
               
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return null;
            }
        });


        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);

                //Verify it is still interim
                assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());
               
                return null;
            }
        });
    }
View Full Code Here


        final IPortletEntityId portletEntityId = this.execute(new Callable<IPortletEntityId>() {
            @Override
            public IPortletEntityId call() throws Exception {
                //Create the entity
                IPortletEntity portletEntity = portletEntityRegistry.getOrCreatePortletEntity(request, portletDefId, nodeId, 12);
                assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());

                return portletEntity.getPortletEntityId();
            }
        });

        this.execute(new Callable<Object>() {
            @Override
            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 {
                //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());
               
                return null;
            }
        });
View Full Code Here

        if (portletWindow == null) {
            logger.warn("Failed to resolve IPortletWindow for id: " + portletWindowId + ", the id will be used instead of the fname");
            return portletWindowId.toString();
        }

        final IPortletEntity portletEntity = portletWindow.getPortletEntity();
        final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
        return portletDefinition.getFName();
    }
View Full Code Here

         */
    }
   
    protected IPortletWindowId getErrorPortletWindowId(HttpServletRequest request, String fname) {
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final IPortletEntity errorPortletEntity = this.portletEntityRegistry.getOrCreatePortletEntityByFname(request, userInstance, fname);
        final IPortletWindow portletWindow = this.portletWindowRegistry.getOrCreateDefaultPortletWindow(request, errorPortletEntity.getPortletEntityId());
        return portletWindow.getPortletWindowId();
    }
View Full Code Here

        return portletWindow.getPortletWindowId();
    }
   
    protected String getPortletFname(HttpServletRequest request, IPortletWindowId portletWindowId) {
        final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
        final IPortletEntity portletEntity = portletWindow.getPortletEntity();
        final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
        return portletDefinition.getFName();
    }
View Full Code Here

        final IPortletDefinition portletDefinition = this.portletDefinitionDao.getPortletDefinition(portletDefinitionId);
        if (portletDefinition == null) {
            throw new DataRetrievalFailureException("No IPortletDefinition exists for IPortletDefinitionId='" + portletDefinitionId + "'");
        }
       
        IPortletEntity portletEntity = new PortletEntityImpl(portletDefinition, layoutNodeId, userId);
       
        this.getEntityManager().persist(portletEntity);

        return portletEntity;
    }
View Full Code Here

    @Override
    @PortalTransactional
    public void deletePortletEntity(IPortletEntity portletEntity) {
        Validate.notNull(portletEntity, "portletEntity can not be null");
       
        final IPortletEntity persistentPortletEntity;
        final EntityManager entityManager = this.getEntityManager();
        if (entityManager.contains(portletEntity)) {
            persistentPortletEntity = portletEntity;
        }
        else {
View Full Code Here

      window.setRenderParameters(new ParameterMap());
      IPortalUrlBuilder adminRetryUrl = this.portalUrlProvider.getPortalUrlBuilderByPortletWindow(httpRequest, currentFailedPortletWindowId, UrlType.RENDER);
      model.addAttribute("adminRetryUrl", adminRetryUrl.getUrlString());
     
      final IPortletWindow portletWindow = portletWindowRegistry.getPortletWindow(httpRequest, currentFailedPortletWindowId);
            final IPortletEntity parentPortletEntity = portletWindow.getPortletEntity();
            final IPortletDefinition parentPortletDefinition = parentPortletEntity.getPortletDefinition();
            model.addAttribute("channelDefinition", parentPortletDefinition);
           
      StringWriter stackTraceWriter = new StringWriter();
      cause.printStackTrace(new PrintWriter(stackTraceWriter));
     
View Full Code Here

           
            //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) {
                final IPortletDefinitionId portletDefinitionId = portletDefinition.getPortletDefinitionId();
                //Check if the user can render the portlet definition before doing event tests
                if (ap.canRender(portletDefinitionId.getStringId())) {
                  if (this.supportsEvent(event, portletDefinitionId)) {
                    this.logger.debug("{} supports event {}", portletDefinition, event);
                     
                      final IPortletEntity portletEntity = this.portletEntityRegistry.getOrCreateDefaultPortletEntity(request, portletDefinitionId);
                        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();
View Full Code Here

        }
    }

  protected boolean isGlobalEvent(HttpServletRequest request, IPortletWindowId sourceWindowId, Event event) {
    final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(request, sourceWindowId);
    final IPortletEntity portletEntity = portletWindow.getPortletEntity();
    final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
    final IPortletDefinitionId portletDefinitionId = portletDefinition.getPortletDefinitionId();
    final PortletApplicationDefinition parentPortletApplicationDescriptor = this.portletDefinitionRegistry.getParentPortletApplicationDescriptor(portletDefinitionId);
   
    final ContainerRuntimeOption globalEvents = parentPortletApplicationDescriptor.getContainerRuntimeOption(GLOBAL_EVENT__CONTAINER_OPTION);
    if (globalEvents != null) {
View Full Code Here

TOP

Related Classes of org.jasig.portal.portlet.om.IPortletEntity

Copyright © 2018 www.massapicom. 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.