protected String getRefreshFunction(PortletDefinition portletDefinition) { String refreshFunction = null; Collection<LocalizedField> refreshFields = null; if (portletDefinition != null) { refreshFields = portletDefinition.getMetadata().getFields(PortalReservedParameters.PORTLET_EXTENDED_DESCRIPTOR_REFRESH_FUNCTION); } if (refreshFields != null && !refreshFields.isEmpty()) { refreshFunction = refreshFields.iterator().next().getValue(); } return refreshFunction; }
protected boolean enforceSecurityConstraint(PortletDefinition portlet) { Collection c = portlet.getMetadata().getFields("render-time.security-constraints"); if (c != null) { Iterator it = c.iterator(); if (it.hasNext()) { LocalizedField field = (LocalizedField) it.next(); return Boolean.parseBoolean(field.getValue()); } } return false; }
protected long getTimeoutOnJob(PortletDefinition portletDefinition) { long timeoutMetadata = 0; Collection<LocalizedField> timeoutFields = null; if (portletDefinition != null) { timeoutFields = portletDefinition.getMetadata().getFields(PortalReservedParameters.PORTLET_EXTENDED_DESCRIPTOR_RENDER_TIMEOUT); } if (timeoutFields != null && !timeoutFields.isEmpty()) { try { timeoutMetadata = Long.parseLong(timeoutFields.iterator().next().getValue()); } catch (NumberFormatException nfe) { log.warn("Invalid timeout metadata: " + nfe.getMessage()); } } return timeoutMetadata; }
private boolean isFilteredOutByRole(PortletDefinition pd, HttpServletRequest servletRequest) { boolean filteredOut = false; Collection<LocalizedField> fields = pd.getMetadata().getFields("selector.conditional.role"); if (fields != null && !fields.isEmpty()) { LocalizedField field = fields.iterator().next(); String role = field.getValue(); if (!StringUtils.isBlank(role)) { if (role.equals("*")) { filteredOut = true; } else { filteredOut = (!servletRequest.isUserInRole(role)); } } } return filteredOut; }
protected long getRefreshRate(PortletDefinition portletDefinition) { long refreshRate = -1; Collection<LocalizedField> refreshFields = null; if (portletDefinition != null) { refreshFields = portletDefinition.getMetadata().getFields(PortalReservedParameters.PORTLET_EXTENDED_DESCRIPTOR_REFRESH_RATE); } if (refreshFields != null && !refreshFields.isEmpty()) { try { refreshRate = Long.parseLong(refreshFields.iterator().next().getValue()); } catch (NumberFormatException nfe) { log.warn("Invalid refreshRate metadata: " + nfe.getMessage()); } } return refreshRate; }
/** * Actions can be marked as non-standard if they don't participate in * JSR-168 standard action behavior. By default, actions are supposed * to clear the cache of all other portlets on the page. * By setting this parameter, we can ignore the standard behavior * and not clear the cache on actions. This is useful for portlets * which never participate with other portlets. * */ protected boolean isNonStandardAction(PortletWindow actionWindow) { PortletDefinition portletDefinition = actionWindow.getPortletDefinition(); Collection<LocalizedField> actionList = portletDefinition.getMetadata().getFields(PortalReservedParameters.PORTLET_EXTENDED_DESCRIPTOR_NON_STANDARD_ACTION); if (actionList != null && !actionList.isEmpty()) { return true; } return false; }
GenericMetadata metaData = portletDef.getMetadata(); if (!mergeRequestParameters)
metadataBean = new GenericMetadataBean(portletDefinition.getMetadata());
Collection<LocalizedField> fields = def.getMetadata().getFields(PortalReservedParameters.PORTLET_EXTENDED_DESCRIPTOR_OUT_OF_SERVICE);
fieldMap.put(PORTLET_APPLICATION, pa.getName()); Collection mdFields = pd.getMetadata().getFields(); for (Iterator fieldIter = mdFields.iterator(); fieldIter.hasNext();)
pd.getMetadata().addField(JetspeedLocale.convertStringToLocale(m.getLang()), m.getMetadataName(), m.getContent());
copy.setCacheScope(source.getCacheScope()); for (LocalizedField field : source.getMetadata().getFields()) copy.getMetadata().addField(field.getLocale(), field.getName(), field.getValue());