public static List<RRoleDto> getRoles(DbConn cnx) { return getRoles(cnx, "role_select_all", 0); }
public static List<RRoleDto> getRoles(DbConn cnx) { return getRoles(cnx, "role_select_all", 0); }
public static RRoleDto getRole(DbConn cnx, int id) { List<RRoleDto> res = getRoles(cnx, "role_select_by_id", 0, id); if (res.size() == 1) { return res.get(0); } else { throw new JqmAdminApiUserException("no result"); } }
public static RRoleDto getRole(DbConn cnx, int id) { List<RRoleDto> res = getRoles(cnx, "role_select_by_id", 0, id); if (res.size() == 1) { return res.get(0); } else { throw new JqmAdminApiUserException("no result"); } }
@Override int doWork() { jqmlogger.info("# Roles defined"); try (DbConn cnx = Helpers.getNewDbSession()) { for (RRoleDto role : MetaService.getRoles(cnx)) { jqmlogger.info("{} - {}", role.getName(), role.getDescription()); } } return 0; } }
public static void syncRoles(DbConn cnx, List<RRoleDto> dtos) { for (RRoleDto existing : getRoles(cnx)) { boolean foundInNewSet = false; for (RRoleDto newdto : dtos) { if (newdto.getId() != null && newdto.getId().equals(existing.getId())) { foundInNewSet = true; break; } } if (!foundInNewSet) { deleteRole(cnx, existing.getId(), false); } } for (RRoleDto dto : dtos) { upsertRole(cnx, dto); } }
public static void syncRoles(DbConn cnx, List<RRoleDto> dtos) { for (RRoleDto existing : getRoles(cnx)) { boolean foundInNewSet = false; for (RRoleDto newdto : dtos) { if (newdto.getId() != null && newdto.getId().equals(existing.getId())) { foundInNewSet = true; break; } } if (!foundInNewSet) { deleteRole(cnx, existing.getId(), false); } } for (RRoleDto dto : dtos) { upsertRole(cnx, dto); } }