@Override public List<Long> getScope(Context ctx, String senderId, Object... args) { List<Long> userIds = new ArrayList<Long>(); String targetIds = (String) args[0]; List<Long> targets = StringUtils2.splitIntList(targetIds, ","); for (long target : targets) { if (!userIds.contains(target)) { if ((target >= Constants.PUBLIC_CIRCLE_ID_BEGIN) && (target <= Constants.GROUP_ID_END)) { GroupLogic groupImpl = GlobalLogics.getGroup(); String members = groupImpl.getAllMembers(ctx, target, -1, -1, ""); List<Long> memberIds = StringUtils2.splitIntList(members, ","); userIds.addAll(memberIds); } else if (Constants.getUserTypeById(target) == Constants.PAGE_OBJECT) { long[] followerIds = GlobalLogics.getFriendship() .getFollowerIds(ctx, target, 0, Constants.GROUP_ID_BEGIN, -1, -1); userIds.addAll(Arrays.asList(ArrayUtils.toObject(followerIds))); } else { userIds.add(target); toIds.add(target); } } else { if (Constants.getUserTypeById(target) == Constants.USER_OBJECT) { toIds.add(target); } } } HashSet<Long> set = new HashSet<Long>(userIds); userIds = new ArrayList<Long>(set); // exclude sender if (StringUtils.isNotBlank(senderId)) { userIds.remove(Long.parseLong(senderId)); } L.trace(ctx, "Poll Invite Notification Receive userIds: " + userIds); return userIds; }
@Override public List<Long> getScope(Context ctx, String senderId, RecordSet recs, Object... args) { List<Long> userIds = new ArrayList<Long>(); List<String> reasons = new ArrayList<String>(); reasons.add(String.valueOf(Constants.C_STREAM_TO)); reasons.add(String.valueOf(Constants.C_STREAM_ADDTO)); ConversationLogic conversation = GlobalLogics.getConversation(); RecordSet conversation_users = conversation.getConversation( ctx, Constants.POST_OBJECT, (String) args[0], reasons, 0, 0, 100); for (Record r : conversation_users) { long userId = Long.parseLong(r.getString("from_")); if (!userIds.contains(userId)) { if ((userId >= Constants.PUBLIC_CIRCLE_ID_BEGIN) && (userId <= Constants.GROUP_ID_END)) { groups.add(userId); GroupLogic groupImpl = GlobalLogics.getGroup(); String members = groupImpl.getAllMembers(ctx, userId, -1, -1, ""); List<Long> memberIds = StringUtils2.splitIntList(members, ","); userIds.addAll(memberIds); if (recs == null) { recs = new RecordSet(); } RecordSet notifRecs = groupImpl.getMembersNotification(ctx, userId, members); recs.addAll(notifRecs); for (Record notifRec : notifRecs) { String memberId = notifRec.getString("member"); long recvNotif = notifRec.getInt("recv_notif", 0); if (recvNotif == 2) { userIds.remove(Long.parseLong(memberId)); } } } else userIds.add(userId); } } // =========================new send to ,from conversation end ==================== // exclude sender if (StringUtils.isNotBlank(senderId)) { userIds.remove(Long.parseLong(senderId)); } try { IgnoreLogic ignore = GlobalLogics.getIgnore(); userIds = ignore.formatIgnoreUserListP(ctx, userIds, "", ""); } catch (Exception e) { } return userIds; }