public TaskRecordDisplayTerms(PortletRequest portletRequest) { super(portletRequest); createDate = ParamUtil.getString(portletRequest, CREATE_DATE); description = ParamUtil.getString(portletRequest, DESCRIPTION); duration = ParamUtil.getLong(portletRequest, DURATION); fromDate = ParamUtil.getString(portletRequest, FROM_DATE); groupId = ParamUtil.getLong(portletRequest, GROUP_ID); ownerUserId = ParamUtil.getLong(portletRequest, OWNER_USER_ID); modifiedDate = ParamUtil.getString(portletRequest, MODIFIED_DATE); String statusString = ParamUtil.getString(portletRequest, STATUS); if (Validator.isNotNull(statusString)) { status = GetterUtil.getInteger(statusString); } ticketURL = ParamUtil.getString(portletRequest, TICKET_URL); taskRecordId = ParamUtil.getLong(portletRequest, TASKRECORDID); untilDate = ParamUtil.getString(portletRequest, UNTIL_DATE); userName = ParamUtil.getString(portletRequest, USER_NAME); workPackage = ParamUtil.getString(portletRequest, WORK_PACKAGE); }
public ContactDisplayTerms(PortletRequest portletRequest) { super(portletRequest); company = ParamUtil.getString(portletRequest, COMPANY); contactId = ParamUtil.getString(portletRequest, CONTACT_ID); createDate = ParamUtil.getString(portletRequest, CREATE_DATE); email = ParamUtil.getString(portletRequest, EMAIL); fax = ParamUtil.getString(portletRequest, FAX); fullName = ParamUtil.getString(portletRequest, FULL_NAME); // TODO: add default IMPP name = ParamUtil.getString(portletRequest, NAME); modifiedDate = ParamUtil.getString(portletRequest, MODIFIED_DATE); String statusString = ParamUtil.getString(portletRequest, STATUS); if (Validator.isNotNull(statusString)) { status = GetterUtil.getInteger(statusString); } phone = ParamUtil.getString(portletRequest, PHONE); userName = ParamUtil.getString(portletRequest, USER_NAME); }
public ContactSearchTerms(PortletRequest portletRequest) { super(portletRequest); company = DAOParamUtil.getString(portletRequest, COMPANY); contactId = DAOParamUtil.getString(portletRequest, CONTACT_ID); createDate = DAOParamUtil.getString(portletRequest, CREATE_DATE); email = DAOParamUtil.getString(portletRequest, EMAIL); fax = DAOParamUtil.getString(portletRequest, FAX); fullName = DAOParamUtil.getString(portletRequest, FULL_NAME); // TODO: set default impp modifiedDate = DAOParamUtil.getString(portletRequest, MODIFIED_DATE); name = DAOParamUtil.getString(portletRequest, NAME); phone = DAOParamUtil.getString(portletRequest, PHONE); status = DAOParamUtil.getInteger(portletRequest, STATUS); userName = DAOParamUtil.getString(portletRequest, USER_NAME); }
protected String getSaveAndContinueRedirect( ActionRequest actionRequest, Contact contact, Layout layout, String redirect) throws Exception { _log.info("getSaveAndContinueRedirect()"); PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute( JavaConstants.JAVAX_PORTLET_CONFIG); LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, portletConfig.getPortletName(), layout, PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcRenderCommandName", "editContact"); portletURL.setParameter(Constants.CMD, Constants.UPDATE, false); portletURL.setParameter("redirect", redirect, false); portletURL.setParameter( "groupId", String.valueOf(contact.getGroupId()), false); portletURL.setParameter( "contactId", String.valueOf(contact.getContactId()), false); portletURL.setWindowState(actionRequest.getWindowState()); return portletURL.toString(); }
public MeasurementDisplayTerms(PortletRequest portletRequest) { super(portletRequest); createDate = ParamUtil.getString(portletRequest, CREATE_DATE); data = ParamUtil.getString(portletRequest, DATA); from = ParamUtil.getLong(portletRequest, FROM); groupId = ParamUtil.getLong(portletRequest, GROUP_ID); id = ParamUtil.getString(portletRequest, ID); measurementId = ParamUtil.getLong(portletRequest, MEASUREMENT_ID); modifiedDate = ParamUtil.getString(portletRequest, MODIFIED_DATE); name = ParamUtil.getString(portletRequest, NAME); String statusString = ParamUtil.getString(portletRequest, STATUS); if (Validator.isNotNull(statusString)) { status = GetterUtil.getInteger(statusString); } until = ParamUtil.getLong(portletRequest, UNTIL); userName = ParamUtil.getString(portletRequest, USER_NAME); }
protected String getSaveAndContinueRedirect( ActionRequest actionRequest, Measurement measurement, Layout layout, String redirect) throws Exception { PortletConfig portletConfig = (PortletConfig)actionRequest.getAttribute( JavaConstants.JAVAX_PORTLET_CONFIG); LiferayPortletURL portletURL = PortletURLFactoryUtil.create(actionRequest, portletConfig.getPortletName(), layout, PortletRequest.RENDER_PHASE); portletURL.setParameter("mvcRenderCommandName", "editMeasurement"); portletURL.setParameter(Constants.CMD, Constants.UPDATE, false); portletURL.setParameter("redirect", redirect, false); portletURL.setParameter( "groupId", String.valueOf(measurement.getGroupId()), false); portletURL.setParameter( "measurementId", String.valueOf(measurement.getMeasurementId()), false); portletURL.setWindowState(actionRequest.getWindowState()); return portletURL.toString(); }
/** * {@inheritDoc} */ @Override public JSONArray getSuggestions( PortletRequest portletRequest) throws Exception { String[] suggestions = getSuggestionsAsStringArray(portletRequest); // Build results JSON object. JSONArray resultsArray = JSONFactoryUtil.createJSONArray(); if (suggestions != null) { for (String s : suggestions) { resultsArray.put(s); } } return resultsArray; }
/** * Get layout by friendlyurl. * * @param resourceRequest * @return layout * @throws PortalException if layout is not found */ public static Layout getLayoutByFriendlyURL( PortletRequest portletRequest, String layoutFriendlyURL) throws PortalException { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); if (layoutFriendlyURL != null) { return LayoutLocalServiceUtil.getFriendlyURLLayout( themeDisplay.getScopeGroupId(), themeDisplay.getLayout().isPrivateLayout(), layoutFriendlyURL); } throw new PortalException( "Couldn't find asset publisher layout for " + layoutFriendlyURL + ". Please check configuration."); }
/** * Get redirect url. * * @return redirect url * @throws PortalException */ public static String getRedirectURL(PortletRequest portletRequest) throws PortalException { StringBundler sb = new StringBundler(); sb.append(GSearchUtil.getCurrentLayoutFriendlyURL(portletRequest)); sb.append("?"); sb.append(GSearchWebKeys.KEYWORDS).append("=").append( ParamUtil.getString(portletRequest, GSearchWebKeys.KEYWORDS)); sb.append("&").append(GSearchWebKeys.FILTER_SCOPE).append("=").append( ParamUtil.getString(portletRequest, GSearchWebKeys.FILTER_SCOPE)); sb.append("&").append(GSearchWebKeys.FILTER_TIME).append("=").append( ParamUtil.getString(portletRequest, GSearchWebKeys.FILTER_TIME)); sb.append("&").append(GSearchWebKeys.FILTER_TYPE).append("=").append( ParamUtil.getString(portletRequest, GSearchWebKeys.FILTER_TYPE)); sb.append("&").append(GSearchWebKeys.SORT_FIELD).append("=").append( ParamUtil.getString(portletRequest, GSearchWebKeys.SORT_FIELD)); sb.append("&").append(GSearchWebKeys.SORT_DIRECTION).append("=").append( ParamUtil.getString(portletRequest, GSearchWebKeys.SORT_DIRECTION)); sb.append("&").append(GSearchWebKeys.START).append("=").append( ParamUtil.getString(portletRequest, GSearchWebKeys.START)); return HtmlUtil.escapeURL(sb.toString()); }
public TaskRecordSearchTerms(PortletRequest portletRequest) { super(portletRequest); description = DAOParamUtil.getString(portletRequest, DESCRIPTION); fromDate = DAOParamUtil.getString(portletRequest, FROM_DATE); groupId = DAOParamUtil.getLong(portletRequest, GROUP_ID); ownerUserId = DAOParamUtil.getLong(portletRequest, OWNER_USER_ID); status = DAOParamUtil.getInteger(portletRequest, STATUS); untilDate = DAOParamUtil.getString(portletRequest, UNTIL_DATE); workPackage = DAOParamUtil.getString(portletRequest, WORK_PACKAGE); }
@Override public SearchResultsContainer search(PortletRequest request, PortletResponse response, String tabId, int pageOffset, boolean isLoadMore) throws ReadOnlyException, ValidatorException, IOException, SearchException { FlashlightSearchConfiguration config = this.readConfiguration(request.getPreferences()); Map<String, FlashlightSearchConfigurationTab> tabs = config.getTabs(); FacetedSearcher searcher = this.facetedSearcherManager.createFacetedSearcher(); LinkedHashMap<FlashlightSearchConfigurationTab, SearchPage> resultMap = new LinkedHashMap<>(tabs.size()); for(FlashlightSearchConfigurationTab tab : tabs.values()) { int pageSize; int loadMoreSize; if(tab.getId().equals(tabId)) { pageSize = tab.getFullPageSize(); } else { pageSize = tab.getPageSize(); } if(isLoadMore) { loadMoreSize = tab.getLoadMorePageSize(); } else { loadMoreSize = 0; } resultMap.put(tab, this.search(request, response, config, tab, searcher, pageOffset, pageSize, loadMoreSize)); } return new SearchResultsContainer(resultMap); }
/** * Gets the search result's view URL * * @param document The searched document * @param request The request * @param response The response * @param currentLayout The current page * @param tabId The search tab ID * * @return The search result URL */ private String getAssetViewURL(Document document, PortletRequest request, PortletResponse response, Layout currentLayout, String tabId, String keywords) { String className = document.get(Field.ENTRY_CLASS_NAME); long classPK = GetterUtil.getLong(document.get(Field.ENTRY_CLASS_PK)); String currentUrl = this.portal.getCurrentURL(request); String returnedUrl; if(ASSET_TYPE.equals(className) && classPK > 0) { try { String portletId = (String) request.getAttribute(WebKeys.PORTLET_ID); PortletURL viewInPortletUrlObj = this.portletUrlFactory.create(request, portletId, currentLayout, LIFECYCLE_RENDER); viewInPortletUrlObj.setParameter(PortletRequestParameter.VIEW_MODE.getName(), ViewMode.VIEW_JOURNAL.getParamValue()); viewInPortletUrlObj.setParameter(Field.ENTRY_CLASS_PK, Long.toString(classPK)); viewInPortletUrlObj.setParameter(PortletRequestParameter.TAB_ID.getName(), tabId); viewInPortletUrlObj.setParameter(PortletRequestParameter.KEYWORDS.getName(), keywords); String viewInPortletUrl = viewInPortletUrlObj.toString(); AssetRendererFactory<?> assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(className); AssetRenderer<?> assetRenderer = assetRendererFactory.getAssetRenderer(classPK); returnedUrl = assetRenderer.getURLViewInContext((LiferayPortletRequest) request, (LiferayPortletResponse) response, viewInPortletUrl); } catch(Exception e) { returnedUrl = currentUrl; } } else { returnedUrl = currentUrl; } return returnedUrl; }
/** * Puts commonly used variables in the template context * @param request The request * @param response The response * @param template The template */ private void enrichTemplateContext(RenderRequest request, RenderResponse response, Template template) { template.put(TemplateVariable.LOCALE.getVariableName(), request.getLocale()); template.put(TemplateVariable.PORTLET_CONTEXT.getVariableName(), this.getPortletContext()); template.put(TemplateVariable.REQUEST.getVariableName(), request); template.put(TemplateVariable.RESPONSE.getVariableName(), response); template.put(TemplateVariable.THEME_DISPLAY.getVariableName(), request.getAttribute(WebKeys.THEME_DISPLAY)); template.put(TemplateVariable.USER_INFO.getVariableName(), request.getAttribute(PortletRequest.USER_INFO)); }
static public void setCharacterEncoding( PortletRequest req, String encoding) { UploadedFiles files = (UploadedFiles) req.getAttribute(_UPLOADED_FILES_KEY); _setCharacterEncoding(files, encoding); }
@Override protected Summary doGetSummary(Document document, Locale locale, String snippet, PortletRequest portletRequest, PortletResponse portletResponse) throws Exception { Summary summary = createSummary(document, Field.TITLE, Field.CONTENT); return summary; }
@Override public void render( RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); String portletId = portletDisplay.getId(); JSONObject urlObject = JSONFactoryUtil.createJSONObject(); JSONObject apiObject = JSONFactoryUtil.createJSONObject(); // url PortletURL dossierInfoURL = PortletURLFactoryUtil.create( renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); dossierInfoURL.setPortletMode(PortletMode.VIEW); dossierInfoURL.setWindowState(LiferayWindowState.EXCLUSIVE); dossierInfoURL.setParameter( "mvcPath", "/templates/lookup_dossier/dossierinfo.ftl"); urlObject.put("dossierinfo", dossierInfoURL.toString()); // api apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2"); apiObject.put( "portletNamespace", themeDisplay.getPortletDisplay().getNamespace()); // set varible renderRequest.setAttribute("ajax", urlObject); renderRequest.setAttribute("api", apiObject); super.render(renderRequest, renderResponse); }
@Override public void render( RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); String portletId = portletDisplay.getId(); JSONObject urlObject = JSONFactoryUtil.createJSONObject(); JSONObject apiObject = JSONFactoryUtil.createJSONObject(); // url PortletURL registerResultURL = PortletURLFactoryUtil.create( renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); registerResultURL.setPortletMode(PortletMode.VIEW); registerResultURL.setWindowState(LiferayWindowState.EXCLUSIVE); registerResultURL.setParameter( "mvcPath", "/templates/applicant/register_result.ftl"); urlObject.put("register_result", registerResultURL.toString()); // api apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2"); apiObject.put( "portletNamespace", themeDisplay.getPortletDisplay().getNamespace()); // set varible renderRequest.setAttribute("ajax", urlObject); renderRequest.setAttribute("api", apiObject); super.render(renderRequest, renderResponse); }
@Override public void render( RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); String portletId = portletDisplay.getId(); JSONObject urlObject = JSONFactoryUtil.createJSONObject(); JSONObject apiObject = JSONFactoryUtil.createJSONObject(); // url PortletURL confirmPasswordURL = PortletURLFactoryUtil.create( renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); confirmPasswordURL.setPortletMode(PortletMode.VIEW); confirmPasswordURL.setWindowState(LiferayWindowState.EXCLUSIVE); confirmPasswordURL.setParameter( "mvcPath", "/templates/applicant/confirm_password.ftl"); urlObject.put("confirm_password", confirmPasswordURL.toString()); // api apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2"); apiObject.put( "portletNamespace", themeDisplay.getPortletDisplay().getNamespace()); // set varible renderRequest.setAttribute("ajax", urlObject); renderRequest.setAttribute("api", apiObject); super.render(renderRequest, renderResponse); }
@Override public void render( RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); String portletId = portletDisplay.getId(); JSONObject urlObject = JSONFactoryUtil.createJSONObject(); JSONObject apiObject = JSONFactoryUtil.createJSONObject(); // url PortletURL serviceInfoLookupURL = PortletURLFactoryUtil.create( renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); serviceInfoLookupURL.setPortletMode(PortletMode.VIEW); serviceInfoLookupURL.setWindowState(LiferayWindowState.EXCLUSIVE); serviceInfoLookupURL.setParameter( "mvcPath", "/templates/homepage/serviceinfo_lookup.ftl"); urlObject.put("serviceinfo_lookup", serviceInfoLookupURL.toString()); // api apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2"); apiObject.put( "portletNamespace", themeDisplay.getPortletDisplay().getNamespace()); // set varible renderRequest.setAttribute("ajax", urlObject); renderRequest.setAttribute("api", apiObject); super.render(renderRequest, renderResponse); }
public MeasurementSearchTerms(PortletRequest portletRequest) { super(portletRequest); data = DAOParamUtil.getString(portletRequest, DATA); from = DAOParamUtil.getLong(portletRequest, FROM); groupId = DAOParamUtil.getLong(portletRequest, GROUP_ID); status = DAOParamUtil.getInteger(portletRequest, STATUS); until = DAOParamUtil.getLong(portletRequest, UNTIL); }
@Override public void render( RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); String portletId = portletDisplay.getId(); JSONObject urlObject = JSONFactoryUtil.createJSONObject(); JSONObject apiObject = JSONFactoryUtil.createJSONObject(); // url PortletURL dossierLookupURL = PortletURLFactoryUtil.create( renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); dossierLookupURL.setPortletMode(PortletMode.VIEW); dossierLookupURL.setWindowState(LiferayWindowState.EXCLUSIVE); dossierLookupURL.setParameter( "mvcPath", "/templates/homepage/dossier_lookup.ftl"); urlObject.put("dossier_lookup", dossierLookupURL.toString()); // api apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2"); apiObject.put( "portletNamespace", themeDisplay.getPortletDisplay().getNamespace()); // set varible renderRequest.setAttribute("ajax", urlObject); renderRequest.setAttribute("api", apiObject); super.render(renderRequest, renderResponse); }
public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); String portletId = portletDisplay.getId(); JSONObject urlObject = JSONFactoryUtil.createJSONObject(); JSONObject apiObject = JSONFactoryUtil.createJSONObject(); // url PortletURL dossierLookupURL = PortletURLFactoryUtil.create(renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); dossierLookupURL.setPortletMode(PortletMode.VIEW); dossierLookupURL.setWindowState(LiferayWindowState.EXCLUSIVE); dossierLookupURL.setParameter("mvcPath", "/templates/homepage/search_serviceinfo.ftl"); urlObject.put("dossier_lookup", dossierLookupURL.toString()); // api apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2"); apiObject.put("portletNamespace", themeDisplay.getPortletDisplay().getNamespace()); // set varible renderRequest.setAttribute("ajax", urlObject); renderRequest.setAttribute("api", apiObject); super.render(renderRequest, renderResponse); }
@Override public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); String portletId = portletDisplay.getId(); JSONObject urlObject = JSONFactoryUtil.createJSONObject(); JSONObject apiObject = JSONFactoryUtil.createJSONObject(); // url PortletURL dossierLookupURL = PortletURLFactoryUtil.create(renderRequest, portletId, themeDisplay.getPlid(), PortletRequest.RENDER_PHASE); dossierLookupURL.setPortletMode(PortletMode.VIEW); dossierLookupURL.setWindowState(LiferayWindowState.EXCLUSIVE); dossierLookupURL.setParameter("mvcPath", "/templates/homepage/dossier_lookup.ftl"); urlObject.put("dossier_lookup", dossierLookupURL.toString()); // api apiObject.put("server", themeDisplay.getPortalURL() + "/o/rest/v2"); apiObject.put("portletNamespace", themeDisplay.getPortletDisplay().getNamespace()); // set varible renderRequest.setAttribute("ajax", urlObject); renderRequest.setAttribute("api", apiObject); super.render(renderRequest, renderResponse); }
@Override protected Summary doGetSummary(Document document, Locale locale, String snippet, PortletRequest portletRequest, PortletResponse portletResponse) throws Exception { Summary summary = createSummary(document); summary.setMaxContentLength(QueryUtil.ALL_POS); return summary; }