@Test public void testExecuteZeroRows() { sut.execute(new SetUserNotificationFilterPreferencesRequest(PERSON_ID, Collections.singletonList(dto1))); checkAgainstDb(PERSON_ID, Collections.singletonList(dto1)); }
@Override public Void execute(final SetUserNotificationFilterPreferencesRequest inRequest) { Query q = getEntityManager().createQuery("DELETE FROM NotificationFilterPreference where personId=:personId"); q.setParameter("personId", inRequest.getPersonId()); q.executeUpdate(); Person user = (Person) getHibernateSession().load(Person.class, inRequest.getPersonId()); for (NotificationFilterPreferenceDTO dto : inRequest.getPrefList()) { NotificationFilterPreferenceEntity entity = new NotificationFilterPreferenceEntity(); entity.setPerson(user); entity.setNotificationCategory(dto.getNotificationCategory()); entity.setNotifierType(dto.getNotifierType()); getEntityManager().persist(entity); } return null; }
SetAllUserNotificationFilterPreferences extends
        BaseArgDomainMapper<SetUserNotificationFilterPreferencesRequest, Void> { @Override public Void execute(final SetUserNotificationFilterPreferencesRequest inRequest) { Query q = getEntityManager().createQuery("DELETE FROM NotificationFilterPreference where personId=:personId"); q.setParameter("personId", inRequest.getPersonId()); q.executeUpdate(); Person user = (Person) getHibernateSession().load(Person.class, inRequest.getPersonId()); for (NotificationFilterPreferenceDTO dto : inRequest.getPrefList()) { NotificationFilterPreferenceEntity entity = new NotificationFilterPreferenceEntity(); entity.setPerson(user); entity.setNotificationCategory(dto.getNotificationCategory()); entity.setNotifierType(dto.getNotifierType()); getEntityManager().persist(entity); } return null; } }
SetAllUserNotificationFilterPreferences extends
        BaseArgDomainMapper<SetUserNotificationFilterPreferencesRequest, Void> { @Override public Void execute(final SetUserNotificationFilterPreferencesRequest inRequest) { Query q = getEntityManager().createQuery("DELETE FROM NotificationFilterPreference where personId=:personId"); q.setParameter("personId", inRequest.getPersonId()); q.executeUpdate(); Person user = (Person) getHibernateSession().load(Person.class, inRequest.getPersonId()); for (NotificationFilterPreferenceDTO dto : inRequest.getPrefList()) { NotificationFilterPreferenceEntity entity = new NotificationFilterPreferenceEntity(); entity.setPerson(user); entity.setNotificationCategory(dto.getNotificationCategory()); entity.setNotifierType(dto.getNotifierType()); getEntityManager().persist(entity); } return null; }  }
SetAllUserNotificationFilterPreferences extends
        BaseArgDomainMapper<SetUserNotificationFilterPreferencesRequest, Void> { @Override public Void execute(final SetUserNotificationFilterPreferencesRequest inRequest) { Query q = getEntityManager().createQuery("DELETE FROM NotificationFilterPreference where personId=:personId"); q.setParameter("personId", inRequest.getPersonId()); q.executeUpdate(); Person user = (Person) getHibernateSession().load(Person.class, inRequest.getPersonId()); for (NotificationFilterPreferenceDTO dto : inRequest.getPrefList()) { NotificationFilterPreferenceEntity entity = new NotificationFilterPreferenceEntity(); entity.setPerson(user); entity.setNotificationCategory(dto.getNotificationCategory()); entity.setNotifierType(dto.getNotifierType()); getEntityManager().persist(entity); } return null; }  @Override Void execute(final SetUserNotificationFilterPreferencesRequest inRequest); }
SetAllUserNotificationFilterPreferences extends
        BaseArgDomainMapper<SetUserNotificationFilterPreferencesRequest, Void> { @Override public Void execute(final SetUserNotificationFilterPreferencesRequest inRequest) { Query q = getEntityManager().createQuery("DELETE FROM NotificationFilterPreference where personId=:personId"); q.setParameter("personId", inRequest.getPersonId()); q.executeUpdate(); Person user = (Person) getHibernateSession().load(Person.class, inRequest.getPersonId()); for (NotificationFilterPreferenceDTO dto : inRequest.getPrefList()) { NotificationFilterPreferenceEntity entity = new NotificationFilterPreferenceEntity(); entity.setPerson(user); entity.setNotificationCategory(dto.getNotificationCategory()); entity.setNotifierType(dto.getNotifierType()); getEntityManager().persist(entity); } return null; }  @Override Void execute(final SetUserNotificationFilterPreferencesRequest inRequest);  }