List of usage examples for com.liferay.portal.kernel.portlet LiferayWindowState EXCLUSIVE
WindowState EXCLUSIVE
To view the source code for com.liferay.portal.kernel.portlet LiferayWindowState EXCLUSIVE.
Click Source Link
From source file:com.liferay.contacts.contactscenter.portlet.ContactsCenterPortlet.java
License:Open Source License
protected JSONObject getEntryJSONObject(PortletResponse portletResponse, ThemeDisplay themeDisplay, Entry entry, String redirect) throws Exception { entry = entry.toEscapedModel();/*from w w w . ja v a 2s. co m*/ JSONObject jsonObject = ContactsUtil.getEntryJSONObject(entry); jsonObject.put("portraitURL", themeDisplay.getPathImage() + "/user_male_portrait?img_id=0"); jsonObject.put("redirect", redirect); LiferayPortletResponse liferayPortletResponse = (LiferayPortletResponse) portletResponse; PortletURL viewSummaryURL = liferayPortletResponse.createRenderURL(); viewSummaryURL.setParameter("mvcPath", "/contacts_center/view_resources.jsp"); viewSummaryURL.setParameter("redirect", redirect); viewSummaryURL.setParameter("entryId", String.valueOf(entry.getEntryId())); viewSummaryURL.setParameter("portalUser", Boolean.FALSE.toString()); viewSummaryURL.setWindowState(LiferayWindowState.EXCLUSIVE); jsonObject.put("viewSummaryURL", viewSummaryURL.toString()); return jsonObject; }
From source file:com.liferay.contacts.contactscenter.portlet.ContactsCenterPortlet.java
License:Open Source License
protected JSONObject getUserJSONObject(PortletResponse portletResponse, ThemeDisplay themeDisplay, User user) throws Exception { user = user.toEscapedModel();// w ww. j a v a2 s.c o m JSONObject jsonObject = ContactsUtil.getUserJSONObject(themeDisplay.getUserId(), user); jsonObject.put("portraitURL", user.getPortraitURL(themeDisplay)); LiferayPortletResponse liferayPortletResponse = (LiferayPortletResponse) portletResponse; PortletURL viewSummaryURL = liferayPortletResponse.createRenderURL(); viewSummaryURL.setParameter("mvcPath", "/contacts_center/view_resources.jsp"); viewSummaryURL.setParameter("userId", String.valueOf(user.getUserId())); viewSummaryURL.setParameter("portalUser", Boolean.TRUE.toString()); viewSummaryURL.setWindowState(LiferayWindowState.EXCLUSIVE); jsonObject.put("viewSummaryURL", viewSummaryURL.toString()); return jsonObject; }
From source file:com.liferay.contacts.web.internal.portlet.ContactsCenterPortlet.java
License:Open Source License
protected JSONObject getEntryJSONObject(PortletResponse portletResponse, ThemeDisplay themeDisplay, Entry entry, String redirect) throws Exception { entry = entry.toEscapedModel();/*from ww w. j a v a 2 s . c o m*/ JSONObject jsonObject = ContactsUtil.getEntryJSONObject(entry); jsonObject.put("portraitURL", themeDisplay.getPathImage() + "/user_male_portrait?img_id=0"); jsonObject.put("redirect", redirect); LiferayPortletResponse liferayPortletResponse = portal.getLiferayPortletResponse(portletResponse); PortletURL viewSummaryURL = liferayPortletResponse.createRenderURL(); viewSummaryURL.setParameter("mvcPath", "/contacts_center/view_resources.jsp"); viewSummaryURL.setParameter("redirect", redirect); viewSummaryURL.setParameter("entryId", String.valueOf(entry.getEntryId())); viewSummaryURL.setParameter("portalUser", Boolean.FALSE.toString()); viewSummaryURL.setWindowState(LiferayWindowState.EXCLUSIVE); jsonObject.put("viewSummaryURL", viewSummaryURL.toString()); return jsonObject; }
From source file:com.liferay.contacts.web.internal.portlet.ContactsCenterPortlet.java
License:Open Source License
protected JSONObject getUserJSONObject(PortletResponse portletResponse, ThemeDisplay themeDisplay, User user) throws Exception { user = user.toEscapedModel();//from w w w. ja v a 2 s.c om JSONObject jsonObject = ContactsUtil.getUserJSONObject(themeDisplay.getUserId(), user); jsonObject.put("portraitURL", user.getPortraitURL(themeDisplay)); LiferayPortletResponse liferayPortletResponse = portal.getLiferayPortletResponse(portletResponse); PortletURL viewSummaryURL = liferayPortletResponse.createRenderURL(); viewSummaryURL.setParameter("mvcPath", "/contacts_center/view_resources.jsp"); viewSummaryURL.setParameter("userId", String.valueOf(user.getUserId())); viewSummaryURL.setParameter("portalUser", Boolean.TRUE.toString()); viewSummaryURL.setWindowState(LiferayWindowState.EXCLUSIVE); jsonObject.put("viewSummaryURL", viewSummaryURL.toString()); return jsonObject; }
From source file:com.liferay.contenttargeting.portlet.CampaignContentDisplayPortlet.java
License:Open Source License
protected void populateViewContext(String path, PortletRequest portletRequest, PortletResponse portletResponse, Template template, TemplateHashModel staticModels) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletPreferences portletPreferences = portletRequest.getPreferences(); long assetEntryIdDefault = GetterUtil.getLong(portletPreferences.getValue("assetEntryIdDefault", null)); boolean contentDefaultValue = GetterUtil .getBoolean(portletPreferences.getValue("contentDefaultValue", null)); if (Validator.isNull(path) || path.equals(CampaignContentDisplayPath.VIEW)) { CampaignQueryRule queryRule = null; long[] userSegmentIds = (long[]) portletRequest.getAttribute(WebKeys.USER_SEGMENT_IDS); if (userSegmentIds != null) { long[] groupIds = ContentTargetingUtil .getAncestorsAndCurrentGroupIds(themeDisplay.getSiteGroupId()); Campaign campaign = _campaignLocalService.fetchCurrentMaxPriorityCampaign(groupIds, userSegmentIds); if (campaign != null) { queryRule = CampaignQueryRuleUtil.match(campaign.getCampaignId(), portletPreferences, themeDisplay.getLocale()); template.put("campaignClassName", Campaign.class.getName()); template.put("campaignClassPK", campaign.getCampaignId()); template.put("groupId", campaign.getGroupId()); }/* w ww . j av a2 s .c o m*/ } boolean isMatchingRule = false; if ((queryRule != null) || (contentDefaultValue && (assetEntryIdDefault > 0))) { isMatchingRule = true; long assetEntryId = assetEntryIdDefault; if (queryRule != null) { assetEntryId = queryRule.getAssetEntryId(); } AssetEntry assetEntry = AssetEntryLocalServiceUtil.fetchAssetEntry(assetEntryId); AssetRendererFactory assetRendererFactory = AssetRendererFactoryRegistryUtil .getAssetRendererFactoryByClassName(assetEntry.getClassName()); AssetRenderer assetRenderer = assetRendererFactory.getAssetRenderer(assetEntry.getClassPK()); portletRequest.setAttribute("view.jsp-results", new ArrayList()); portletRequest.setAttribute("view.jsp-assetEntryIndex", new Integer(0)); portletRequest.setAttribute("view.jsp-assetEntry", assetEntry); portletRequest.setAttribute("view.jsp-assetRendererFactory", assetRendererFactory); portletRequest.setAttribute("view.jsp-assetRenderer", assetRenderer); portletRequest.setAttribute("view.jsp-title", assetEntry.getTitle(themeDisplay.getLocale())); portletRequest.setAttribute("view.jsp-show", new Boolean(false)); portletRequest.setAttribute("view.jsp-print", new Boolean(false)); template.put("assetEntryClassName", assetEntry.getClassName()); template.put("assetEntryClassPK", assetEntry.getClassPK()); } else { portletRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.TRUE); } template.put("isMatchingRule", isMatchingRule); template.put("liferayWindowStatePopUp", LiferayWindowState.POP_UP); } else if (path.equals(CampaignContentDisplayPath.EDIT_QUERY_RULE) || path.equals(CampaignContentDisplayPath.CONFIGURATION)) { template.put("assetRendererFactories", getSelectableAssetRendererFactories(themeDisplay.getCompanyId())); String assetImageDefault = StringPool.BLANK; String assetTitleDefault = StringPool.BLANK; String assetTypeDefault = StringPool.BLANK; if (assetEntryIdDefault > 0) { AssetEntry assetEntry = AssetEntryLocalServiceUtil.fetchAssetEntry(assetEntryIdDefault); AssetRendererFactory assetRendererFactory = AssetRendererFactoryRegistryUtil .getAssetRendererFactoryByClassName(assetEntry.getClassName()); AssetRenderer assetRenderer = assetRendererFactory.getAssetRenderer(assetEntry.getClassPK()); assetImageDefault = assetRenderer.getThumbnailPath(portletRequest); assetTitleDefault = assetRenderer.getTitle(themeDisplay.getLocale()); assetTypeDefault = assetRendererFactory.getTypeName(themeDisplay.getLocale(), true); } List<Campaign> campaigns = _campaignService.getCampaigns(themeDisplay.getScopeGroupId()); template.put("campaigns", campaigns); template.put("assetEntryIdDefault", assetEntryIdDefault); template.put("assetImageDefault", assetImageDefault); template.put("assetTitleDefault", assetTitleDefault); template.put("assetTypeDefault", assetTypeDefault); template.put("contentDefaultValue", contentDefaultValue); template.put("liferayWindowStateExclusive", LiferayWindowState.EXCLUSIVE); template.put("portletPreferences", portletPreferences); int[] queryRulesIndexes = GetterUtil .getIntegerValues(portletPreferences.getValues("queryLogicIndexes", null), new int[] { 0 }); template.put("queryLogicIndexes", queryRulesIndexes); template.put("campaignQueryRuleUtilClass", staticModels.get("com.liferay.contenttargeting.portlet.util." + "CampaignQueryRuleUtil")); template.put("userSegmentContentDisplayUtilClass", staticModels .get("com.liferay.contenttargeting.portlet.util." + "UserSegmentContentDisplayUtil")); } }
From source file:com.liferay.contenttargeting.portlet.UserSegmentContentDisplayPortlet.java
License:Open Source License
protected void populateViewContext(String path, PortletRequest portletRequest, PortletResponse portletResponse, Template template, TemplateHashModel staticModels) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); PortletPreferences portletPreferences = portletRequest.getPreferences(); long assetEntryIdDefault = GetterUtil.getLong(portletPreferences.getValue("assetEntryIdDefault", null)); boolean contentDefaultValue = GetterUtil .getBoolean(portletPreferences.getValue("contentDefaultValue", null)); if (Validator.isNull(path) || path.equals(UserSegmentContentDisplayPath.VIEW)) { UserSegmentQueryRule queryRule = null; long[] userSegmentIds = (long[]) portletRequest.getAttribute(WebKeys.USER_SEGMENT_IDS); if (userSegmentIds != null) { long[] userSegmentAssetCategoryIds = ContentTargetingUtil.getAssetCategoryIds(userSegmentIds); queryRule = UserSegmentQueryRuleUtil.match(userSegmentAssetCategoryIds, portletPreferences, themeDisplay.getLocale()); }// ww w . j a v a2s.c o m boolean isMatchingRule = false; if ((queryRule != null) || (contentDefaultValue && (assetEntryIdDefault > 0))) { isMatchingRule = true; long assetEntryId = assetEntryIdDefault; if (queryRule != null) { assetEntryId = queryRule.getAssetEntryId(); } AssetEntry assetEntry = AssetEntryLocalServiceUtil.fetchAssetEntry(assetEntryId); AssetRendererFactory assetRendererFactory = AssetRendererFactoryRegistryUtil .getAssetRendererFactoryByClassName(assetEntry.getClassName()); AssetRenderer assetRenderer = assetRendererFactory.getAssetRenderer(assetEntry.getClassPK()); portletRequest.setAttribute("view.jsp-results", new ArrayList()); portletRequest.setAttribute("view.jsp-assetEntryIndex", new Integer(0)); portletRequest.setAttribute("view.jsp-assetEntry", assetEntry); portletRequest.setAttribute("view.jsp-assetRendererFactory", assetRendererFactory); portletRequest.setAttribute("view.jsp-assetRenderer", assetRenderer); portletRequest.setAttribute("view.jsp-title", assetEntry.getTitle(themeDisplay.getLocale())); portletRequest.setAttribute("view.jsp-show", new Boolean(false)); portletRequest.setAttribute("view.jsp-print", new Boolean(false)); } else { portletRequest.setAttribute(WebKeys.PORTLET_CONFIGURATOR_VISIBILITY, Boolean.TRUE); } template.put("isMatchingRule", isMatchingRule); template.put("liferayWindowStatePopUp", LiferayWindowState.POP_UP); } else if (path.equals(UserSegmentContentDisplayPath.EDIT_QUERY_RULE) || path.equals(UserSegmentContentDisplayPath.CONFIGURATION)) { template.put("assetRendererFactories", getSelectableAssetRendererFactories(themeDisplay.getCompanyId())); String assetImageDefault = StringPool.BLANK; String assetTitleDefault = StringPool.BLANK; String assetTypeDefault = StringPool.BLANK; if (assetEntryIdDefault > 0) { AssetEntry assetEntry = AssetEntryLocalServiceUtil.fetchAssetEntry(assetEntryIdDefault); AssetRendererFactory assetRendererFactory = AssetRendererFactoryRegistryUtil .getAssetRendererFactoryByClassName(assetEntry.getClassName()); AssetRenderer assetRenderer = assetRendererFactory.getAssetRenderer(assetEntry.getClassPK()); assetImageDefault = assetRenderer.getThumbnailPath(portletRequest); assetTitleDefault = assetRenderer.getTitle(themeDisplay.getLocale()); assetTypeDefault = assetRendererFactory.getTypeName(themeDisplay.getLocale(), true); } template.put("assetEntryIdDefault", assetEntryIdDefault); template.put("assetImageDefault", assetImageDefault); template.put("assetTitleDefault", assetTitleDefault); template.put("assetTypeDefault", assetTypeDefault); template.put("contentDefaultValue", contentDefaultValue); template.put("liferayWindowStateExclusive", LiferayWindowState.EXCLUSIVE); template.put("portletPreferences", portletPreferences); int[] queryRulesIndexes = GetterUtil .getIntegerValues(portletPreferences.getValues("queryLogicIndexes", null), new int[] { 0 }); template.put("queryLogicIndexes", queryRulesIndexes); template.put("userSegmentQueryRuleUtilClass", staticModels.get("com.liferay.contenttargeting.portlet.util." + "UserSegmentQueryRuleUtil")); template.put("userSegmentContentDisplayUtilClass", staticModels .get("com.liferay.contenttargeting.portlet.util." + "UserSegmentContentDisplayUtil")); ServiceContext serviceContext = new ServiceContext(); serviceContext.setScopeGroupId(themeDisplay.getScopeGroupId()); long[] vocabularyGroupIds = new long[1]; long[] vocabularyIds = new long[1]; if (themeDisplay.getScopeGroupId() == themeDisplay.getCompanyGroupId()) { vocabularyGroupIds[0] = themeDisplay.getCompanyGroupId(); vocabularyIds[0] = UserSegmentUtil.getAssetVocabularyId(themeDisplay.getUserId(), serviceContext); } else { vocabularyGroupIds = ContentTargetingUtil .getAncestorsAndCurrentGroupIds(themeDisplay.getSiteGroupId()); vocabularyIds = UserSegmentUtil.getAssetVocabularyIds(vocabularyGroupIds); } template.put("vocabularyGroupIds", StringUtil.merge(vocabularyGroupIds)); template.put("vocabularyIds", StringUtil.merge(vocabularyIds)); } }
From source file:com.liferay.portlet.configuration.web.internal.portlet.configuration.icon.ConfigurationTemplatesPortletConfigurationIcon.java
License:Open Source License
@Override public boolean isShow(PortletRequest portletRequest) { ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY); PermissionChecker permissionChecker = themeDisplay.getPermissionChecker(); try {/* w w w. j a v a2 s. c om*/ if (!GroupPermissionUtil.contains(permissionChecker, themeDisplay.getScopeGroupId(), ActionKeys.MANAGE_ARCHIVED_SETUPS)) { return false; } } catch (PortalException pe) { // LPS-52675 if (_log.isDebugEnabled()) { _log.debug(pe, pe); } return false; } WindowState windowState = portletRequest.getWindowState(); if (windowState.equals(LiferayWindowState.EXCLUSIVE)) { return false; } Layout layout = themeDisplay.getLayout(); if (layout.isTypeControlPanel()) { return false; } PortletDisplay portletDisplay = themeDisplay.getPortletDisplay(); return portletDisplay.isShowConfigurationIcon(); }
From source file:com.liferay.portlet.documentlibrary.util.DLFileEntryIndexer.java
License:Open Source License
@Override protected Summary doGetSummary(Document document, Locale locale, String snippet, PortletURL portletURL) { LiferayPortletURL liferayPortletURL = (LiferayPortletURL) portletURL; liferayPortletURL.setLifecycle(PortletRequest.ACTION_PHASE); try {/* w ww . ja v a 2 s. com*/ liferayPortletURL.setWindowState(LiferayWindowState.EXCLUSIVE); } catch (WindowStateException wse) { } String fileEntryId = document.get(Field.ENTRY_CLASS_PK); portletURL.setParameter("struts_action", "/document_library/get_file"); portletURL.setParameter("fileEntryId", fileEntryId); Summary summary = createSummary(document, Field.TITLE, Field.CONTENT); summary.setMaxContentLength(200); summary.setPortletURL(portletURL); return summary; }
From source file:com.liferay.portlet.documentlibrary.util.DLFolderIndexer.java
License:Open Source License
@Override protected Summary doGetSummary(Document document, Locale locale, String snippet, PortletURL portletURL) { LiferayPortletURL liferayPortletURL = (LiferayPortletURL) portletURL; liferayPortletURL.setLifecycle(PortletRequest.ACTION_PHASE); try {// ww w . j ava 2 s . c o m liferayPortletURL.setWindowState(LiferayWindowState.EXCLUSIVE); } catch (WindowStateException wse) { } String folderId = document.get(Field.ENTRY_CLASS_PK); portletURL.setParameter("struts_action", "/document_library/view"); portletURL.setParameter("folderId", folderId); Summary summary = createSummary(document, Field.TITLE, Field.DESCRIPTION); summary.setMaxContentLength(200); summary.setPortletURL(portletURL); return summary; }
From source file:com.liferay.portlet.documentlibrary.util.DLIndexer.java
License:Open Source License
@Override protected Summary doGetSummary(Document document, Locale locale, String snippet, PortletURL portletURL) { LiferayPortletURL liferayPortletURL = (LiferayPortletURL) portletURL; liferayPortletURL.setLifecycle(PortletRequest.ACTION_PHASE); try {/*from www . j ava 2s . co m*/ liferayPortletURL.setWindowState(LiferayWindowState.EXCLUSIVE); } catch (WindowStateException wse) { } String title = document.get(Field.TITLE); String content = snippet; if (Validator.isNull(snippet)) { content = StringUtil.shorten(document.get(Field.CONTENT), 200); } String fileEntryId = document.get(Field.ENTRY_CLASS_PK); portletURL.setParameter("struts_action", "/document_library/get_file"); portletURL.setParameter("fileEntryId", fileEntryId); return new Summary(title, content, portletURL); }