@Test public void removeFileScanner() { Assert.assertEquals (countInTable ("FILE_SCANNER_PREFERENCES", "PREFERENCE_UUID", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0"), 2); Assert.assertEquals (countInTable ("FILE_SCANNER", "ID", 0L), 1); User user = dao.read ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1"); dao.removeFileScanner (user, 0L); Assert.assertEquals (countInTable ("FILE_SCANNER_PREFERENCES", "PREFERENCE_UUID", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0"), 1); Assert.assertEquals (fsDao.read (0L), null); }
public void removeFileScanner (User user, Long scanner_id) { FileScanner fs = fileScannerDao.read (scanner_id); if (fs != null) { fileScannerDao.delete (fs); getHibernateTemplate ().refresh (user); user.getPreferences ().getFileScanners ().remove (fs); updateUserPreference (user); } }
UserDao extends HibernateDao<User, String> { public void removeFileScanner (User user, Long scanner_id) { FileScanner fs = fileScannerDao.read (scanner_id); if (fs != null) { fileScannerDao.delete (fs); getHibernateTemplate ().refresh (user); user.getPreferences ().getFileScanners ().remove (fs); updateUserPreference (user); } } }
UserDao extends HibernateDao<User, String> { public void removeFileScanner (User user, Long scanner_id) { FileScanner fs = fileScannerDao.read (scanner_id); if (fs != null) { fileScannerDao.delete (fs); getHibernateTemplate ().refresh (user); user.getPreferences ().getFileScanners ().remove (fs); updateUserPreference (user); } }  }
UserDao extends HibernateDao<User, String> { public void removeFileScanner (User user, Long scanner_id) { FileScanner fs = fileScannerDao.read (scanner_id); if (fs != null) { fileScannerDao.delete (fs); getHibernateTemplate ().refresh (user); user.getPreferences ().getFileScanners ().remove (fs); updateUserPreference (user); } }  User getByName(final String name); @Override void delete(final User user); void removeUser(User user); @SuppressWarnings ("unchecked") List<User> scrollNotDeleted(final int skip, final int top); Iterator<User> scrollForDataRight(); @SuppressWarnings ("unchecked") List<User> readNotDeleted(); Iterator<User> scrollNotDeleted(final String filter, int skip); Iterator<User> scrollForDataRight(String filter, int skip); Iterator<User> scrollAll(String filter, int skip); int countNotDeleted(String filter); int countForDataRight(String filter); int countAll(String filter); void addAccessToCollection(User user, Collection collection); void removeAccessToCollection(String user_uuid, Collection collection); String computeUserCode(User user); User getUserFromUserCode(String code); void lockUser(User user, String reason); void unlockUser(User user, Class<? extends AccessRestriction> car); void createTmpUser(User user); @Override User create(User u); void registerTmpUser(User u); boolean isTmpUser(User u); void cleanupTmpUser(int max_days); User getRootUser(); boolean isRootUser(User user); void storeUserSearch(User user, String request, String footprint,
         HashMap<String, String> advanced, String complete); void removeUserSearch(User user, String uuid); void activateUserSearchNotification(String uuid, boolean notify); void clearUserSearches(User user); List<Search> getUserSearches(User user); FileScanner addFileScanner(User user, String url, String username,
         String password, String pattern, String cron_schedule,
         Set<Collection> collections); void updateFileScanner(Long scan_id, String url, String username,
         String password, String pattern, String cron_schedule,
         Set<Collection> collections); void removeFileScanner(User user, Long scanner_id); void setFileScannerActive(Long id, boolean active); FileScanner findFileScanner(User user, String url, String username); Set<FileScanner> getFileScanners(User user); User getPublicData(); String getPublicDataName(); Iterator<User> scrollNotDeletedByFilter(String filter, int skip); int countNotDeletedByFilter(String filter); List<User> getUsers(String filter, String order_by, final int skip,
      final int top); int countUsers(String filter); Iterator<User> getAllUsers(); }
UserDao extends HibernateDao<User, String> { public void removeFileScanner (User user, Long scanner_id) { FileScanner fs = fileScannerDao.read (scanner_id); if (fs != null) { fileScannerDao.delete (fs); getHibernateTemplate ().refresh (user); user.getPreferences ().getFileScanners ().remove (fs); updateUserPreference (user); } }  User getByName(final String name); @Override void delete(final User user); void removeUser(User user); @SuppressWarnings ("unchecked") List<User> scrollNotDeleted(final int skip, final int top); Iterator<User> scrollForDataRight(); @SuppressWarnings ("unchecked") List<User> readNotDeleted(); Iterator<User> scrollNotDeleted(final String filter, int skip); Iterator<User> scrollForDataRight(String filter, int skip); Iterator<User> scrollAll(String filter, int skip); int countNotDeleted(String filter); int countForDataRight(String filter); int countAll(String filter); void addAccessToCollection(User user, Collection collection); void removeAccessToCollection(String user_uuid, Collection collection); String computeUserCode(User user); User getUserFromUserCode(String code); void lockUser(User user, String reason); void unlockUser(User user, Class<? extends AccessRestriction> car); void createTmpUser(User user); @Override User create(User u); void registerTmpUser(User u); boolean isTmpUser(User u); void cleanupTmpUser(int max_days); User getRootUser(); boolean isRootUser(User user); void storeUserSearch(User user, String request, String footprint,
         HashMap<String, String> advanced, String complete); void removeUserSearch(User user, String uuid); void activateUserSearchNotification(String uuid, boolean notify); void clearUserSearches(User user); List<Search> getUserSearches(User user); FileScanner addFileScanner(User user, String url, String username,
         String password, String pattern, String cron_schedule,
         Set<Collection> collections); void updateFileScanner(Long scan_id, String url, String username,
         String password, String pattern, String cron_schedule,
         Set<Collection> collections); void removeFileScanner(User user, Long scanner_id); void setFileScannerActive(Long id, boolean active); FileScanner findFileScanner(User user, String url, String username); Set<FileScanner> getFileScanners(User user); User getPublicData(); String getPublicDataName(); Iterator<User> scrollNotDeletedByFilter(String filter, int skip); int countNotDeletedByFilter(String filter); List<User> getUsers(String filter, String order_by, final int skip,
      final int top); int countUsers(String filter); Iterator<User> getAllUsers();  }