public static long decodeUserId(String portletId) { int x = portletId.indexOf(_USER_SEPARATOR); if (x == -1) { return 0; } int y = portletId.indexOf(_INSTANCE_SEPARATOR); if (y != -1) { return GetterUtil.getLong( portletId.substring(x + _USER_SEPARATOR.length(), y)); } return GetterUtil.getLong( portletId.substring(x + _USER_SEPARATOR.length())); }
/** * Returns the portlet request parameter value as a long. If the parameter * is missing or not convertible to a long, <code>0</code> is returned. * * @param portletRequest the portlet request from which to read the * parameter * @param param the name of the parameter * @return the portlet request parameter value as a long */ public static long getLong(PortletRequest portletRequest, String param) { return GetterUtil.getLong(portletRequest.getParameter(param)); }
/** * Returns the service context parameter value as a long. If the parameter * is missing or not convertible to a long, <code>0</code> is returned. * * @param serviceContext the service context from which to read the * parameter * @param param the name of the parameter * @return the service context parameter value as a long */ public static long getLong(ServiceContext serviceContext, String param) { return GetterUtil.getLong(serviceContext.getAttribute(param)); }
protected long getLayoutGroupId() { String data = (String)get("data"); int pos = data.lastIndexOf(CharPool.AT); if (pos != -1) { data = data.substring(pos + 1); } return GetterUtil.getLong(data); }
public static Date getLastPublishDate( PortletPreferences jxPortletPreferences) { long lastPublishDate = GetterUtil.getLong( jxPortletPreferences.getValue( _LAST_PUBLISH_DATE, StringPool.BLANK)); if (lastPublishDate == 0) { return null; } return new Date(lastPublishDate); }
public static long getLong( Properties properties, PortletRequest portletRequest, String param, long defaultValue) { String propertiesValue = properties.getProperty(param, null); long getterUtilValue = GetterUtil.getLong( propertiesValue, defaultValue); return ParamUtil.get(portletRequest, param, getterUtilValue); }
protected long getBackgroundTaskStatusAttributeLong(String attributeKey) { return GetterUtil.getLong( backgroundTaskStatus.getAttribute(attributeKey)); }
public long getLongValue(String key, long defaultValue) { String value = getValue(key, null); return GetterUtil.getLong(value, defaultValue); }
public long getLong(String key) { long value = 0; Object object = get(key); if (object instanceof Number) { value = ((Number)object).longValue(); } else { value = GetterUtil.getLong((String)object); } return value; }
public static long getLong( Properties properties, HttpServletRequest request, String param, long defaultValue) { String propertiesValue = properties.getProperty(param, null); long getterUtilValue = GetterUtil.getLong( propertiesValue, defaultValue); return ParamUtil.get(request, param, getterUtilValue); }
public static long getLong( PortletPreferences preferences, PortletRequest portletRequest, String param, long defaultValue) { String preferencesValue = preferences.getValue(param, null); long getterUtilValue = GetterUtil.getLong( preferencesValue, defaultValue); return ParamUtil.get(portletRequest, param, getterUtilValue); }
public static long getLong( UnicodeProperties properties, PortletRequest portletRequest, String param, long defaultValue) { String propertiesValue = properties.getProperty(param, null); long getterUtilValue = GetterUtil.getLong( propertiesValue, defaultValue); return ParamUtil.get(portletRequest, param, getterUtilValue); }
@Override protected boolean isGroupAdmin(SearchContext searchContext) { long groupId = GetterUtil.getLong( searchContext.getAttribute(Field.GROUP_ID)); if (groupId == 0) { return false; } if (!_permissionChecker.isGroupAdmin(groupId)) { return false; } return true; }
public static String[] getExportImportConfigurationParameter( BackgroundTask backgroundTask, String parameterName) throws PortalException { Map<String, Serializable> taskContextMap = backgroundTask.getTaskContextMap(); ExportImportConfiguration exportImportConfiguration = ExportImportConfigurationLocalServiceUtil. getExportImportConfiguration( GetterUtil.getLong( taskContextMap.get("exportImportConfigurationId"))); return getExportImportConfigurationParameter( exportImportConfiguration, parameterName); }
public static long getLong( UnicodeProperties properties, HttpServletRequest request, String param, long defaultValue) { String propertiesValue = properties.getProperty(param, null); long getterUtilValue = GetterUtil.getLong( propertiesValue, defaultValue); return ParamUtil.get(request, param, getterUtilValue); }
public static long getLong( PortletPreferences preferences, HttpServletRequest request, String param, long defaultValue) { String preferencesValue = preferences.getValue(param, null); long getterUtilValue = GetterUtil.getLong( preferencesValue, defaultValue); return ParamUtil.get(request, param, getterUtilValue); }
protected long[] getGroupIdsFromSearchContext(SearchContext searchContext) { String groupIdAttribute = GetterUtil.getString( searchContext.getAttribute("groupId")); if (Validator.isNull(groupIdAttribute)) { return null; } long groupId = GetterUtil.getLong(groupIdAttribute); if (groupId == 0) { return _GROUP_IDS_FROM_SEARCH_CONTEXT_DEFAULT; } return addScopeGroup(groupId); }
protected Element addImportDataRootElement( PortletDataContext portletDataContext, String data) throws DocumentException { Document document = SAXReaderUtil.read(data); Element rootElement = document.getRootElement(); portletDataContext.setImportDataRootElement(rootElement); long groupId = GetterUtil.getLong( rootElement.attributeValue("group-id")); if (groupId != 0) { portletDataContext.setSourceGroupId(groupId); } return rootElement; }
public long getUserId() throws PrincipalException { String name = PrincipalThreadLocal.getName(); if (Validator.isNull(name)) { throw new PrincipalException("Principal is null"); } for (String anonymousName : ANONYMOUS_NAMES) { if (StringUtil.equalsIgnoreCase(name, anonymousName)) { throw new PrincipalException( "Principal cannot be " + anonymousName); } } return GetterUtil.getLong(name); }
protected void addSearchUserId( BooleanFilter queryBooleanFilter, SearchContext searchContext) throws Exception { MultiValueFacet multiValueFacet = new MultiValueFacet(searchContext); multiValueFacet.setFieldName(Field.USER_ID); multiValueFacet.setStatic(true); long userId = GetterUtil.getLong( searchContext.getAttribute(Field.USER_ID)); if (userId > 0) { multiValueFacet.setValues(new long[] {userId}); } searchContext.addFacet(multiValueFacet); }