@Test(expected = IllegalArgumentException.class) public void testFilterWithBadType() { final List<String> streamUniqueIds = new ArrayList<String>(1); streamUniqueIds.add(destinationStreamUniqueId); final List<DomainGroupModelView> domainGroupModelViews = new ArrayList<DomainGroupModelView>(1); domainGroupModelViews.add(groupMock); context.checking(new Expectations() { { allowing(activityMock).getDestinationStream(); will(returnValue(destinationStream)); allowing(destinationStream).getType(); will(returnValue(EntityType.APPLICATION)); } }); sut.filter(activities, personAccount); context.assertIsSatisfied(); }
public void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccount) { if (activities.size() == 0) { return; } Hashtable<String, Boolean> groupShareable = new Hashtable<String, Boolean>(); for (ActivityDTO activity : activities) { if (activity.getDestinationStream().getType() == EntityType.GROUP) { groupShareable.put(activity.getDestinationStream().getUniqueIdentifier().trim(), Boolean.FALSE); } } if (!groupShareable.isEmpty()) { setGroupShareableValues(groupShareable); } for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: activity.setShareable(true); break; case GROUP: activity.setShareable(groupShareable.get(activity.getDestinationStream().getUniqueIdentifier().trim())); break; case RESOURCE: activity.setShareable(true); break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } }
CanShareFilter implements ActivityFilter { public void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccount) { if (activities.size() == 0) { return; } Hashtable<String, Boolean> groupShareable = new Hashtable<String, Boolean>(); for (ActivityDTO activity : activities) { if (activity.getDestinationStream().getType() == EntityType.GROUP) { groupShareable.put(activity.getDestinationStream().getUniqueIdentifier().trim(), Boolean.FALSE); } } if (!groupShareable.isEmpty()) { setGroupShareableValues(groupShareable); } for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: activity.setShareable(true); break; case GROUP: activity.setShareable(groupShareable.get(activity.getDestinationStream().getUniqueIdentifier().trim())); break; case RESOURCE: activity.setShareable(true); break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } } }
CanShareFilter implements ActivityFilter { public void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccount) { if (activities.size() == 0) { return; } Hashtable<String, Boolean> groupShareable = new Hashtable<String, Boolean>(); for (ActivityDTO activity : activities) { if (activity.getDestinationStream().getType() == EntityType.GROUP) { groupShareable.put(activity.getDestinationStream().getUniqueIdentifier().trim(), Boolean.FALSE); } } if (!groupShareable.isEmpty()) { setGroupShareableValues(groupShareable); } for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: activity.setShareable(true); break; case GROUP: activity.setShareable(groupShareable.get(activity.getDestinationStream().getUniqueIdentifier().trim())); break; case RESOURCE: activity.setShareable(true); break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } } CanShareFilter(final GetDomainGroupsByShortNames inGroupCacheMapper); }
CanShareFilter implements ActivityFilter { public void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccount) { if (activities.size() == 0) { return; } Hashtable<String, Boolean> groupShareable = new Hashtable<String, Boolean>(); for (ActivityDTO activity : activities) { if (activity.getDestinationStream().getType() == EntityType.GROUP) { groupShareable.put(activity.getDestinationStream().getUniqueIdentifier().trim(), Boolean.FALSE); } } if (!groupShareable.isEmpty()) { setGroupShareableValues(groupShareable); } for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: activity.setShareable(true); break; case GROUP: activity.setShareable(groupShareable.get(activity.getDestinationStream().getUniqueIdentifier().trim())); break; case RESOURCE: activity.setShareable(true); break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } } CanShareFilter(final GetDomainGroupsByShortNames inGroupCacheMapper); void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccount); }
CanShareFilter implements ActivityFilter { public void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccount) { if (activities.size() == 0) { return; } Hashtable<String, Boolean> groupShareable = new Hashtable<String, Boolean>(); for (ActivityDTO activity : activities) { if (activity.getDestinationStream().getType() == EntityType.GROUP) { groupShareable.put(activity.getDestinationStream().getUniqueIdentifier().trim(), Boolean.FALSE); } } if (!groupShareable.isEmpty()) { setGroupShareableValues(groupShareable); } for (ActivityDTO activity : activities) { switch (activity.getDestinationStream().getType()) { case PERSON: activity.setShareable(true); break; case GROUP: activity.setShareable(groupShareable.get(activity.getDestinationStream().getUniqueIdentifier().trim())); break; case RESOURCE: activity.setShareable(true); break; default: throw new IllegalArgumentException( "Attempted to filter Activity with unsupported destination stream type."); } } } CanShareFilter(final GetDomainGroupsByShortNames inGroupCacheMapper); void filter(final List<ActivityDTO> activities, final PersonModelView inCurrentUserAccount);  }