Examples of UpdateNavigationalStateResponse


Examples of org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse

                    throw new Exception("Unexpected response type [" + piResponse
                            + "]. Expected a UpdateNavigationResponse or an ErrorResponse.");
                }
            }

            UpdateNavigationalStateResponse navResponse = (UpdateNavigationalStateResponse) piResponse;

            //

            /*
             * Update the portlet window state according to the action output information
             *
             * If the current node is displaying a usual layout page, also tells the page which portlet to render or not when
             * the state is maximized
             */
            WindowState state = new WindowState(getWindowStateOrDefault(navResponse));
            setNextState(uiPortlet, state);

            // update the portlet with the next mode to display
            PortletMode mode = new PortletMode(getPortletModeOrDefault(navResponse));
            setNextMode(uiPortlet, mode);

            StateString navState = navResponse.getNavigationalState();
            if (navState != null) {
                uiPortlet.setNavigationalState(navResponse.getNavigationalState());
            }
            setupPublicRenderParams(uiPortlet, navResponse.getPublicNavigationalStateUpdates());

            // TODO: (mwringe) add this to the UpdateNavigationStateResponse.Event class instead of here
            class PortletEvent implements javax.portlet.Event {
                QName qName;

                Serializable value;

                public PortletEvent(QName qName, Serializable value) {
                    this.qName = qName;
                    this.value = value;
                }

                public String getName() {
                    return qName.getLocalPart();
                }

                public QName getQName() {
                    return qName;
                }

                public Serializable getValue() {
                    return value;
                }
            }

            List<UpdateNavigationalStateResponse.Event> nsEvents = navResponse.getEvents();
            List<javax.portlet.Event> events = new ArrayList<javax.portlet.Event>(nsEvents.size());
            if (nsEvents != null && !nsEvents.isEmpty()) {
                for (UpdateNavigationalStateResponse.Event nsEvent : nsEvents) {
                    javax.portlet.Event portletEvent = new PortletEvent(nsEvent.getName(), nsEvent.getPayload());
                    events.add(portletEvent);
View Full Code Here

Examples of org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse

      super(consumer);
   }

   protected UpdateNavigationalStateResponse processUpdateResponse(Invocation invocation, RequestPrecursor<Invocation> requestPrecursor, UpdateResponse updateResponse, Response wsrpResponse)
   {
      UpdateNavigationalStateResponse result = new UpdateNavigationalStateResponse();

      // new mode
      String newMode = updateResponse.getNewMode();
      if (newMode != null)
      {
         result.setMode(WSRPUtils.getJSR168PortletModeFromWSRPName(newMode));
      }

      // new window state
      String newWindowState = updateResponse.getNewWindowState();
      if (newWindowState != null)
      {
         result.setWindowState(WSRPUtils.getJSR168WindowStateFromWSRPName(newWindowState));
      }

      // navigational state
      NavigationalContext navigationalContext = updateResponse.getNavigationalContext();
      if (navigationalContext != null)
      {
         String navigationalState = navigationalContext.getOpaqueValue();
         if (navigationalState != null) // todo: check meaning of empty private NS
         {
            result.setNavigationalState(new OpaqueStateString(navigationalState));
         }

         List<NamedString> publicParams = navigationalContext.getPublicValues();
         if (ParameterValidation.existsAndIsNotEmpty(publicParams))
         {
            Map<String, String[]> publicNS = WSRPUtils.createPublicNSFrom(publicParams);
            result.setPublicNavigationalStateUpdates(publicNS);
         }
      }

      // events
      List<Event> events = updateResponse.getEvents();
      if (ParameterValidation.existsAndIsNotEmpty(events))
      {
         events = WSRPUtils.replaceByEmptyListIfNeeded(events);
         for (Event event : events)
         {
            Serializable payloadAsSerializable = null;
            boolean failedPayload = false;
            try
            {
               payloadAsSerializable = PayloadUtils.getPayloadAsSerializable(event);
            }
            catch (Exception e)
            {
               failedPayload = true;
               log.info("Couldn't handle payload for event " + event.getName() + ". Will ignore it.", e);
            }

            if (!failedPayload)
            {
               result.queueEvent(new UpdateNavigationalStateResponse.Event(event.getName(), payloadAsSerializable));
            }
         }
      }

      // extensions
View Full Code Here

Examples of org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse

               throw new Exception("Unexpected response type [" + piResponse
                  + "]. Expected a UpdateNavigationResponse or an ErrorResponse.");
            }
         }

         UpdateNavigationalStateResponse navResponse = (UpdateNavigationalStateResponse)piResponse;

         //

         /*
          * Update the portlet window state according to the action output
          * information
          *
          * If the current node is displaying a usual layout page, also tells the
          * page which portlet to render or not when the state is maximized
          */
         WindowState state = new WindowState(getWindowStateOrDefault(navResponse));
         setNextState(uiPortlet, state);

         // update the portlet with the next mode to display
         PortletMode mode = new PortletMode(getPortletModeOrDefault(navResponse));
         setNextMode(uiPortlet, mode);
        
         uiPortlet.setNavigationalState(navResponse.getNavigationalState());
         setupPublicRenderParams(uiPortlet, navResponse.getPublicNavigationalStateUpdates());

         //TODO: (mwringe) add this to the UpdateNavigationStateResponse.Event class instead of here
         class PortletEvent implements javax.portlet.Event
         {
            QName qName;

            Serializable value;

            public PortletEvent(QName qName, Serializable value)
            {
               this.qName = qName;
               this.value = value;
            }

            public String getName()
            {
               return qName.getLocalPart();
            }

            public QName getQName()
            {
               return qName;
            }

            public Serializable getValue()
            {
               return value;
            }
         }

         List<UpdateNavigationalStateResponse.Event> nsEvents = navResponse.getEvents();
         List<javax.portlet.Event> events = new ArrayList<javax.portlet.Event>(nsEvents.size());
         if (nsEvents != null && !nsEvents.isEmpty())
         {
            for (UpdateNavigationalStateResponse.Event nsEvent : nsEvents)
            {
View Full Code Here

Examples of org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse

   protected BlockingInteractionResponse internalProcessResponse(PortletInvocationResponse response)
   {
      if (response instanceof UpdateNavigationalStateResponse)
      {
         UpdateNavigationalStateResponse stateResponse = (UpdateNavigationalStateResponse)response;
         UpdateResponse updateResponse = createUpdateResponse(stateResponse);

         return WSRPTypeFactory.createBlockingInteractionResponse(updateResponse);
      }
      else
View Full Code Here

Examples of org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse

   @Override
   protected HandleEventsResponse internalProcessResponse(PortletInvocationResponse response)
   {
      if (response instanceof UpdateNavigationalStateResponse)
      {
         UpdateNavigationalStateResponse unsResponse = (UpdateNavigationalStateResponse)response;
         HandleEventsResponse eventsResponse = WSRPTypeFactory.createHandleEventsReponse();

         UpdateResponse updateResponse = createUpdateResponse(unsResponse);
         eventsResponse.setUpdateResponse(updateResponse);
View Full Code Here

Examples of org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse

      /** The new mode requested. */
      protected org.gatein.pc.api.Mode mode = new org.gatein.pc.api.Mode(preq.getPortletMode().toString());

      protected PortletInvocationResponse getResponse()
      {
         UpdateNavigationalStateResponse response = new UpdateNavigationalStateResponse();

         //
         response.setProperties(getProperties(false));
         response.setAttributes(preq.attributes.getAttributeMap());

         //
         response.setMode(mode);
         response.setWindowState(windowState);
         response.setPublicNavigationalStateUpdates(navigationalState.getPublicMapSnapshot());
         response.setNavigationalState(ParametersStateString.create(navigationalState.getPrivateMapSnapshot()));

         //
         if (events != null)
         {
            for (UpdateNavigationalStateResponse.Event event : events)
            {
               response.queueEvent(event);
            }
         }

         //
         return response;
View Full Code Here

Examples of org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse

      PortletInvocationResponse response = super.invoke(invocation);

      //
      if (response instanceof UpdateNavigationalStateResponse)
      {
         UpdateNavigationalStateResponse update = (UpdateNavigationalStateResponse)response;

         //
         Map<String, Object> attributes = update.getAttributes();

         //
         if (attributes != null && attributes.size() > 0)
         {
            ParametersStateString outNS = (ParametersStateString)update.getNavigationalState();
            outNS.setValue("javax.portlet.as", conversation.id);

            //
            conversation.setAttributes(attributes);
View Full Code Here

Examples of org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse

   public ActionResponseImpl(ActionInvocation invocation, PortletRequestImpl preq)
   {
      super(invocation, preq);

      //
      UpdateNavigationalStateResponse rr = new UpdateNavigationalStateResponse();
      rr.setNavigationalState(ParametersStateString.create());

      //
      this.response = rr;
   }
View Full Code Here

Examples of org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse

      /** The new mode requested. */
      protected org.gatein.pc.api.Mode mode = org.gatein.pc.api.Mode.create(preq.getPortletMode().toString());

      protected PortletInvocationResponse getResponse()
      {
         UpdateNavigationalStateResponse response = new UpdateNavigationalStateResponse();

         //
         response.setProperties(getProperties(false));
         response.setAttributes(preq.attributes.getAttributeMap());

         //
         response.setMode(mode);
         response.setWindowState(windowState);
         response.setPublicNavigationalStateUpdates(navigationalState.getPublicMapSnapshot());
         response.setNavigationalState(ParametersStateString.create(navigationalState.getPrivateMapSnapshot()));

         //
         if (events != null)
         {
            for (UpdateNavigationalStateResponse.Event event : events)
            {
               response.queueEvent(event);
            }
         }

         //
         return response;
View Full Code Here

Examples of org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse

      PortletInvocationResponse response = super.invoke(invocation);

      //
      if (response instanceof UpdateNavigationalStateResponse)
      {
         UpdateNavigationalStateResponse update = (UpdateNavigationalStateResponse)response;

         //
         Map<String, Object> attributes = update.getAttributes();

         //
         if (attributes != null && attributes.size() > 0)
         {
            ParametersStateString outNS = (ParametersStateString)update.getNavigationalState();
            outNS.setValue("javax.portlet.as", conversation.id);

            //
            conversation.setAttributes(attributes);
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.