public String wrapCCP(PortletContext ccpCtx) throws InvalidPortletIdException { if (ccpCtx == null) { throw new IllegalArgumentException(); } return PortletContext.CONSUMER_CLONE_ID_PREFIX + ccpCtx.getId(); }
public PortletContext unwrapPOP(String wrappedPOPId) throws InvalidPortletIdException { if (wrappedPOPId == null) { throw new IllegalArgumentException(); } return PortletContext.createPortletContext(wrappedPOPId); }
private PortletContext dereference(PortletContext compoundPortletContext) { return PortletContext.dereference(compoundPortletContext); }
PortletContext.PortletContextComponents components = compoundPortletContext.getComponents(); final String compoundPortletId = compoundPortletContext.getId(); if (components == null) compoundPortletContext = PortletContext.createPortletContext(compoundPortletId, true); components = compoundPortletContext.getComponents();
public List<DestroyCloneFailure> destroyClones(List<PortletContext> portletContexts) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException { if (portletContexts == null) { throw new IllegalArgumentException("Null portlet id list not accepted"); } if (portletContexts.size() == 0) { return Collections.emptyList(); } // List<PortletContext> dereferencedList = new ArrayList<PortletContext>(portletContexts); for (int i = 0; i < dereferencedList.size(); i++) { PortletContext compoundPortletContext = dereferencedList.get(i); PortletContext portletContext = dereference(compoundPortletContext); dereferencedList.set(i, portletContext); } // List<DestroyCloneFailure> failures = portletInvoker.destroyClones(dereferencedList); for (int i = 0; i < failures.size(); i++) { DestroyCloneFailure failure = failures.get(i); String cloneId = failure.getPortletId(); failure = new DestroyCloneFailure(PortletContext.reference(id, PortletContext.createPortletContext(cloneId)).getId()); failures.set(i, failure); } // return failures; }
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; } }
private PortletContext reference(PortletContext portletContext) { return PortletContext.reference(id, portletContext); }
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; } }
public PortletStatus getStatus(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException { if (portletContext == null) { throw new IllegalArgumentException("The portlet context cannot be null"); } if (portlets.containsKey(portletContext.getId())) { return PortletStatus.OFFERED; } return null; }
String portletId = portletContext.getId(); InternalContext context = getStateContext(portletContext); return PortletContext.createPortletContext(cloneId); return PortletContext.createPortletContext(PortletContext.PRODUCER_CLONE_ID_PREFIX + cloneId);
public InternalContext(String portletId) { if (portletId == null) { throw new IllegalArgumentException(); } this.portletId = portletId; this.portletContext = PortletContext.createPortletContext(portletId); }
public String wrapPOP(PortletContext popCtx) throws InvalidPortletIdException { if (popCtx == null) { throw new IllegalArgumentException(); } if (popCtx.getId().startsWith(PortletContext.CONSUMER_CLONE_ID_PREFIX)) { throw new IllegalArgumentException("Must not start with " + PortletContext.CONSUMER_CLONE_ID_PREFIX); } return popCtx.getId(); }
String portletId = portletContext.getId(); Portlet delegate = super.getPortlet(PortletContext.createPortletContext(portletState.getPortletId())); return new ProducerPortlet(portletContext, delegate); PortletStateContext stateContext = persistenceManager.loadState(stateId); PortletState state = stateContext.getState(); Portlet delegate = super.getPortlet(PortletContext.createPortletContext(state.getPortletId())); return new ProducerPortlet(portletContext, delegate);
public static PortletContext convertToPortalPortletContext(String portletHandle, byte[] state) { ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", "PortletContext"); PortletContext context; context = PortletContext.createPortletContext(portletHandle, state, false); return context; }
private static String encode(org.gatein.pc.api.PortletContext portletContext) { String id = portletContext.getId(); if (id.startsWith(URLTools.SLASH)) { id = id.replace(URLTools.SLASH, SLASH_REPLACEMENT); } return URLTools.encodeXWWWFormURL(id); }
ConsumerState consumerState = new ConsumerState<Serializable>(clonedContext.getId(), stateType, state); String stateId = persistenceManager.createState(consumerState); String clonedId = PortletContext.CONSUMER_CLONE_ID_PREFIX + stateId; StateEvent event = new StateEvent(PortletContext.createPortletContext(clonedId), StateEvent.Type.PORTLET_CLONED_EVENT); cictx.onStateEvent(event); StateEvent event = new StateEvent(PortletContext.createPortletContext(clonedContext.getId()), StateEvent.Type.PORTLET_CLONED_EVENT); cictx.onStateEvent(event); try ConsumerState consumerState = new ConsumerState<Serializable>(modifiedContext.getId(), stateType, state); persistenceManager.updateState(consumerContext.stateId, consumerState);
protected Portlet getPortlet(String windowId) throws PortletInvokerException { return portletInvoker.getPortlet(PortletContext.createPortletContext(windowId)); }
public Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException { if (portletContext == null) { throw new IllegalArgumentException("No null portlet id accepted"); } String portletId = portletContext.getId(); PortletImpl portlet = portlets.get(portletId); if (portlet == null) { throw new NoSuchPortletException(portletId); } return portlet; }
String portletId = portletContext.getId(); InternalContext context = getStateContext(portletContext); return PortletContext.createPortletContext(portletId);
public PortletContext unwrapCCP(String wrappedCCP) throws InvalidPortletIdException { if (wrappedCCP == null) { throw new IllegalArgumentException(); } if (!wrappedCCP.startsWith(PortletContext.CONSUMER_CLONE_ID_PREFIX)) { throw new InvalidPortletIdException(wrappedCCP); } return PortletContext.createPortletContext(wrappedCCP.substring(PortletContext.CONSUMER_CLONE_ID_PREFIX.length())); }