@Test public void testExecute() { Query q = getEntityManager().createQuery( "FROM LikedActivity"); int initialSize = q.getResultList().size(); assertTrue(deleteLikedActivity.execute(new LikedActivity(5L, 5L))); assertTrue(q.getResultList().size() == initialSize); }
@SuppressWarnings("unchecked") public Boolean execute(final LikedActivity inLikedActivity) { Query q = getEntityManager().createQuery( "DELETE FROM LikedActivity where personId=:personId and activityId=:activityId"); q.setParameter("personId", inLikedActivity.getPersonId()); q.setParameter("activityId", inLikedActivity.getActivityId()); q.executeUpdate(); getCache().removeFromList(CacheKeys.LIKED_BY_PERSON_ID + inLikedActivity.getPersonId(), inLikedActivity.getActivityId()); getCache().removeFromList(CacheKeys.LIKERS_BY_ACTIVITY_ID + inLikedActivity.getActivityId(), inLikedActivity.getPersonId()); return Boolean.TRUE; }
DeleteLikedActivity extends CachedDomainMapper { @SuppressWarnings("unchecked") public Boolean execute(final LikedActivity inLikedActivity) { Query q = getEntityManager().createQuery( "DELETE FROM LikedActivity where personId=:personId and activityId=:activityId"); q.setParameter("personId", inLikedActivity.getPersonId()); q.setParameter("activityId", inLikedActivity.getActivityId()); q.executeUpdate(); getCache().removeFromList(CacheKeys.LIKED_BY_PERSON_ID + inLikedActivity.getPersonId(), inLikedActivity.getActivityId()); getCache().removeFromList(CacheKeys.LIKERS_BY_ACTIVITY_ID + inLikedActivity.getActivityId(), inLikedActivity.getPersonId()); return Boolean.TRUE; } }
DeleteLikedActivity extends CachedDomainMapper { @SuppressWarnings("unchecked") public Boolean execute(final LikedActivity inLikedActivity) { Query q = getEntityManager().createQuery( "DELETE FROM LikedActivity where personId=:personId and activityId=:activityId"); q.setParameter("personId", inLikedActivity.getPersonId()); q.setParameter("activityId", inLikedActivity.getActivityId()); q.executeUpdate(); getCache().removeFromList(CacheKeys.LIKED_BY_PERSON_ID + inLikedActivity.getPersonId(), inLikedActivity.getActivityId()); getCache().removeFromList(CacheKeys.LIKERS_BY_ACTIVITY_ID + inLikedActivity.getActivityId(), inLikedActivity.getPersonId()); return Boolean.TRUE; }  }
DeleteLikedActivity extends CachedDomainMapper { @SuppressWarnings("unchecked") public Boolean execute(final LikedActivity inLikedActivity) { Query q = getEntityManager().createQuery( "DELETE FROM LikedActivity where personId=:personId and activityId=:activityId"); q.setParameter("personId", inLikedActivity.getPersonId()); q.setParameter("activityId", inLikedActivity.getActivityId()); q.executeUpdate(); getCache().removeFromList(CacheKeys.LIKED_BY_PERSON_ID + inLikedActivity.getPersonId(), inLikedActivity.getActivityId()); getCache().removeFromList(CacheKeys.LIKERS_BY_ACTIVITY_ID + inLikedActivity.getActivityId(), inLikedActivity.getPersonId()); return Boolean.TRUE; }  @SuppressWarnings("unchecked") Boolean execute(final LikedActivity inLikedActivity); }
DeleteLikedActivity extends CachedDomainMapper { @SuppressWarnings("unchecked") public Boolean execute(final LikedActivity inLikedActivity) { Query q = getEntityManager().createQuery( "DELETE FROM LikedActivity where personId=:personId and activityId=:activityId"); q.setParameter("personId", inLikedActivity.getPersonId()); q.setParameter("activityId", inLikedActivity.getActivityId()); q.executeUpdate(); getCache().removeFromList(CacheKeys.LIKED_BY_PERSON_ID + inLikedActivity.getPersonId(), inLikedActivity.getActivityId()); getCache().removeFromList(CacheKeys.LIKERS_BY_ACTIVITY_ID + inLikedActivity.getActivityId(), inLikedActivity.getPersonId()); return Boolean.TRUE; }  @SuppressWarnings("unchecked") Boolean execute(final LikedActivity inLikedActivity);  }