public void removePublicParameterValue(String name) { ParameterInfo parameterInfo = navigationInfo.getPublicParameter(name); // if (parameterInfo != null) { publicEntryRemovals.add(name); entries.remove(name); } }
public CacheControl getCacheControl() { if (cacheControl == null) { PortletInfo info = preq.container.getInfo(); CacheInfo cacheInfo = info.getCache(); cacheControl = new CacheControlImpl(cacheInfo.getExpirationSecs(), CacheScope.PRIVATE); } return cacheControl; } }
/** * Return true if the preferences is marked as read only in the portlet.xml deployment * descriptor. * * @param key the preference key * @return the read only value */ private boolean isDDReadOnly(String key) { PreferenceInfo pref = containerPrefs.getPreference(key); if (pref != null) { return Boolean.TRUE.equals(pref.isReadOnly()); } return false; }
/** * Returns the windows that can consume the wanted event name. * * @param wanted the wanted event name * @return the collection of windows that can consume the wanted event */ Collection<Window> getConsumers(QName wanted) { List<Window> consumers = null; for (Window window : windows.values()) { if (window.portlet != null) { for (QName name : window.portlet.getInfo().getEventing().getConsumedEvents().keySet()) { if (wanted.equals(name)) { if (consumers == null) { consumers = new ArrayList<Window>(); } consumers.add(window); } } } } return consumers == null ? Collections.<Window>emptyList() : consumers; } }
public String getDisplayName(String portletName, Locale locale) { String portletDisplayName = portletName; if (portletDisplayNames.get(portletName) != null) { portletDisplayName = portletDisplayNames.get(portletName).getValue(locale, true).getString(); } else if (!isPortletDisplayNamesImported) { PortletInvoker portletInvoker = (PortletInvoker) PortalContainer.getComponent(PortletInvoker.class); try { Set<org.gatein.pc.api.Portlet> portlets = portletInvoker.getPortlets(); for (org.gatein.pc.api.Portlet portlet : portlets) { portletDisplayNames.put(portlet.getInfo().getName(), portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME)); } isPortletDisplayNamesImported = true; } catch (PortletInvokerException exception) { LOG.error("Error occurred when trying to import portlets", exception); } if (portletDisplayNames.get(portletName) != null) { portletDisplayName = portletDisplayNames.get(portletName).getValue(locale, true).getString(); } } return portletDisplayName; }
PreferencesInfo prefs = portlet.getInfo().getPreferences(); for (String key : prefs.getKeys()) PreferenceInfo pref = prefs.getPreference(key); if (Boolean.TRUE.equals(pref.isReadOnly()) || !props.keySet().contains(pref.getKey()))
if (!producerPortletInfo.getEventing().getProducedEvents().containsKey(producedEvent.getName()))
public void updatePublicNavigationalState( ControllerContext controller, PageNavigationalState page, String portletWindowId, Map<String, String[]> update) { PortletInfo info = controller.getPortletInfo(portletWindowId); if (info != null) { NavigationInfo navigationInfo = info.getNavigation(); for (Map.Entry<String, String[]> entry : update.entrySet()) { String id = entry.getKey(); ParameterInfo parameterInfo = navigationInfo.getPublicParameter(id); if (parameterInfo != null) { QName name = parameterInfo.getName(); String[] value = entry.getValue(); if (value.length > 0) { page.setPublicNavigationalState(name, value); } else { page.removePublicNavigationalState(name); } } } } }
public Map<String, String[]> getPublicWindowNavigationalState(ControllerContext controller, PageNavigationalState page, String windowId) { PortletInfo info = controller.getPortletInfo(windowId); // if (info != null) { ParameterMap publicNavigationalState = new ParameterMap(); for (ParameterInfo parameterInfo : info.getNavigation().getPublicParameters()) { String[] parameterValue = page.getPublicNavigationalState(parameterInfo.getName()); // if (parameterValue != null) { String parameterId = parameterInfo.getId(); // We clone the value here so we keep the internal state not potentially changed publicNavigationalState.put(parameterId, parameterValue.clone()); } } // return publicNavigationalState; } // return null; } }
CapabilitiesInfo capabilities = info.getCapabilities(); Set<ModeInfo> compatibleModes = capabilities.getModes(mediaType); for (ModeInfo modeInfo : compatibleModes) if (currentMode.equals(modeInfo.getMode()))
SecurityInfo securityInfo = containerInfo.getSecurity(); SecurityContext securityContext = invocation.getSecurityContext(); boolean invoke = true; if (!securityContext.isSecure()) if (securityInfo.containsTransportGuarantee(TransportGuarantee.CONFIDENTIAL)) else if (securityInfo.containsTransportGuarantee(TransportGuarantee.INTEGRAL))
/** * Build the initial set of supported modes. * * @return the set of portlet modes */ private Set<org.gatein.pc.api.Mode> buildSupportedModes() { // Get response content type MediaType responseContentType = invocation.getContext().getResponseContentType(); // org.gatein.pc.api.spi.PortalContext portalContext =invocation.getPortalContext(); // Get the modes for this content type CapabilitiesInfo capabilities = container.getInfo().getCapabilities(); // Add all the modes Set<org.gatein.pc.api.Mode> modes = new HashSet<org.gatein.pc.api.Mode>(); for (ModeInfo modeInfo : capabilities.getModes(responseContentType)) { org.gatein.pc.api.Mode mode = modeInfo.getMode(); // if (modeInfo instanceof PortletManagedModeInfo || portalContext.getModes().contains(mode)) { modes.add(mode); } } // return modes; }
private Map<String, RuntimeOptionInfo> build(Collection<ContainerRuntimeMetaData> optionsMD) { Map<String, RuntimeOptionInfo> options = null; for (ContainerRuntimeMetaData containerRuntimeMD : optionsMD) { RuntimeOptionInfo optionInfo = build(containerRuntimeMD); if (options == null) { options = new HashMap<String, RuntimeOptionInfo>(); } options.put(optionInfo.getName(), optionInfo); } return options; }
public WindowStateInfo getWindowState(WindowState value) { for (WindowStateInfo windowState : getAllWindowStates()) { if (windowState.getWindowState().equals(value)) { return windowState; } } // return null; }
public ModeInfo getMode(org.gatein.pc.api.Mode value) { for (ModeInfo mode : getAllModes()) { if (mode.getMode().equals(value)) { return mode; } } // return null; }
public Iterable<WindowEvent> eventProduced(EventPhaseContext context, WindowEvent producedEvent, WindowEvent sourceEvent) { try { LinkedList<WindowEvent> toConsume = new LinkedList<WindowEvent>(); for (Portlet portlet : invoker.getPortlets()) { PortletInfo portletInfo = portlet.getInfo(); if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName())) { WindowEvent distributedEvent = new WindowEvent(producedEvent.getName(), producedEvent.getPayload(), portlet.getContext().getId()); toConsume.addLast(distributedEvent); } } return toConsume; } catch (PortletInvokerException e) { System.out.println("e = " + e); return null; } }
protected static ParameterMap safeBuildPublicParameters(NavigationInfo navigationInfo, Map<String, String[]> publicNavigationalParameters) { if (publicNavigationalParameters != null) { // Clone the public navigational state with the copy mode ParameterMap publicParameters = ParameterMap.clone(publicNavigationalParameters); // Remove any parameter that would have been sent by the producer by mistake for (Iterator<String> i = publicParameters.keySet().iterator(); i.hasNext();) { String name = i.next(); if (navigationInfo.getPublicParameter(name) == null) { i.remove(); } } // return publicParameters; } else { return null; } }
CacheInfo cacheInfo = info.getCache(); cc = new org.gatein.pc.api.cache.CacheControl(cacheInfo.getExpirationSecs(), CacheScope.PRIVATE, null);
if (!consumerPortletInfo.getEventing().getConsumedEvents().containsKey(toConsumeEvent.getName()))
private void internalPut(String name, String[] value, boolean cloneValue) { if (cloneValue) { value = value.clone(); } // Look if we have an entry already PortletParameter entry = entries.get(name); // if (entry == null) { ParameterInfo parameterInfo = navigationInfo.getPublicParameter(name); // PortletParameter.Scope scope = parameterInfo == null ? PortletParameter.Scope.PRIVATE : PortletParameter.Scope.PUBLIC; // if (scope == PortletParameter.Scope.PUBLIC) { publicEntryRemovals.remove(name); } // entries.put(name, new PortletParameter(scope, value)); } else { entries.put(name, new PortletParameter(entry.getScope(), value)); } }