Examples of Portlet


Examples of org.gatein.pc.api.Portlet

         RegistrationLocal.setRegistration(registration);

         UserContext userContext = getPortletPropertyDescription.getUserContext();
         checkUserAuthorization(userContext);

         Portlet portlet = getPortletFrom(portletContext, registration);
         PortletInfo info = portlet.getInfo();
         PreferencesInfo prefsInfo = info.getPreferences();

         List<PropertyDescription> descs = Collections.emptyList();
         if (prefsInfo != null)
         {
View Full Code Here

Examples of org.gatein.pc.api.Portlet

         {
            properties = producer.getPortletInvoker().getProperties(jbpContext);
         }

         //todo: we need to check that the user can actually modify the properties
         Portlet portlet = getPortletFrom(portletContext, registration);
         PortletInfo info = portlet.getInfo();

         PropertyList result = WSRPTypeFactory.createPropertyList();
         int propertyNb = properties.size();

         if (propertyNb > 0)
View Full Code Here

Examples of org.gatein.pc.api.Portlet

      }
   }

   private Portlet getPortletFrom(PortletContext portletContext, Registration registration) throws InvalidHandle
   {
      Portlet portlet;
      try
      {
         RegistrationLocal.setRegistration(registration);
         portlet = producer.getPortletInvoker().getPortlet(WSRPUtils.convertToPortalPortletContext(portletContext));
         return portlet;
View Full Code Here

Examples of org.gatein.pc.api.Portlet

      public Portlet getPortlet() throws PortletInvokerException
      {
         if (portlet == null)
         {
            Portlet producerPortlet = ConsumerPortletInvoker.super.getPortlet(producerPortletContext);

            //
            if (stateId == null)
            {
               portlet = producerPortlet;
View Full Code Here

Examples of org.gatein.pc.api.Portlet

      }
      else
      {
         try
         {
            Portlet portlet = getPortlet(portletContext);
            return portlet != null ? PortletStatus.MANAGED : null;
         }
         catch (NoSuchPortletException e)
         {
            return null;
View Full Code Here

Examples of org.gatein.pc.api.Portlet

            //
            try
            {
               PortletState portletState = stateConverter.unmarshall(statefulPortletContext.getType(), state);
               Portlet delegate = super.getPortlet(PortletContext.createPortletContext(portletState.getPortletId()));
               return new ProducerPortlet(portletContext, delegate);
            }
            catch (StateConversionException e)
            {
               throw new PortletInvokerException(e);
            }
         }
         else
         {
            throw new InvalidPortletIdException("", portletId);
         }
      }
      else if (portletId.startsWith(PRODUCER_CLONE_ID_PREFIX))
      {
         try
         {
            String stateId = portletId.substring(PRODUCER_CLONE_ID_PREFIX.length());
            PortletStateContext stateContext = persistenceManager.loadState(stateId);
            PortletState state = stateContext.getState();
            Portlet delegate = super.getPortlet(PortletContext.createPortletContext(state.getPortletId()));
            return new ProducerPortlet(portletContext, delegate);
         }
         catch (NoSuchStateException e)
         {
            throw new NoSuchPortletException(e, portletId);
View Full Code Here

Examples of org.gatein.pc.api.Portlet

      {
         access = AccessMode.READ_ONLY;
      }

      // Get the portlet container and set it on invocation
      Portlet portlet = super.getPortlet(context.getPortletContext());
      if (portlet == null)
      {
         throw new NoSuchPortletException("Portlet " + context.getPortletContext() + " not found", context.getPortletId());
      }

      // Create prefs
      AbstractPropertyContext prefs = new AbstractPropertyContext(
         access,
         context.isStateful() ? ((StatefulContext)context).getProperties() : null,
         invocation instanceof RenderInvocation);

      //
      PortletInvocationResponse response;
      try
      {
         invocation.setTarget(context.getPortletContext());
         invocation.setAttribute(PropertyContext.PREFERENCES_ATTRIBUTE, prefs);

         // Invoke
         response = super.invoke(invocation);
      }
      finally
      {
         invocation.setTarget(portletContext);
         invocation.removeAttribute(PropertyContext.PREFERENCES_ATTRIBUTE);
      }

      //
      int status = prefs.getStatus();

      // Producer state management if the invocation was succesful
      if ((invocation instanceof ActionInvocation || invocation instanceof ResourceInvocation || invocation instanceof EventInvocation) && status == AbstractPropertyContext.UPDATE_SUCCESSFUL)
      {
         // Get the potentially updated prefs
         PropertyMap newPrefs = prefs.getPrefs();

         //
         PortletStateType stateType = instanceCtx.getStateType();
         boolean persistLocally;
         if (stateType == null)
         {
            persistLocally = true;
         }
         else
         {
            persistLocally = stateManagementPolicy.persistLocally();
         }

         //
         switch (access)
         {
            case CLONE_BEFORE_WRITE:
            {
               // Create the state
               if (context.isStateful())
               {
                  StatefulContext statefulContext = (StatefulContext)context;
                  if (persistLocally)
                  {
                     try
                     {
                        // The state id should be ok as it was used before to load the state
                        LocalContext localContext = (LocalContext)statefulContext;
                        String portletStateId = localContext.getStateId();
                        String cloneStateId = persistenceManager.cloneState(portletStateId, newPrefs);

                        // Return the clone context
                        String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
                        PortletContext clonedCtx = PortletContext.createPortletContext(cloneId);
                        StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
                        instanceCtx.onStateEvent(event);
                     }
                     catch (NoSuchStateException e)
                     {
                        throw new PortletInvokerException("Unexpected exception", e);
                     }
                     catch (InvalidStateIdException e)
                     {
                        throw new PortletInvokerException("Unexpected exception", e);
                     }
                  }
                  else
                  {
                     PortletContext clonedCtx = marshall(stateType, context.getPortletId(), newPrefs);
                     StateEvent event = new StateEvent(clonedCtx, StateEvent.Type.PORTLET_CLONED_EVENT);
                     instanceCtx.onStateEvent(event);
                  }
               }
               else
               {
                  // Add the missing mutable portlet state
                  getPropertiesFromMetaData(portlet.getContext(), newPrefs);

                  //
                  if (persistLocally)
                  {
                     // Create the new state
View Full Code Here

Examples of org.gatein.pc.api.Portlet

         // Dereference the portlet
         PortletContext refPortletContext = context.getPortletContext();

         // Get the referenced portlet
         Portlet refPortlet = super.getPortlet(refPortletContext);

         // We need the referenced portlet
         if (refPortlet == null)
         {
            throw new PortletInvokerException("The portlet " + refPortletContext + " referenced by this clone " + portletId + " is not available");
View Full Code Here

Examples of org.gatein.pc.api.Portlet

         throw new InvalidPortletIdException("Cannot configure producer offered portlets", portletId);
      }
      StatefulContext statefulContext = (StatefulContext)context;

      // Get the container
      Portlet referencedPortlet = super.getPortlet(context.getPortletContext());

      // We need the referenced portlet
      if (referencedPortlet == null)
      {
         throw new PortletInvokerException("The portlet " + context.getPortletContext() + " referenced by this clone " + portletId + " is not available");
      }

      // Get the portlet info
      PortletInfo referencedPortletInfo = referencedPortlet.getInfo();

      //
      PreferencesInfo prefs = referencedPortletInfo.getPreferences();

      // Clone the current state
View Full Code Here

Examples of org.gatein.pc.api.Portlet

    * @throws PortletInvokerException any portlet invoker exception
    */
   private void getPropertiesFromMetaData(PortletContext portletContext, PropertyMap props) throws PortletInvokerException
   {
      //
      Portlet portlet = super.getPortlet(portletContext);

      // The prefs info
      PreferencesInfo prefs = portlet.getInfo().getPreferences();

      // Collect missing or read only properties from the referenced portlet
      Set<String> keys = new HashSet<String>();
      for (String key : prefs.getKeys())
      {
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.