@Override public String getTitle(String locale) { return this.portletDefinition.getTitle(locale); }
@Override public String getTitle() { return this.portletDefinition.getTitle(); }
@Override public String getTitle(String locale) { return this.portletDefinition.getTitle(locale); }
@Override public String getTitle() { return this.portletDefinition.getTitle(); }
private Map<String, String> getPortletAttrs(IPortletDefinition portlet, String url) { final Map<String, String> rslt = new TreeMap<>(); rslt.put("name", portlet.getName()); rslt.put("fname", portlet.getFName()); rslt.put("title", portlet.getTitle()); rslt.put("description", portlet.getDescription()); rslt.put("url", url); return rslt; } }
/** * Performs a case-insensitive comparison of the user's query against several important fields * from the {@link IPortletDefinition}. * * @param query The user's search terms, which seem to be forced lower-case * @param portlet Definition of portlet to check name, title, and description * @return true if the query string is contained in the above 3 attributes; otherwise, false */ public static boolean matches(final String query, final IPortletDefinition portlet) { /* * The query parameter is coming in lower case always (even when upper * or mixed case is entered by the user). We really want a case- * insensitive comparison here anyway; for safety, we will make certain * it is insensitive. */ final String lcQuery = query.toLowerCase(); final boolean titleMatch = portlet.getTitle().toLowerCase().contains(lcQuery); final boolean nameMatch = portlet.getName().toLowerCase().contains(lcQuery); final boolean descMatch = portlet.getDescription() != null && portlet.getDescription().toLowerCase().contains(lcQuery); final boolean fnameMatch = portlet.getFName().toLowerCase().contains(lcQuery); return titleMatch || nameMatch || descMatch || fnameMatch; }
/** * Initialize the state using portlet definition. Class fields will be retrieved from portlet * definition using specified locale. * * @param definition portelt definition to use (must not be null). * @param locale specifies the localization to use. */ public LocalizedPortletDefinition(IPortletDefinition definition, String locale) { assert definition != null; if (locale != null) { this.name = definition.getName(locale); this.title = definition.getTitle(locale); this.description = definition.getDescription(locale); } else { this.name = definition.getName(); this.title = definition.getTitle(); this.description = definition.getDescription(); } }
private Element getElementForChannel( Document doc, String chanId, IPortletDefinition def, String locale) { final Element channel = doc.createElement("channel"); // the ID attribute is the identifier for the Channel element channel.setAttribute("ID", chanId); channel.setIdAttribute("ID", true); channel.setAttribute("chanID", def.getPortletDefinitionId().getStringId()); channel.setAttribute("timeout", String.valueOf(def.getTimeout())); if (locale != null) { channel.setAttribute("name", def.getName(locale)); channel.setAttribute("title", def.getTitle(locale)); channel.setAttribute("description", def.getDescription(locale)); channel.setAttribute("locale", locale); } else { channel.setAttribute("name", def.getName()); channel.setAttribute("title", def.getTitle()); channel.setAttribute("description", def.getDescription()); } channel.setAttribute("fname", def.getFName()); // chanClassArg is so named to highlight that we are using the argument // to the method rather than the instance variable chanClass channel.setAttribute("typeID", String.valueOf(def.getType().getId())); for (final IPortletDefinitionParameter param : def.getParameters()) { final Element parameter = doc.createElement("parameter"); parameter.setAttribute("name", param.getName()); parameter.setAttribute("value", param.getValue()); channel.appendChild(parameter); } return channel; }
@Override @PortalTransactional public IPortletDefinition savePortletDefinition(IPortletDefinition portletDefinition) { Validate.notNull(portletDefinition, "portletDefinition can not be null"); Validate.notNull( portletDefinition.getType(), "portletDefinition portlet type can not be null"); Validate.notEmpty(portletDefinition.getFName(), "portletDefinition fname can not be null"); Validate.notEmpty(portletDefinition.getName(), "portletDefinition name can not be null"); Validate.notEmpty(portletDefinition.getTitle(), "portletDefinition title can not be null"); this.getEntityManager().persist(portletDefinition); return portletDefinition; }
@ResourceMapping @RequestMapping(params = "action=getEntityList") public ModelAndView getEntityList() throws Exception { final List<IPortletDefinition> portletDefs = portletDefinitionDao.getPortletDefinitions(); final List<TranslatableEntity> entities = new ArrayList<TranslatableEntity>(); for (IPortletDefinition portletDef : portletDefs) { TranslatableEntity entity = new TranslatableEntity(); entity.setId(portletDef.getPortletDefinitionId().getStringId()); entity.setTitle(portletDef.getTitle()); entities.add(entity); } return new ModelAndView("json", "entities", entities); }
portlets.add(pDef.getTitle());
@Override public String getPortletTitle( IPortletWindowId portletWindowId, HttpServletRequest request, HttpServletResponse response) { final IPortletDefinition portletDefinition = getPortletDefinition(portletWindowId, request); final IPortletDefinitionParameter disableDynamicTitle = portletDefinition.getParameter("disableDynamicTitle"); if (disableDynamicTitle == null || !Boolean.parseBoolean(disableDynamicTitle.getValue())) { try { final PortletRenderResult portletRenderResult = getPortletRenderResult(portletWindowId, request, response); if (portletRenderResult != null) { final String title = portletRenderResult.getTitle(); if (title != null) { return title; } } } catch (Exception e) { logger.warn( "unable to get portlet title, falling back to title defined in channel definition for portletWindowId " + portletWindowId); } } // we assume that response locale has been set to correct value String locale = response.getLocale().toString(); // return portlet title from channel definition return portletDefinition.getTitle(locale); }
portletDefinition.getPortletDefinitionId().getLongId(), fname, portletDefinition.getTitle(locale.toString()), portletDefinition.getDescription(locale.toString()));
@Override public SearchResults getSearchResults(PortletRequest request, SearchRequest query) { final String queryString = query.getSearchTerms().toLowerCase(); final List<IPortletDefinition> portlets = portletDefinitionRegistry.getAllPortletDefinitions(); final HttpServletRequest httpServletRequest = this.portalRequestUtils.getPortletHttpRequest(request); final SearchResults results = new SearchResults(); for (IPortletDefinition portlet : portlets) { if (portletRegistryUtil.matches(queryString, portlet)) { final SearchResult result = new SearchResult(); result.setTitle(portlet.getTitle()); result.setSummary(portlet.getDescription()); result.getType().add(searchResultType); String url = portletRegistryUtil.buildPortletUrl(httpServletRequest, portlet); if (url != null) { result.setExternalUrl(url); results.getSearchResult().add(result); } } } return results; } }
/** * Construct channel information from a Channel Definition object. * * @param definition */ public UserLayoutChannelDescription(IPortletDefinition definition) { this.title = definition.getTitle(); this.name = definition.getName(); this.name = definition.getName(); this.description = definition.getDescription(); this.channelPublishId = String.valueOf(definition.getPortletDefinitionId().getStringId()); this.channelTypeId = String.valueOf(definition.getType().getId()); this.functionalName = definition.getFName(); this.timeout = definition.getTimeout(); for (IPortletDefinitionParameter param : definition.getParameters()) { this.setParameterValue(param.getName(), param.getValue()); } }
private ChannelBean getChannel( IPortletDefinition definition, WebRequest request, Locale locale) { ChannelBean channel = new ChannelBean(); channel.setId(definition.getPortletDefinitionId().getStringId()); channel.setDescription(definition.getDescription(locale.toString())); channel.setFname(definition.getFName()); channel.setName(definition.getName(locale.toString())); channel.setState(definition.getLifecycleState().toString()); channel.setTitle(definition.getTitle(locale.toString())); channel.setTypeId(definition.getType().getId()); // See api docs for postProcessIconUrlParameter() below IPortletDefinitionParameter iconParameter = definition.getParameter(ICON_URL_PARAMETER_NAME); if (iconParameter != null) { IPortletDefinitionParameter evaluated = postProcessIconUrlParameter(iconParameter, request); channel.setIconUrl(evaluated.getValue()); } return channel; }
title = portletDef.getTitle(); description = portletDef.getDescription(); fname = portletDef.getFName();
@Override @PortalTransactional public IMarketplaceRating getRating(String userName, IPortletDefinition portletDefinition) { PortletDefinitionImpl tempPortlet = new PortletDefinitionImpl( portletDefinition.getType(), portletDefinition.getFName(), portletDefinition.getName(), portletDefinition.getTitle(), portletDefinition.getPortletDescriptorKey().getWebAppName(), portletDefinition.getPortletDescriptorKey().getPortletName(), portletDefinition.getPortletDescriptorKey().isFrameworkPortlet(), portletDefinition.getPortletDefinitionId()); MarketplaceRatingPK tempPK = new MarketplaceRatingPK(userName, tempPortlet); return this.getRating(tempPK); }
@Override @PortalTransactional public IMarketplaceRating createOrUpdateRating( int rating, String userName, String review, IPortletDefinition portletDefinition) { MarketplaceRatingImpl temp = new MarketplaceRatingImpl(); PortletDefinitionImpl tempPortlet = new PortletDefinitionImpl( portletDefinition.getType(), portletDefinition.getFName(), portletDefinition.getName(), portletDefinition.getTitle(), portletDefinition.getPortletDescriptorKey().getWebAppName(), portletDefinition.getPortletDescriptorKey().getPortletName(), portletDefinition.getPortletDescriptorKey().isFrameworkPortlet(), portletDefinition.getPortletDefinitionId()); MarketplaceRatingPK tempPK = new MarketplaceRatingPK(userName, tempPortlet); temp.setMarketplaceRatingPK(tempPK); temp.setRating(rating); temp.setReview(review); return this.createOrUpdateRating(temp); }
protected IUserLayoutChannelDescription createUserLayoutChannelDescription( String nodeId, IPortletDefinition chanDef) { IUserLayoutChannelDescription ulnd = new UserLayoutChannelDescription(); ulnd.setId(nodeId); ulnd.setName(chanDef.getName()); ulnd.setUnremovable(true); ulnd.setImmutable(true); ulnd.setHidden(false); ulnd.setTitle(chanDef.getTitle()); ulnd.setDescription(chanDef.getDescription()); ulnd.setChannelPublishId("" + chanDef.getPortletDefinitionId().getStringId()); ulnd.setChannelTypeId("" + chanDef.getType().getId()); ulnd.setFunctionalName(chanDef.getFName()); ulnd.setTimeout(chanDef.getTimeout()); Set<IPortletDefinitionParameter> parms = chanDef.getParameters(); for (IPortletDefinitionParameter parm : parms) { ulnd.setParameterValue(parm.getName(), parm.getValue()); } return ulnd; }