Package org.gatein.pc.api

Examples of org.gatein.pc.api.StatefulPortletContext


            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


      //
      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

         PortletContext clonedContext = pictx.clonedContext;
         if (clonedContext != null)
         {
            if (clonedContext instanceof StatefulPortletContext)
            {
               StatefulPortletContext statefulClonedContext = (StatefulPortletContext)clonedContext;
               Serializable state = statefulClonedContext.getState();
               PortletStateType stateType = statefulClonedContext.getType();

               // Save the clone state
               ConsumerState consumerState = new ConsumerState<Serializable>(clonedContext.getId(), stateType, state);
               String stateId = persistenceManager.createState(consumerState);
               String clonedId = CLONE_ID_PREFIX + stateId;
               StateEvent event = new StateEvent(PortletContext.createPortletContext(clonedId), StateEvent.Type.PORTLET_CLONED_EVENT);
               cictx.onStateEvent(event);
            }
            else
            {
               StateEvent event = new StateEvent(PortletContext.createPortletContext(clonedContext.getId()), StateEvent.Type.PORTLET_CLONED_EVENT);
               cictx.onStateEvent(event);
            }
         }
         else
         {
            PortletContext modifiedContext = pictx.modifiedContext;
            if (modifiedContext != null)
            {
               // update state if needed
               if (modifiedContext instanceof StatefulPortletContext)
               {
                  StatefulPortletContext statefulClonedContext = (StatefulPortletContext)modifiedContext;
                  Serializable state = statefulClonedContext.getState();
                  PortletStateType stateType = statefulClonedContext.getType();
                  try
                  {
                     ConsumerState consumerState = new ConsumerState<Serializable>(modifiedContext.getId(), stateType, state);
                     persistenceManager.updateState(consumerContext.stateId, consumerState);
                  }
View Full Code Here

      //
      PortletContext clonedContext = super.createClone(stateType, consumerContext.producerPortletContext);

      if (clonedContext instanceof StatefulPortletContext)
      {
         StatefulPortletContext statefulClonedContext = (StatefulPortletContext)clonedContext;
         ConsumerState consumerState = new ConsumerState<Serializable>(clonedContext.getId(), statefulClonedContext.getType(), statefulClonedContext.getState());
         String id = persistenceManager.createState(consumerState);
         return PortletContext.createPortletContext(CLONE_ID_PREFIX + id);
      }
      else
      {
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

        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

   public PortletStateType<?> getStateType()
   {
      if (context instanceof StatefulPortletContext)
      {
         StatefulPortletContext spc = (StatefulPortletContext)context;
         return spc.getType();
      }
      else
      {
         return PortletStateType.OPAQUE;
      }
View Full Code Here

         PortletContext clonedContext = pictx.clonedContext;
         if (clonedContext != null)
         {
            if (clonedContext instanceof StatefulPortletContext)
            {
               StatefulPortletContext statefulClonedContext = (StatefulPortletContext)clonedContext;
               Serializable state = statefulClonedContext.getState();
               PortletStateType stateType = statefulClonedContext.getType();

               // Save the clone state
               ConsumerState consumerState = new ConsumerState<Serializable>(clonedContext.getId(), stateType, state);
               String stateId = persistenceManager.createState(consumerState);
               String clonedId = CLONE_ID_PREFIX + stateId;
               StateEvent event = new StateEvent(PortletContext.createPortletContext(clonedId), StateEvent.Type.PORTLET_CLONED_EVENT);
               cictx.onStateEvent(event);
            }
            else
            {
               StateEvent event = new StateEvent(PortletContext.createPortletContext(clonedContext.getId()), StateEvent.Type.PORTLET_CLONED_EVENT);
               cictx.onStateEvent(event);
            }
         }
         else
         {
            PortletContext modifiedContext = pictx.modifiedContext;
            if (modifiedContext != null)
            {
               // update state if needed
               if (modifiedContext instanceof StatefulPortletContext)
               {
                  StatefulPortletContext statefulClonedContext = (StatefulPortletContext)modifiedContext;
                  Serializable state = statefulClonedContext.getState();
                  PortletStateType stateType = statefulClonedContext.getType();
                  try
                  {
                     ConsumerState consumerState = new ConsumerState<Serializable>(modifiedContext.getId(), stateType, state);
                     persistenceManager.updateState(consumerContext.stateId, consumerState);
                  }
View Full Code Here

      //
      PortletContext clonedContext = super.createClone(stateType, consumerContext.producerPortletContext);

      if (clonedContext instanceof StatefulPortletContext)
      {
         StatefulPortletContext statefulClonedContext = (StatefulPortletContext)clonedContext;
         ConsumerState consumerState = new ConsumerState<Serializable>(clonedContext.getId(), statefulClonedContext.getType(), statefulClonedContext.getState());
         String id = persistenceManager.createState(consumerState);
         return PortletContext.createPortletContext(CLONE_ID_PREFIX + id);
      }
      else
      {
View Full Code Here

      PortletContext importContext = super.importPortlet(stateType, consumerContext.producerPortletContext);

      if (importContext instanceof StatefulPortletContext)
      {
         StatefulPortletContext statefulimportContext = (StatefulPortletContext)importContext;
         ConsumerState consumerState = new ConsumerState<Serializable>(importContext.getId(), statefulimportContext.getType(), statefulimportContext.getState());
         String id = persistenceManager.createState(consumerState);
         return PortletContext.createPortletContext(CLONE_ID_PREFIX + id);
      }
      else
      {
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.