Package org.gatein.pc.api

Examples of org.gatein.pc.api.StatefulPortletContext


      //
      PortletContext updatedPortletContext = super.setProperties(consumerContext.producerPortletContext, changes);

      if (updatedPortletContext instanceof StatefulPortletContext)
      {
         StatefulPortletContext statefulUpdatedPortletContext = (StatefulPortletContext)updatedPortletContext;
         Serializable state = statefulUpdatedPortletContext.getState();
         PortletStateType stateType = statefulUpdatedPortletContext.getType();

         //
         if (consumerContext.stateId == null)
         {
            throw new NotYetImplemented();
View Full Code Here


      try
      {
         if (contextToImport instanceof StatefulPortletContext)
         {
            StatefulPortletContext statefulPortletContext = (StatefulPortletContext)contextToImport;
            Boolean persistLocally = stateManagementPolicy.persistLocally();

            PortletState portletState = getStateConverter().unmarshall(stateType, statefulPortletContext.getState());
            //
            if (persistLocally)
            {
               // Create the new state

               String cloneStateId = persistenceManager.createState(statefulPortletContext.getId(), portletState.getProperties());

               // Return the clone context
               String cloneId = PRODUCER_CLONE_ID_PREFIX + cloneStateId;
               return PortletContext.createPortletContext(cloneId);
            }
            else
            {
               return marshall(statefulPortletContext.getType(), statefulPortletContext.getId(), portletState.getProperties());
            }
         }
         else
         {
            return getPortlet(contextToImport).getContext();
View Full Code Here

            return new StatelessContext(portletContext.getId());
         }
      }
      else
      {
         StatefulPortletContext statefulPortletContext = (StatefulPortletContext)portletContext;
         Serializable bytes = statefulPortletContext.getState();
         PortletStateType stateType = statefulPortletContext.getType();
         try
         {
            final PortletState state = stateConverter.unmarshall(stateType, bytes);
            return new RemoteContext(stateType, state.getPortletId(), state.getProperties());
         }
View Full Code Here

         PortletContextMapping contextMapping = createPortletContext(id);
         contextMappings.add(contextMapping);

         if (portletContext instanceof StatefulPortletContext)
         {
            StatefulPortletContext context = (StatefulPortletContext)portletContext;
            if (PortletStateType.OPAQUE.equals(context.getType()))
            {
               contextMapping.initFrom(id, ((StatefulPortletContext<byte[]>)context).getState());
            }
            else
            {
               throw new IllegalArgumentException("Cannot handle PortletContext state: " + context.getState());
            }
         }
         else
         {
            contextMapping.initFrom(id, null);
View Full Code Here

      StringBuilder portletContent = new StringBuilder();
      try
      {
         PortalRequestContext prcontext = (PortalRequestContext)WebuiRequestContext.getCurrentInstance();
         prcontext.setFullRender(true);
         StatefulPortletContext portletContext = uiPortlet_.getPortletContext();

         ExoPortletInvocationContext portletInvocationContext = new ExoPortletInvocationContext(prcontext, uiPortlet_);

         List<Cookie> requestCookies = new ArrayList<Cookie>(Arrays.asList(prcontext.getRequest().getCookies()));

         RenderInvocation renderInvocation = new RenderInvocation(portletInvocationContext);
         renderInvocation.setClientContext(new AbstractClientContext(prcontext.getRequest(), requestCookies));
         renderInvocation.setServerContext(new AbstractServerContext(prcontext.getRequest(), prcontext.getResponse()));


         // instance context
         InstanceContext instanceContext;
         if (portletContext.getType() instanceof WSRPPortletStateType)
         {
            WSRP wsrp = (WSRP)portletContext.getState();
            AccessMode accessMode = AccessMode.CLONE_BEFORE_WRITE;
            if (wsrp.isCloned())
            {
               accessMode = AccessMode.READ_WRITE;
            }
            instanceContext = new ExoPortletInstanceContext(wsrp.getPortletId(), accessMode);
         }
         else
         {
            ExoPortletState exo = (ExoPortletState)portletContext.getState();
            instanceContext = new ExoPortletInstanceContext(exo.getPortletId());
         }
         renderInvocation.setInstanceContext(instanceContext);

         renderInvocation.setUserContext(new AbstractUserContext(prcontext.getRequest()));
View Full Code Here

               wsrp.setCloned(true); // mark the state as cloned

               // if we have an associated state, record it as well...
               if (clonedContext instanceof StatefulPortletContext)
               {
                  StatefulPortletContext statefulPortletContext = (StatefulPortletContext)clonedContext;
                  wsrp.setState((byte[])statefulPortletContext.getState());
               }
               uiPortlet.update((C)wsrp);
            }
         }
        
View Full Code Here

        if (ApplicationType.WSRP_PORTLET.equals(state.getApplicationType())) {
            WSRP wsrp = (WSRP) preferencesPortletContext.getState();
            AccessMode accessMode = AccessMode.CLONE_BEFORE_WRITE;

            if (wsrp.getState() != null) {
                StatefulPortletContext statefulPortletContext = StatefulPortletContext.create(
                        preferencesPortletContext.getId(), PortletStateType.OPAQUE, wsrp.getState());

                invocation.setTarget(statefulPortletContext);
            } else {
                PortletContext portletContext = PortletContext.createPortletContext(preferencesPortletContext.getId());
View Full Code Here

      ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "portlet context");

      PortletContext wsrpPC = createPortletContext(portletContext.getId());
      if (portletContext instanceof StatefulPortletContext)
      {
         StatefulPortletContext context = (StatefulPortletContext)portletContext;
         if (PortletStateType.OPAQUE.equals(context.getType()))
         {
            wsrpPC.setPortletState(((StatefulPortletContext<byte[]>)context).getState());
         }
      }
View Full Code Here

      ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "portlet context");

      V1PortletContext wsrpPC = createPortletContext(portletContext.getId());
      if (portletContext instanceof StatefulPortletContext)
      {
         StatefulPortletContext context = (StatefulPortletContext)portletContext;
         if (PortletStateType.OPAQUE.equals(context.getType()))
         {
            wsrpPC.setPortletState(((StatefulPortletContext<byte[]>)context).getState());
         }
      }
View Full Code Here

               wsrp.setCloned(true); // mark the state as cloned

               // if we have an associated state, record it as well...
               if (clonedContext instanceof StatefulPortletContext)
               {
                  StatefulPortletContext statefulPortletContext = (StatefulPortletContext)clonedContext;
                  wsrp.setState((byte[])statefulPortletContext.getState());
               }
               uiPortlet.update((C)wsrp);
            }
         }
        
View Full Code Here

TOP

Related Classes of org.gatein.pc.api.StatefulPortletContext

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.