Exemple #1
0
  public java.lang.String[] getMenuItems2Enable(java.lang.String logiName) {

    java.sql.ResultSet rsetArray;

    java.lang.String[] menus2enable = null;

    java.sql.Array menuListArray = null;

    java.util.Vector menuVector = new java.util.Vector(1, 1);

    try {

      java.sql.Statement stmtDB = connDB.createStatement();

      java.sql.ResultSet rSet =
          stmtDB.executeQuery(
              "SELECT menu_list FROM secure_menu_access WHERE login_name ='"
                  + logiName
                  + "' AND sys_name = 'hospital_hr'");

      while (rSet.next()) {

        menuListArray = rSet.getArray(1);

        menus2enable = (java.lang.String[]) menuListArray.getArray();
      }

    } catch (java.sql.SQLException sqlExec) {

      javax.swing.JOptionPane.showMessageDialog(
          new javax.swing.JFrame(), sqlExec.getLocalizedMessage());
    }

    System.out.println("These are items to enable \n");

    for (int k = 0; k < menus2enable.length; k++) {

      //  System.out.println(menus2enable[k]);

    }

    return menus2enable;
  }
Exemple #2
0
  /**
   * Takes an int[] contained in a java.sql.Array and returns the default String representation.
   *
   * @param object to format.
   * @return String represenetation of the int[].
   * @throws IllegalArgumentException if the object is not an int[];
   */
  @Override
  public String format(Object object) {
    if (object == null) return "";

    if (object instanceof java.sql.Array) {
      try {
        java.sql.Array array = (java.sql.Array) object;
        object = array.getArray();
      } catch (SQLException e) {
        throw new IllegalArgumentException(
            "Error accessing array data for " + object.getClass().getCanonicalName(), e);
      }
    }
    if (object instanceof int[]) return toString((int[]) object);

    if (object instanceof Integer[]) return toString((Integer[]) object);

    throw new IllegalArgumentException(object.getClass().getCanonicalName() + " not supported.");
  }