public static byte[] getStateOrNullFor(PortletContext portletContext) { if (portletContext instanceof StatefulPortletContext) { StatefulPortletContext context = (StatefulPortletContext)portletContext; if (PortletStateType.OPAQUE.equals(context.getType())) { return ((StatefulPortletContext<byte[]>)context).getState(); } } return null; }
/** * @param registrationContext * @param portletContext * @return * @since 2.6 */ public static V1GetPortletDescription createGetPortletDescription(V1RegistrationContext registrationContext, org.gatein.pc.api.PortletContext portletContext) { 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()); } } V1GetPortletDescription getPortletDescription = new V1GetPortletDescription(); getPortletDescription.setRegistrationContext(registrationContext); getPortletDescription.setPortletContext(wsrpPC); return getPortletDescription; }
/** * @param registrationContext * @param portletContext * @return * @since 2.6 */ public static GetPortletDescription createGetPortletDescription(RegistrationContext registrationContext, org.gatein.pc.api.PortletContext portletContext) { 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()); } } GetPortletDescription getPortletDescription = new GetPortletDescription(); getPortletDescription.setRegistrationContext(registrationContext); getPortletDescription.setPortletContext(wsrpPC); return getPortletDescription; }
public PortletContext createClone(PortletStateType stateType, PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException { ConsumerContext consumerContext = getConsumerContext(portletContext); // 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(PortletContext.CONSUMER_CLONE_ID_PREFIX + id); } else { return clonedContext; } }
public PortletContext importPortlet(PortletStateType stateType, PortletContext portletContext) throws PortletInvokerException, IllegalArgumentException { ConsumerContext consumerContext = getConsumerContext(portletContext); 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(PortletContext.CONSUMER_CLONE_ID_PREFIX + id); } else { return importContext; } }
if (portletContext instanceof StatefulPortletContext) { StatefulPortletContext context = (StatefulPortletContext) portletContext; if (PortletStateType.OPAQUE.equals(context.getType())) { wsrp.setState((byte[]) context.getState()); } else {
PortletState portletState = stateConverter.unmarshall(statefulPortletContext.getType(), state); Portlet delegate = super.getPortlet(PortletContext.createPortletContext(portletState.getPortletId())); return new ProducerPortlet(portletContext, delegate);
if (PortletStateType.OPAQUE.equals(context.getType()))
PortletStateType stateType = statefulUpdatedPortletContext.getType();
PortletStateType stateType = statefulPortletContext.getType(); try