@Test public void saveAuthorities() { List<Integer> authorities = new ArrayList<Integer>(); authorities.add(14); authorities.add(16); repo.saveAuthorities(1, authorities); }
public Boolean saveAuthorities(final Integer groupId, final List<Integer> authorities) { return execute(new SqlMapClientCallback<Boolean>() { @SuppressWarnings("unchecked") public Boolean doInSqlMapClient(SqlMapExecutor executor) { int ris = 0; try { executor.startBatch(); Iterator<Integer> iter = authorities.iterator(); while (iter.hasNext()) { Map params = new HashMap(); params.put("group_id", groupId); params.put("id", iter.next()); executor.insert("updateGroupAuthority", params); } ris = executor.executeBatch(); } catch (SQLException e) { Logger log = LoggerFactory.getLogger(this.getClass()); StringBuffer sb = new StringBuffer("saveAuthorities failed \n").append("num items batch:").append(authorities.size()).append("\n").append(" groupId:").append(groupId).append("\n") .append(e.getNextException()); log.error(sb.toString()); } return ris > 0; } }); }
AuthorityRepositoryIbatis extends SqlMapClientTemplate implements AuthorityRepository { public Boolean saveAuthorities(final Integer groupId, final List<Integer> authorities) { return execute(new SqlMapClientCallback<Boolean>() { @SuppressWarnings("unchecked") public Boolean doInSqlMapClient(SqlMapExecutor executor) { int ris = 0; try { executor.startBatch(); Iterator<Integer> iter = authorities.iterator(); while (iter.hasNext()) { Map params = new HashMap(); params.put("group_id", groupId); params.put("id", iter.next()); executor.insert("updateGroupAuthority", params); } ris = executor.executeBatch(); } catch (SQLException e) { Logger log = LoggerFactory.getLogger(this.getClass()); StringBuffer sb = new StringBuffer("saveAuthorities failed \n").append("num items batch:").append(authorities.size()).append("\n").append(" groupId:").append(groupId).append("\n") .append(e.getNextException()); log.error(sb.toString()); } return ris > 0; } }); } }
AuthorityRepositoryIbatis extends SqlMapClientTemplate implements AuthorityRepository { public Boolean saveAuthorities(final Integer groupId, final List<Integer> authorities) { return execute(new SqlMapClientCallback<Boolean>() { @SuppressWarnings("unchecked") public Boolean doInSqlMapClient(SqlMapExecutor executor) { int ris = 0; try { executor.startBatch(); Iterator<Integer> iter = authorities.iterator(); while (iter.hasNext()) { Map params = new HashMap(); params.put("group_id", groupId); params.put("id", iter.next()); executor.insert("updateGroupAuthority", params); } ris = executor.executeBatch(); } catch (SQLException e) { Logger log = LoggerFactory.getLogger(this.getClass()); StringBuffer sb = new StringBuffer("saveAuthorities failed \n").append("num items batch:").append(authorities.size()).append("\n").append(" groupId:").append(groupId).append("\n") .append(e.getNextException()); log.error(sb.toString()); } return ris > 0; } }); }  }
AuthorityRepositoryIbatis extends SqlMapClientTemplate implements AuthorityRepository { public Boolean saveAuthorities(final Integer groupId, final List<Integer> authorities) { return execute(new SqlMapClientCallback<Boolean>() { @SuppressWarnings("unchecked") public Boolean doInSqlMapClient(SqlMapExecutor executor) { int ris = 0; try { executor.startBatch(); Iterator<Integer> iter = authorities.iterator(); while (iter.hasNext()) { Map params = new HashMap(); params.put("group_id", groupId); params.put("id", iter.next()); executor.insert("updateGroupAuthority", params); } ris = executor.executeBatch(); } catch (SQLException e) { Logger log = LoggerFactory.getLogger(this.getClass()); StringBuffer sb = new StringBuffer("saveAuthorities failed \n").append("num items batch:").append(authorities.size()).append("\n").append(" groupId:").append(groupId).append("\n") .append(e.getNextException()); log.error(sb.toString()); } return ris > 0; } }); }  @Autowired @Override void setSqlMapClient(@Qualifier("sqlMapClient") SqlMapClient sqlMapClient); Boolean removeGroupFromAuthorities(Integer id); @SuppressWarnings("unchecked") List<AuthorityDTO> getAuthorities(); @SuppressWarnings("unchecked") List<AuthorityDTO> getUserAuthorities(String username); @SuppressWarnings("unchecked") List<AuthorityDTO> getFreeAuthorities(String username); @SuppressWarnings("unchecked") List<AuthorityDTO> getFreeAuthoritiesForGroup(); @SuppressWarnings("unchecked") List<Integer> getIdItemsAuthority(Integer id); @SuppressWarnings("unchecked") List<AuthorityDTO> getGroupAuthorities(Integer id); Boolean saveAuthorities(final Integer groupId, final List<Integer> authorities); Integer getAuthoritiesNumber(); AuthorityDTO getAuthority(Integer id); @SuppressWarnings("unchecked") List<AuthorityDTO> getAuthorities(Pager pager); Boolean removeAuthority(Integer id); Boolean deleteUserGroups(String username); Boolean save(AuthorityDTO authority); }
AuthorityRepositoryIbatis extends SqlMapClientTemplate implements AuthorityRepository { public Boolean saveAuthorities(final Integer groupId, final List<Integer> authorities) { return execute(new SqlMapClientCallback<Boolean>() { @SuppressWarnings("unchecked") public Boolean doInSqlMapClient(SqlMapExecutor executor) { int ris = 0; try { executor.startBatch(); Iterator<Integer> iter = authorities.iterator(); while (iter.hasNext()) { Map params = new HashMap(); params.put("group_id", groupId); params.put("id", iter.next()); executor.insert("updateGroupAuthority", params); } ris = executor.executeBatch(); } catch (SQLException e) { Logger log = LoggerFactory.getLogger(this.getClass()); StringBuffer sb = new StringBuffer("saveAuthorities failed \n").append("num items batch:").append(authorities.size()).append("\n").append(" groupId:").append(groupId).append("\n") .append(e.getNextException()); log.error(sb.toString()); } return ris > 0; } }); }  @Autowired @Override void setSqlMapClient(@Qualifier("sqlMapClient") SqlMapClient sqlMapClient); Boolean removeGroupFromAuthorities(Integer id); @SuppressWarnings("unchecked") List<AuthorityDTO> getAuthorities(); @SuppressWarnings("unchecked") List<AuthorityDTO> getUserAuthorities(String username); @SuppressWarnings("unchecked") List<AuthorityDTO> getFreeAuthorities(String username); @SuppressWarnings("unchecked") List<AuthorityDTO> getFreeAuthoritiesForGroup(); @SuppressWarnings("unchecked") List<Integer> getIdItemsAuthority(Integer id); @SuppressWarnings("unchecked") List<AuthorityDTO> getGroupAuthorities(Integer id); Boolean saveAuthorities(final Integer groupId, final List<Integer> authorities); Integer getAuthoritiesNumber(); AuthorityDTO getAuthority(Integer id); @SuppressWarnings("unchecked") List<AuthorityDTO> getAuthorities(Pager pager); Boolean removeAuthority(Integer id); Boolean deleteUserGroups(String username); Boolean save(AuthorityDTO authority);  }