@Test public final void testFilterEmptyList() { final List<ActivityDTO> empty = new ArrayList<ActivityDTO>(); sut.filter(empty, currentUserAccount); }
@Override public void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccountId) { if (activities.isEmpty()) { return; } Hashtable<String, Boolean> personCommentable = new Hashtable<String, Boolean>(); Hashtable<String, Boolean> groupCommentable = new Hashtable<String, Boolean>(); for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: personCommentable.put(activity.getDestinationStream().getUniqueIdentifier().trim().toLowerCase(), Boolean.TRUE); break; case GROUP: groupCommentable.put(activity.getDestinationStream().getUniqueIdentifier().trim().toLowerCase(), Boolean.TRUE); break; case RESOURCE: break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } setPersonCommentableValues(inCurrentUserAccountId.getAccountId(), personCommentable); setGroupCommentableValues(inCurrentUserAccountId.getAccountId(), groupCommentable); for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: activity.setCommentable(personCommentable.get(activity.getDestinationStream().getUniqueIdentifier() .trim().toLowerCase())); break; case GROUP: activity.setCommentable(groupCommentable.get(activity.getDestinationStream().getUniqueIdentifier() .trim().toLowerCase())); break; case RESOURCE: activity.setCommentable(true); break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } }
CanCommentFilter implements ActivityFilter { @Override public void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccountId) { if (activities.isEmpty()) { return; } Hashtable<String, Boolean> personCommentable = new Hashtable<String, Boolean>(); Hashtable<String, Boolean> groupCommentable = new Hashtable<String, Boolean>(); for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: personCommentable.put(activity.getDestinationStream().getUniqueIdentifier().trim().toLowerCase(), Boolean.TRUE); break; case GROUP: groupCommentable.put(activity.getDestinationStream().getUniqueIdentifier().trim().toLowerCase(), Boolean.TRUE); break; case RESOURCE: break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } setPersonCommentableValues(inCurrentUserAccountId.getAccountId(), personCommentable); setGroupCommentableValues(inCurrentUserAccountId.getAccountId(), groupCommentable); for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: activity.setCommentable(personCommentable.get(activity.getDestinationStream().getUniqueIdentifier() .trim().toLowerCase())); break; case GROUP: activity.setCommentable(groupCommentable.get(activity.getDestinationStream().getUniqueIdentifier() .trim().toLowerCase())); break; case RESOURCE: activity.setCommentable(true); break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } } }
CanCommentFilter implements ActivityFilter { @Override public void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccountId) { if (activities.isEmpty()) { return; } Hashtable<String, Boolean> personCommentable = new Hashtable<String, Boolean>(); Hashtable<String, Boolean> groupCommentable = new Hashtable<String, Boolean>(); for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: personCommentable.put(activity.getDestinationStream().getUniqueIdentifier().trim().toLowerCase(), Boolean.TRUE); break; case GROUP: groupCommentable.put(activity.getDestinationStream().getUniqueIdentifier().trim().toLowerCase(), Boolean.TRUE); break; case RESOURCE: break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } setPersonCommentableValues(inCurrentUserAccountId.getAccountId(), personCommentable); setGroupCommentableValues(inCurrentUserAccountId.getAccountId(), groupCommentable); for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: activity.setCommentable(personCommentable.get(activity.getDestinationStream().getUniqueIdentifier() .trim().toLowerCase())); break; case GROUP: activity.setCommentable(groupCommentable.get(activity.getDestinationStream().getUniqueIdentifier() .trim().toLowerCase())); break; case RESOURCE: activity.setCommentable(true); break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } } CanCommentFilter(
            final DomainMapper<List<String>, List<PersonModelView>> inGetPersonModelViewsByAccountIdsMapper,
            final GetDomainGroupsByShortNames inGroupMapper,
            final GetAllPersonIdsWhoHaveGroupCoordinatorAccess inGroupCoordinators); }
CanCommentFilter implements ActivityFilter { @Override public void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccountId) { if (activities.isEmpty()) { return; } Hashtable<String, Boolean> personCommentable = new Hashtable<String, Boolean>(); Hashtable<String, Boolean> groupCommentable = new Hashtable<String, Boolean>(); for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: personCommentable.put(activity.getDestinationStream().getUniqueIdentifier().trim().toLowerCase(), Boolean.TRUE); break; case GROUP: groupCommentable.put(activity.getDestinationStream().getUniqueIdentifier().trim().toLowerCase(), Boolean.TRUE); break; case RESOURCE: break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } setPersonCommentableValues(inCurrentUserAccountId.getAccountId(), personCommentable); setGroupCommentableValues(inCurrentUserAccountId.getAccountId(), groupCommentable); for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: activity.setCommentable(personCommentable.get(activity.getDestinationStream().getUniqueIdentifier() .trim().toLowerCase())); break; case GROUP: activity.setCommentable(groupCommentable.get(activity.getDestinationStream().getUniqueIdentifier() .trim().toLowerCase())); break; case RESOURCE: activity.setCommentable(true); break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } } CanCommentFilter(
            final DomainMapper<List<String>, List<PersonModelView>> inGetPersonModelViewsByAccountIdsMapper,
            final GetDomainGroupsByShortNames inGroupMapper,
            final GetAllPersonIdsWhoHaveGroupCoordinatorAccess inGroupCoordinators); @Override void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccountId); }
CanCommentFilter implements ActivityFilter { @Override public void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccountId) { if (activities.isEmpty()) { return; } Hashtable<String, Boolean> personCommentable = new Hashtable<String, Boolean>(); Hashtable<String, Boolean> groupCommentable = new Hashtable<String, Boolean>(); for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: personCommentable.put(activity.getDestinationStream().getUniqueIdentifier().trim().toLowerCase(), Boolean.TRUE); break; case GROUP: groupCommentable.put(activity.getDestinationStream().getUniqueIdentifier().trim().toLowerCase(), Boolean.TRUE); break; case RESOURCE: break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } setPersonCommentableValues(inCurrentUserAccountId.getAccountId(), personCommentable); setGroupCommentableValues(inCurrentUserAccountId.getAccountId(), groupCommentable); for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: activity.setCommentable(personCommentable.get(activity.getDestinationStream().getUniqueIdentifier() .trim().toLowerCase())); break; case GROUP: activity.setCommentable(groupCommentable.get(activity.getDestinationStream().getUniqueIdentifier() .trim().toLowerCase())); break; case RESOURCE: activity.setCommentable(true); break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } } CanCommentFilter(
            final DomainMapper<List<String>, List<PersonModelView>> inGetPersonModelViewsByAccountIdsMapper,
            final GetDomainGroupsByShortNames inGroupMapper,
            final GetAllPersonIdsWhoHaveGroupCoordinatorAccess inGroupCoordinators); @Override void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccountId);  }