List of usage examples for com.liferay.portal.kernel.bean BeanParamUtil getLong
public static long getLong(Object bean, PortletRequest portletRequest, String param)
From source file:com.liferay.asset.categories.admin.web.internal.display.context.AssetCategoriesDisplayContext.java
License:Open Source License
public String getEditCategoryRedirect() throws PortalException { PortletURL backURL = _renderResponse.createRenderURL(); long parentCategoryId = BeanParamUtil.getLong(getCategory(), _request, "parentCategoryId"); backURL.setParameter("mvcPath", "/view_categories.jsp"); if (parentCategoryId > 0) { backURL.setParameter("categoryId", String.valueOf(parentCategoryId)); }/*from w w w. j a v a 2s . c om*/ if (getVocabularyId() > 0) { backURL.setParameter("vocabularyId", String.valueOf(getVocabularyId())); } return backURL.toString(); }
From source file:com.liferay.document.library.web.internal.display.context.DefaultDLEditFileEntryDisplayContext.java
License:Open Source License
private boolean _hasFolderWorkflowDefinitionLink() { try {// ww w .j a v a2 s . c o m if (_dlFileEntryType == null) { return false; } long folderId = BeanParamUtil.getLong(_fileEntry, _dlRequestHelper.getRequest(), "folderId"); return DLUtil.hasWorkflowDefinitionLink(_dlRequestHelper.getCompanyId(), _dlRequestHelper.getScopeGroupId(), folderId, _dlFileEntryType.getFileEntryTypeId()); } catch (Exception e) { throw new SystemException("Unable to check if folder has workflow definition link", e); } }
From source file:com.liferay.document.library.web.internal.display.context.logic.UIItemsBuilder.java
License:Open Source License
private UIItemsBuilder(HttpServletRequest request, FileVersion fileVersion, FileShortcut fileShortcut, ResourceBundle resourceBundle) { try {/* w w w .j av a2s .co m*/ _request = request; _fileVersion = fileVersion; _fileShortcut = fileShortcut; _resourceBundle = resourceBundle; FileEntry fileEntry = null; if (fileVersion != null) { fileEntry = fileVersion.getFileEntry(); } _fileEntry = fileEntry; _folderId = BeanParamUtil.getLong(_fileEntry, request, "folderId"); _themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); _fileEntryDisplayContextHelper = new FileEntryDisplayContextHelper(_themeDisplay.getPermissionChecker(), _fileEntry); _fileVersionDisplayContextHelper = new FileVersionDisplayContextHelper(fileVersion); } catch (PortalException pe) { throw new SystemException("Unable to build UIItemsBuilder for " + fileVersion, pe); } }
From source file:com.liferay.dynamic.data.mapping.internal.util.DDMTemplateHelperImpl.java
License:Open Source License
protected List<TemplateVariableDefinition> getAutocompleteTemplateVariableDefinitions( HttpServletRequest request, String language) throws Exception { if (!isAutocompleteEnabled(language)) { return Collections.emptyList(); }/* w w w .ja v a 2 s .c o m*/ Set<TemplateVariableDefinition> templateVariableDefinitions = new LinkedHashSet<>(); // Declared variables ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); DDMTemplate ddmTemplate = (DDMTemplate) request.getAttribute(DDMWebKeys.DYNAMIC_DATA_MAPPING_TEMPLATE); long classPK = BeanParamUtil.getLong(ddmTemplate, request, "classPK"); long classNameId = BeanParamUtil.getLong(ddmTemplate, request, "classNameId"); if (classPK > 0) { DDMStructure ddmStructure = _ddmStructureService.getStructure(classPK); classNameId = ddmStructure.getClassNameId(); } else if (ddmTemplate != null) { classNameId = ddmTemplate.getClassNameId(); } Map<String, TemplateVariableGroup> templateVariableGroups = TemplateContextHelper .getTemplateVariableGroups(classNameId, classPK, language, themeDisplay.getLocale()); for (TemplateVariableGroup templateVariableGroup : templateVariableGroups.values()) { if (!templateVariableGroup.isAutocompleteEnabled()) { continue; } templateVariableDefinitions.addAll(templateVariableGroup.getTemplateVariableDefinitions()); } // Other variables TemplateResource templateResource = new StringTemplateResource(_TEMPLATE_ID, _TEMPLATE_CONTENT); Template template = TemplateManagerUtil.getTemplate(language, templateResource, false); for (String key : template.getKeys()) { Object value = template.get(key); if (value == null) { continue; } TemplateVariableDefinition variableDefinition = new TemplateVariableDefinition(key, value.getClass(), key, (String) null); templateVariableDefinitions.add(variableDefinition); } return new ArrayList<>(templateVariableDefinitions); }
From source file:com.liferay.journal.web.internal.servlet.taglib.ui.JournalFormNavigatorContextProvider.java
License:Open Source License
@Override public String getContext(JournalArticle article) { ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext(); ThemeDisplay themeDisplay = serviceContext.getThemeDisplay(); HttpServletRequest request = themeDisplay.getRequest(); String toLanguageId = ParamUtil.getString(request, "toLanguageId"); long classNameId = BeanParamUtil.getLong(article, request, "classNameId"); if (Validator.isNotNull(toLanguageId)) { return "translate"; } else if ((article != null) && (article.getId() > 0)) { return "update"; } else if (classNameId > JournalArticleConstants.CLASSNAME_ID_DEFAULT) { return "default.values"; }//from www . ja va 2s. co m return "add"; }
From source file:com.liferay.journal.web.internal.servlet.taglib.ui.JournalPermissionsFormNavigatorEntry.java
License:Open Source License
@Override public boolean isVisible(User user, JournalArticle article) { ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext(); ThemeDisplay themeDisplay = serviceContext.getThemeDisplay(); long classNameId = BeanParamUtil.getLong(article, themeDisplay.getRequest(), "classNameId"); if (classNameId > JournalArticleConstants.CLASSNAME_ID_DEFAULT) { return false; }/* w w w . ja v a2s . c o m*/ if ((article != null) && (article.getId() > 0)) { return false; } return true; }
From source file:com.liferay.journal.web.internal.servlet.taglib.ui.JournalScheduleFormNavigatorEntry.java
License:Open Source License
@Override public boolean isVisible(User user, JournalArticle article) { if (!PropsValues.SCHEDULER_ENABLED) { return false; }/* w ww .j a va 2s . c o m*/ ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext(); ThemeDisplay themeDisplay = serviceContext.getThemeDisplay(); long classNameId = BeanParamUtil.getLong(article, themeDisplay.getRequest(), "classNameId"); if (classNameId > JournalArticleConstants.CLASSNAME_ID_DEFAULT) { return false; } return true; }
From source file:com.liferay.mobile.device.rules.web.internal.portlet.action.EditActionMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) { try {//from w w w. java 2 s. com long actionId = ParamUtil.getLong(renderRequest, "actionId"); MDRAction action = _mdrActionService.fetchAction(actionId); renderRequest.setAttribute(MDRWebKeys.MOBILE_DEVICE_RULES_RULE_GROUP_ACTION, action); String type = BeanPropertiesUtil.getString(action, "type"); renderRequest.setAttribute(MDRWebKeys.MOBILE_DEVICE_RULES_RULE_GROUP_ACTION_TYPE, type); String editorJSP = ActionUtil.getActionEditorJSP(type); renderRequest.setAttribute(MDRWebKeys.MOBILE_DEVICE_RULES_RULE_GROUP_ACTION_EDITOR_JSP, editorJSP); long ruleGroupInstanceId = BeanParamUtil.getLong(action, renderRequest, "ruleGroupInstanceId"); MDRRuleGroupInstance ruleGroupInstance = _mdrRuleGroupInstanceLocalService .getMDRRuleGroupInstance(ruleGroupInstanceId); renderRequest.setAttribute(MDRWebKeys.MOBILE_DEVICE_RULES_RULE_GROUP_INSTANCE, ruleGroupInstance); MDRRuleGroup ruleGroup = ruleGroupInstance.getRuleGroup(); renderRequest.setAttribute(MDRWebKeys.MOBILE_DEVICE_RULES_RULE_GROUP, ruleGroup); return "/edit_action.jsp"; } catch (PortalException pe) { // LPS-52675 if (_log.isDebugEnabled()) { _log.debug(pe, pe); } return "/error.jsp"; } }
From source file:com.liferay.mobile.device.rules.web.internal.portlet.action.EditRuleGroupInstanceMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) { long ruleGroupInstanceId = ParamUtil.getLong(renderRequest, "ruleGroupInstanceId"); MDRRuleGroupInstance ruleGroupInstance = _mdrRuleGroupInstanceLocalService .fetchRuleGroupInstance(ruleGroupInstanceId); renderRequest.setAttribute(MDRWebKeys.MOBILE_DEVICE_RULES_RULE_INSTANCE, ruleGroupInstance); long ruleGroupId = BeanParamUtil.getLong(ruleGroupInstance, renderRequest, "ruleGroupId"); MDRRuleGroup ruleGroup = _mdrRuleGroupLocalService.fetchRuleGroup(ruleGroupId); renderRequest.setAttribute(MDRWebKeys.MOBILE_DEVICE_RULES_RULE_GROUP, ruleGroup); return "/edit_rule_group_instance_priorities.jsp"; }
From source file:com.liferay.mobile.device.rules.web.internal.portlet.action.EditRuleMVCRenderCommand.java
License:Open Source License
@Override public String render(RenderRequest renderRequest, RenderResponse renderResponse) { try {// ww w. ja v a 2 s. co m long ruleId = ParamUtil.getLong(renderRequest, "ruleId"); MDRRule rule = _mdrRuleService.fetchRule(ruleId); renderRequest.setAttribute(MDRWebKeys.MOBILE_DEVICE_RULES_RULE, rule); String type = BeanPropertiesUtil.getString(rule, "type"); renderRequest.setAttribute(MDRWebKeys.MOBILE_DEVICE_RULES_RULE_TYPE, type); renderRequest.setAttribute(MDRWebKeys.MOBILE_DEVICE_RULES_RULE_EDITOR_JSP, ActionUtil.getRuleEditorJSP(type)); long ruleGroupId = BeanParamUtil.getLong(rule, renderRequest, "ruleGroupId"); MDRRuleGroup ruleGroup = _mdrRuleGroupService.getRuleGroup(ruleGroupId); renderRequest.setAttribute(MDRWebKeys.MOBILE_DEVICE_RULES_RULE_GROUP, ruleGroup); return "/edit_rule.jsp"; } catch (PortalException pe) { // LPS-52675 if (_log.isDebugEnabled()) { _log.debug(pe, pe); } return "/error.jsp"; } }