public Pair<Set<String>, Set<String>> apply(Pair<Operator, Iterable<String>> current, Pair<Set<String>, Set<String>> intermediate) { switch (current.first()) { case IS: return Pair.<Set<String>, Set<String>>pair(union(intermediate.first(), ImmutableSet.copyOf(current.second())), intermediate.second()); case NOT: return Pair.<Set<String>, Set<String>>pair(intermediate.first(), union(intermediate.second(), ImmutableSet.copyOf(current.second()))); default: return intermediate; } } }
public Pair<StreamsCrucibleActivityItem, Option<Pair<ActivityObjectType, ActivityVerb>>> apply(StreamsCrucibleActivityItem activityItem) { return pair(activityItem, typeAndVerb(activityItem)); } }
public static Set<String> getNotValues(Iterable<Pair<Operator, Iterable<String>>> filters) { Pair<Set<String>, Set<String>> isAndNotValues = getIsAndNotValues(filters); return isAndNotValues.second(); }
@Override public Pair<Pair<StreamsCrucibleActivityItem, ActivityVerb>, ActivityRequest> apply(Pair<StreamsCrucibleActivityItem, ActivityVerb> activityItem) { return pair(activityItem, request); } }
/** * Given a collection of date filters, extract the first date range. * * @param filters the date filters * @return the first date range found */ private static Option<Pair<Date, Date>> getDateRange(Collection<Pair<Operator, Iterable<String>>> filters) { Pair<Operator, Iterable<String>> firstFilter = get(filters, 0); Iterable<Date> dates = transform(firstFilter.second(), toDate()); if (size(dates) < 2) { //no range exists return none(); } Iterable<Pair<Date, Date>> ranges = mkPairs(dates); return some(get(ranges, 0)); }
public Option<Pair<StreamsCrucibleActivityItem, ActivityVerb>> apply(Pair<StreamsCrucibleActivityItem, Option<Pair<ActivityObjectType, ActivityVerb>>> activity) { for (Pair<ActivityObjectType, ActivityVerb> activityPair : activity.second()) { return some(pair(activity.first(), activityPair.second())); } return none(); } }
/** * Specifies an associated entity to exclude, such as a project or issue. The query * will exclude any activities that are associated with any of the specified entities. * @param filterKey a filter key such as {@link com.atlassian.streams.spi.StandardStreamsFilterOption#PROJECT_KEY} * @param value the corresponding project or issue key * @return the same Builder instance */ public Builder addExcludeEntityFilter(String filterKey, String value) { excludeEntityFilters.add(pair(filterKey, value)); return this; }
public boolean apply(Pair<Operator, Iterable<String>> input) { return input.first().equals(op); } }
public Predicate<String> apply(Pair<Operator, Iterable<String>> filter, Predicate<String> predicate) { switch (filter.first()) { case IS: return and(predicate, is.apply(filter.second())); case NOT: return and(predicate, not.apply(ImmutableSet.copyOf(filter.second()))); default: return predicate; } } }
public Pair<? extends Iterable<Attachment>, ? extends Iterable<Attachment>> apply(Attachment attachment, Pair<? extends Iterable<Attachment>, ? extends Iterable<Attachment>> acc) { try { if (thumbnailManager.isThumbnailable(attachment)) { return pair(acc.first(), concat(acc.second(), ImmutableList.of(attachment))); } } catch (Exception e) { // Not much we can do about this log.error("Error getting thumbnail for attachment", e); } return pair(concat(acc.first(), ImmutableList.of(attachment)), acc.second()); } };
/** * Specifies an associated entity to search for, such as a project or issue. If at * least one such filter is specified, the query will exclude any activities that are * not associated with at least one of the specified entities. * @param filterKey a filter key such as {@link com.atlassian.streams.spi.StandardStreamsFilterOption#PROJECT_KEY} * @param value the corresponding project or issue key * @return the same Builder instance */ public Builder addEntityFilter(String filterKey, String value) { entityFilters.add(pair(filterKey, value)); return this; }