List of usage examples for com.liferay.portal.kernel.util ArrayUtil toLongArray
public static Long[] toLongArray(Object[] array)
From source file:com.liferay.asset.publisher.internal.util.AssetPublisherHelperImpl.java
License:Open Source License
@Override public long[] getGroupIds(PortletPreferences portletPreferences, long scopeGroupId, Layout layout) { String[] scopeIds = portletPreferences.getValues("scopeIds", new String[] { SCOPE_ID_GROUP_PREFIX + scopeGroupId }); Set<Long> groupIds = new LinkedHashSet<>(); for (String scopeId : scopeIds) { try {/*from w ww . j a v a2s. c o m*/ long groupId = getGroupIdFromScopeId(scopeId, scopeGroupId, layout.isPrivateLayout()); groupIds.add(groupId); } catch (Exception e) { continue; } } return ArrayUtil.toLongArray(groupIds); }
From source file:com.liferay.asset.publisher.internal.util.AssetPublisherHelperImpl.java
License:Open Source License
private long[] _getSiteGroupIds(long[] groupIds) { Set<Long> siteGroupIds = new LinkedHashSet<>(); for (long groupId : groupIds) { siteGroupIds.add(_portal.getSiteGroupId(groupId)); }/* w w w. j ava 2 s . c om*/ return ArrayUtil.toLongArray(siteGroupIds); }
From source file:com.liferay.asset.publisher.web.util.AssetPublisherUtil.java
License:Open Source License
public static long[] getGroupIds(PortletPreferences portletPreferences, long scopeGroupId, Layout layout) { String[] scopeIds = portletPreferences.getValues("scopeIds", new String[] { SCOPE_ID_GROUP_PREFIX + scopeGroupId }); Set<Long> groupIds = new LinkedHashSet<>(); for (String scopeId : scopeIds) { try {/*w ww. ja v a 2s .co m*/ long groupId = getGroupIdFromScopeId(scopeId, scopeGroupId, layout.isPrivateLayout()); groupIds.add(groupId); } catch (Exception e) { continue; } } return ArrayUtil.toLongArray(groupIds); }
From source file:com.liferay.asset.publisher.web.util.AssetPublisherUtil.java
License:Open Source License
protected static long[] getSiteGroupIds(long[] groupIds) { Set<Long> siteGroupIds = new LinkedHashSet<>(); for (long groupId : groupIds) { siteGroupIds.add(PortalUtil.getSiteGroupId(groupId)); }/*from ww w .j a v a 2s.c o m*/ return ArrayUtil.toLongArray(siteGroupIds); }
From source file:com.liferay.bookmarks.service.impl.BookmarksEntryServiceImpl.java
License:Open Source License
@Override public List<BookmarksEntry> getGroupEntries(long groupId, long userId, long rootFolderId, int start, int end) throws PortalException { if (rootFolderId == BookmarksFolderConstants.DEFAULT_PARENT_FOLDER_ID) { if (userId <= 0) { return bookmarksEntryPersistence.filterFindByG_NotS(groupId, WorkflowConstants.STATUS_IN_TRASH, start, end, new EntryModifiedDateComparator()); } else {/*from ww w . j a v a 2 s .c om*/ return bookmarksEntryPersistence.filterFindByG_U_NotS(groupId, userId, WorkflowConstants.STATUS_IN_TRASH, start, end, new EntryModifiedDateComparator()); } } List<Long> folderIds = bookmarksFolderService.getFolderIds(groupId, rootFolderId); if (folderIds.isEmpty()) { return Collections.emptyList(); } else if (userId <= 0) { return bookmarksEntryPersistence.filterFindByG_F_S(groupId, ArrayUtil.toLongArray(folderIds), WorkflowConstants.STATUS_APPROVED, start, end, new EntryModifiedDateComparator()); } else { return bookmarksEntryPersistence.filterFindByG_U_F_S(groupId, userId, ArrayUtil.toLongArray(folderIds), WorkflowConstants.STATUS_APPROVED, start, end, new EntryModifiedDateComparator()); } }
From source file:com.liferay.bookmarks.service.impl.BookmarksEntryServiceImpl.java
License:Open Source License
@Override public int getGroupEntriesCount(long groupId, long userId, long rootFolderId) throws PortalException { if (rootFolderId == BookmarksFolderConstants.DEFAULT_PARENT_FOLDER_ID) { if (userId <= 0) { return bookmarksEntryPersistence.filterCountByG_NotS(groupId, WorkflowConstants.STATUS_IN_TRASH); } else {/* w w w . j a va 2 s .co m*/ return bookmarksEntryPersistence.filterCountByG_U_NotS(groupId, userId, WorkflowConstants.STATUS_IN_TRASH); } } List<Long> folderIds = bookmarksFolderService.getFolderIds(groupId, rootFolderId); if (folderIds.isEmpty()) { return 0; } else if (userId <= 0) { return bookmarksEntryPersistence.filterCountByG_F_S(groupId, ArrayUtil.toLongArray(folderIds), WorkflowConstants.STATUS_APPROVED); } else { return bookmarksEntryPersistence.filterCountByG_U_F_S(groupId, userId, ArrayUtil.toLongArray(folderIds), WorkflowConstants.STATUS_APPROVED); } }
From source file:com.liferay.content.targeting.hook.events.UserSegmentPreAction.java
License:Open Source License
public long[] getMatchesUserSegmentIds(HttpServletRequest request, long[] groupIds, AnonymousUser anonymousUser) throws Exception { if (ArrayUtil.isEmpty(groupIds)) { return null; }/*from w w w. j a v a2s. c o m*/ List<Long> userSegmentIds = new ArrayList<Long>(); List<UserSegment> userSegments = UserSegmentLocalServiceUtil.getUserSegments(groupIds); for (UserSegment userSegment : userSegments) { if (matches(request, anonymousUser, userSegment)) { userSegmentIds.add(userSegment.getUserSegmentId()); } } return ArrayUtil.toLongArray(userSegmentIds); }
From source file:com.liferay.content.targeting.internal.PortalPreferencesUserSegmentSimulator.java
License:Open Source License
protected long[] getLongArray(String[] array) { if (array == null) { return null; }//from w w w . j ava 2 s.com List<Long> values = new ArrayList<Long>(); for (String string : array) { long value = GetterUtil.getLong(string); if (value > 0) { values.add(value); } } return ArrayUtil.toLongArray(values); }
From source file:com.liferay.content.targeting.util.UserSegmentUtil.java
License:Open Source License
public static long[] getAssetVocabularyIds(long[] groupIds) throws PortalException, SystemException { List<Long> vocabularyIds = new ArrayList<Long>(); for (long groupId : groupIds) { try {//from w w w . j a va 2 s . c o m AssetVocabulary vocabulary = AssetVocabularyLocalServiceUtil.getGroupVocabulary(groupId, getAssetVocabularyName()); vocabularyIds.add(vocabulary.getVocabularyId()); } catch (NoSuchVocabularyException e) { } } return ArrayUtil.toLongArray(vocabularyIds); }
From source file:com.liferay.contenttargeting.model.impl.CTUserImpl.java
License:Open Source License
public long[] getMatchesUserSegmentIds(long[] groupIds, RulesRegistry rulesRegistry) throws PortalException, SystemException { if (ArrayUtil.isEmpty(groupIds)) { return null; }// w w w . ja v a2 s .co m List<Long> userSegmentIds = new ArrayList<Long>(); List<UserSegment> userSegments = UserSegmentLocalServiceUtil.getUserSegments(groupIds); for (UserSegment userSegment : userSegments) { if (userSegment.matches(this, rulesRegistry)) { userSegmentIds.add(userSegment.getUserSegmentId()); } } return ArrayUtil.toLongArray(userSegmentIds); }