for (String relationshipKind : relationshipKinds) {
actors.addAll(relationshipService.getTargetsOfKind(actor,
RelationshipKind.fromString(relationshipKind)));
}
if (actors.isEmpty()) {
return new ActivitiesListImpl();
}
query = em.createQuery("select activity from Activity activity "
+ "where activity.actor in (:actors) and activity.verb in (:verbs) "
+ "and activity.context is null order by activity.publishedDate desc");
query.setParameter("actors", actors);
query.setParameter("verbs", verbs);
break;
case ACTIVITY_STREAM_FROM_ACTOR:
query = em.createQuery("select activity from Activity activity "
+ "where activity.actor = :actor and activity.verb in (:verbs) "
+ "and activity.context is null order by activity.publishedDate desc");
query.setParameter("actor", actor);
query.setParameter("verbs", verbs);
break;
default:
throw new IllegalArgumentException("Invalid QueryType parameter");
}
if (limit > 0) {
query.setMaxResults((int) limit);
}
if (offset > 0) {
query.setFirstResult((int) offset);
}
return new ActivitiesListImpl(query.getResultList());
}