List of usage examples for com.liferay.portal.kernel.util GetterUtil getLong
public static long getLong(String value, long defaultValue)
From source file:au.com.permeance.liferay.portlets.workflow.WebContentWorkflowPortlet.java
License:Open Source License
@Override public void processAction(final ActionRequest actionRequest, final ActionResponse actionResponse) throws IOException, PortletException { final long groupId = ParamUtil.getLong(actionRequest, "groupId"); final ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); final Enumeration<String> paramNames = actionRequest.getParameterNames(); boolean success = true; while (paramNames.hasMoreElements()) { final String name = paramNames.nextElement(); if (!name.startsWith(_PREFIX)) { continue; }//from ww w.j av a 2 s . co m final long structureId = GetterUtil.getLong(name.substring(_PREFIX.length(), name.length()), -1l); if (structureId >= 0) { String workflowDefinition = ParamUtil.getString(actionRequest, name); try { WorkflowDefinitionLinkLocalServiceUtil.updateWorkflowDefinitionLink(themeDisplay.getUserId(), themeDisplay.getCompanyId(), groupId, JournalArticle.class.getName(), structureId, 0, workflowDefinition); } catch (SystemException e) { _log.warn("Error processing action: " + e.getMessage(), e); SessionErrors.add(actionRequest, e.toString()); success = false; } catch (PortalException e) { _log.warn("Error processing action: " + e.getMessage(), e); SessionErrors.add(actionRequest, e.toString()); success = false; } } } if (success) { SessionMessages.add(actionRequest, "success"); } sendRedirect(actionRequest, actionResponse); }
From source file:au.com.permeance.liferay.util.workflow.WebContentWorkflowHandler.java
License:Open Source License
@Override public WorkflowDefinitionLink getWorkflowDefinitionLink(long companyId, long groupId, long classPK) throws PortalException, SystemException { // fix for 6.1.30: // in 6.1.20 - function can throw NoSuchWorkflowDefinitionLinkException which is caught in // caller/* ww w.java 2s .c om*/ // in 6.1.30 - function cannot throw NoSuchWorkflowDefinitionLinkException - as it will // break flow (uncaught in caller). try { JournalArticle article = JournalArticleLocalServiceUtil.getArticle(classPK); WorkflowDefinitionLink link = null; long folderId = JournalFolderLocalServiceUtil.getInheritedWorkflowFolderId(article.getFolderId()); DDMStructure ddmStructure = article.getDDMStructure(); if (ddmStructure != null) { link = WorkflowDefinitionLinkLocalServiceUtil.fetchWorkflowDefinitionLink(companyId, groupId, JournalFolder.class.getName(), folderId, ddmStructure.getStructureId(), true); } if (link == null) { link = WorkflowDefinitionLinkLocalServiceUtil.fetchWorkflowDefinitionLink(companyId, groupId, JournalFolder.class.getName(), folderId, JournalArticleConstants.DDM_STRUCTURE_ID_ALL, true); } if (link == null) { long structureId = GetterUtil.getLong(article.getStructureId(), 0); link = WorkflowDefinitionLinkLocalServiceUtil.getWorkflowDefinitionLink(companyId, groupId, getClassName(), structureId, 0); } return link; } catch (NoSuchWorkflowDefinitionLinkException e) { if (_log.isDebugEnabled()) { _log.debug("Caught NoSuchWorkflowDefinitionLinkException, returning null"); _log.debug(e); } return null; } }
From source file:com.cmcti.cmts.domain.service.impl.UpChannelMetadataLocalServiceImpl.java
License:Open Source License
private List<UpChannelMetadata> getUpstreamMetas(Iterator<Row> rowIterator, int startRow, ServiceContext serviceContext, boolean deleteAll) throws SystemException { List<UpChannelMetadata> list = new ArrayList<UpChannelMetadata>(); if (startRow > 0) { for (int i = 0; i < startRow; i++) { if (rowIterator.hasNext()) rowIterator.next();/* ww w. j a v a 2 s.c om*/ } } while (rowIterator.hasNext()) { UpChannelMetadata metadata = null; long cmtsId; int ifIndex; String dsFrequency = null; String qam = null; List<String> merchants = new ArrayList<String>(); try { Row row = rowIterator.next(); Cell cmtsCell = row.getCell(0); cmtsId = GetterUtil.getLong(getStringCellValue(cmtsCell), 0); Cell ifIndexCell = row.getCell(1); ifIndex = GetterUtil.getInteger(getStringCellValue(ifIndexCell), 0); Cell dsFrequencyCell = row.getCell(2); dsFrequency = getStringCellValue(dsFrequencyCell); Cell dsQamCell = row.getCell(3); qam = getStringCellValue(dsQamCell); Cell merCell = row.getCell(4); String merchantCodes = getStringCellValue(merCell); if (Validator.isNotNull(merchantCodes)) { merchants = Arrays.asList(merchantCodes.split(",")); } } catch (Exception e) { logger.error(e); continue; } if (Validator.isNull(cmtsId) || Validator.isNull(ifIndex)) continue; metadata = upChannelMetadataPersistence.fetchByUpstreamChannel(cmtsId, ifIndex); if (deleteAll || metadata == null) { long metaId = counterLocalService.increment(UpChannelMetadata.class.getName()); metadata = upChannelMetadataPersistence.create(metaId); } metadata.setCmtsId(cmtsId); metadata.setIfIndex(ifIndex); metadata.setDsFrequency(dsFrequency); metadata.setDsQam(qam); metadata.setMerchantCodes(merchants); list.add(metadata); } return list; }
From source file:com.liferay.arquillian.DeployerServlet.java
License:Open Source License
@Override public void init(ServletConfig config) throws ServletException { super.init(config); ServletContext servletContext = config.getServletContext(); if (servletContext instanceof BundleReference) { _bundle = ((BundleReference) servletContext).getBundle(); }/*from ww w . j a v a 2 s . com*/ _contextPathHeader = GetterUtil.getString(config.getInitParameter("contextPathHeader"), BUNDLE_CONTEXT_PATH); _deployerServletInstallLocation = GetterUtil .getString(config.getInitParameter("deployerServletInstallLocation"), DEPLOYER_SERVLET_LOCATION); _installTimeout = GetterUtil.getLong(config.getInitParameter("installTimeout"), TIMEOUT); }
From source file:com.liferay.asset.publisher.web.display.context.AssetPublisherDisplayContext.java
License:Open Source License
public long getDisplayStyleGroupId() { if (_displayStyleGroupId != null) { return _displayStyleGroupId; }//from www . j a v a 2 s . c om ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); _displayStyleGroupId = GetterUtil.getLong(_portletPreferences.getValue("displayStyleGroupId", null), themeDisplay.getScopeGroupId()); return _displayStyleGroupId; }
From source file:com.liferay.asset.publisher.web.internal.util.AssetPublisherWebUtil.java
License:Open Source License
private Long[] _getClassTypeIds(PortletPreferences portletPreferences, String className, Long[] availableClassTypeIds) { boolean anyAssetType = GetterUtil .getBoolean(portletPreferences.getValue("anyClassType" + className, Boolean.TRUE.toString())); if (anyAssetType) { return availableClassTypeIds; }//w w w . j a va2 s . co m long defaultClassTypeId = GetterUtil.getLong(portletPreferences.getValue("anyClassType" + className, null), -1); if (defaultClassTypeId > -1) { return new Long[] { defaultClassTypeId }; } Long[] classTypeIds = ArrayUtil .toArray(StringUtil.split(portletPreferences.getValue("classTypeIds" + className, null), 0L)); if (classTypeIds != null) { return classTypeIds; } else { return availableClassTypeIds; } }
From source file:com.liferay.asset.publisher.web.portlet.action.AssetPublisherConfigurationAction.java
License:Open Source License
protected String[] getClassTypeIds(ActionRequest actionRequest, String[] classNameIds) throws Exception { String assetClassName = getAssetClassName(actionRequest, classNameIds); if (assetClassName == null) { return null; }/*from w w w. j a v a 2s .c o m*/ String anyAssetClassTypeString = getParameter(actionRequest, "anyClassType" + assetClassName); boolean anyAssetClassType = GetterUtil.getBoolean(anyAssetClassTypeString); if (anyAssetClassType) { return null; } long defaultAssetClassTypeId = GetterUtil.getLong(anyAssetClassTypeString, -1); if (defaultAssetClassTypeId > -1) { return new String[] { String.valueOf(defaultAssetClassTypeId) }; } else { return StringUtil.split(getParameter(actionRequest, "classTypeIds" + assetClassName)); } }
From source file:com.liferay.asset.publisher.web.util.AssetPublisherUtil.java
License:Open Source License
public static Long[] getClassTypeIds(PortletPreferences portletPreferences, String className, Long[] availableClassTypeIds) { boolean anyAssetType = GetterUtil .getBoolean(portletPreferences.getValue("anyClassType" + className, Boolean.TRUE.toString())); if (anyAssetType) { return availableClassTypeIds; }// w w w .j ava2 s. c o m long defaultClassTypeId = GetterUtil.getLong(portletPreferences.getValue("anyClassType" + className, null), -1); if (defaultClassTypeId > -1) { return new Long[] { defaultClassTypeId }; } Long[] classTypeIds = ArrayUtil .toArray(StringUtil.split(portletPreferences.getValue("classTypeIds" + className, null), 0L)); if (classTypeIds != null) { return classTypeIds; } else { return availableClassTypeIds; } }
From source file:com.liferay.calendar.portlet.CalendarPortlet.java
License:Open Source License
protected void serveCalendarBookingsRSS(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception { if (!PortalUtil.isRSSFeedsEnabled()) { PortalUtil.sendRSSFeedsDisabledError(resourceRequest, resourceResponse); return;//w ww.ja v a 2 s . c om } ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); long calendarId = ParamUtil.getLong(resourceRequest, "calendarId"); PortletPreferences portletPreferences = resourceRequest.getPreferences(); long timeInterval = GetterUtil.getLong(portletPreferences.getValue("rssTimeInterval", StringPool.BLANK), RSSUtil.TIME_INTERVAL_DEFAULT); long startTime = System.currentTimeMillis(); long endTime = startTime + timeInterval; int max = GetterUtil.getInteger(portletPreferences.getValue("rssDelta", StringPool.BLANK), SearchContainer.DEFAULT_DELTA); String rssFeedType = portletPreferences.getValue("rssFeedType", RSSUtil.FORMAT_DEFAULT); String type = RSSUtil.getFormatType(rssFeedType); double version = RSSUtil.getFeedTypeVersion(rssFeedType); String displayStyle = portletPreferences.getValue("rssDisplayStyle", RSSUtil.DISPLAY_STYLE_DEFAULT); String rss = CalendarBookingServiceUtil.getCalendarBookingsRSS(calendarId, startTime, endTime, max, type, version, displayStyle, themeDisplay); PortletResponseUtil.sendFile(resourceRequest, resourceResponse, null, rss.getBytes(), ContentTypes.TEXT_XML_UTF8); }
From source file:com.liferay.calendar.web.internal.portlet.CalendarPortlet.java
License:Open Source License
protected void serveCalendarBookingsRSS(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception { PortletPreferences portletPreferences = resourceRequest.getPreferences(); boolean enableRss = GetterUtil.getBoolean(portletPreferences.getValue("enableRss", null), true); if (!_portal.isRSSFeedsEnabled() || !enableRss) { _portal.sendRSSFeedsDisabledError(resourceRequest, resourceResponse); return;//w w w . ja v a2s .com } ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY); long calendarId = ParamUtil.getLong(resourceRequest, "calendarId"); long timeInterval = GetterUtil.getLong(portletPreferences.getValue("rssTimeInterval", StringPool.BLANK), RSSUtil.TIME_INTERVAL_DEFAULT); long startTime = System.currentTimeMillis(); long endTime = startTime + timeInterval; int max = GetterUtil.getInteger(portletPreferences.getValue("rssDelta", StringPool.BLANK), SearchContainer.DEFAULT_DELTA); String rssFeedType = portletPreferences.getValue("rssFeedType", RSSUtil.FORMAT_DEFAULT); String type = RSSUtil.getFormatType(rssFeedType); double version = RSSUtil.getFeedTypeVersion(rssFeedType); String displayStyle = portletPreferences.getValue("rssDisplayStyle", RSSUtil.DISPLAY_STYLE_DEFAULT); String rss = _calendarBookingService.getCalendarBookingsRSS(calendarId, startTime, endTime, max, type, version, displayStyle, themeDisplay); PortletResponseUtil.sendFile(resourceRequest, resourceResponse, null, rss.getBytes(), ContentTypes.TEXT_XML_UTF8); }