Ejemplo n.º 1
0
  @SuppressWarnings("rawtypes")
  protected Result fillAuxManagementTable() {
    Result r = new Result();
    if (!haveRecords(Manager.AUX_MANAGER)) {
      List<Manager> managers = application.getManagers();
      int i = 0;
      for (Manager m : managers) {
        i++;
        String sInsert =
            "INSERT INTO "
                + Manager.AUX_MANAGER
                + " (id,manager) values ("
                + i
                + ",'"
                + m.getName()
                + "')";
        String identitySql = "CALL IDENTITY();";
        logsql(sInsert);
        r = db.executeInsert(sInsert, identitySql);
        Integer managerId = (Integer) r.objectValue(); // TODO safeguards
        m.setManagerId(managerId);
      }
    }
    String countQuery = "SELECT COUNT(*) FROM " + Manager.AUX_MANAGER + " ";
    logsql(countQuery);
    Result c = db.executeCountQuery(countQuery);
    if (hasCount(c)) {
      db.debugSelectAll("SELECT * FROM " + Manager.AUX_MANAGER + " ");

      List<Manager> managers = application.getManagers();
      int i = 0;
      for (Manager m : managers) {
        i++;
        String sSelect =
            "SELECT ID FROM " + Manager.AUX_MANAGER + " WHERE manager='" + m.getName() + "' ";
        logsql(sSelect);
        r = db.executeSelect(sSelect, m);
      }
    }
    r.success();
    ;
    return r;
  }
Ejemplo n.º 2
0
 @SuppressWarnings("rawtypes")
 private Result getEntityList(Screen.Button button) {
   Result result = new Result();
   Screen next;
   List<Manager> entityList = application.getManagers();
   next = new Screen(this, button.destination());
   next.setValue(Screen.AVAILABLE_ENTITIES, entityList);
   result.objectValue(next);
   result.success();
   return result;
 }
Ejemplo n.º 3
0
  private Result createViewRole(Button button, Role role, boolean redirect) {
    Result result = new Result();
    Screen next;
    next = new Screen(this, button.destination());
    if (redirect) {
      next.makeRedirect();
    }
    // Integer usrId = user.getId();
    result = listPrivileges(role);
    next.setValue(Screen.VIEW_ROLE, role);
    next.setValue(Screen.AVAILABLE_ENTITIES, application.getManagers());
    next.setValue(Screen.AVAILABLE_PRIVILEGES, Privilege.values());

    result.objectValue(next);

    result.success();
    return result;
  }