Пример #1
0
 protected void validateColumn(int rowNo, int colNo, Vector v, DBConnection conn) {
   if (rowNo < 0 || rowNo > getRowCount() || colNo < 0 || colNo > getColumnCount()) return;
   DSColumnDescriptor col = _desc.getColumn(colNo);
   boolean remoteRules = false;
   for (int i = 0; i < col.getRuleCount(); i++) {
     try {
       ValidationRule r = col.getRule(i);
       if (r.getRuleType() == ValidationRule.TYPE_REMOTE) remoteRules = true;
       else r.evaluateRule(this, rowNo, colNo, conn);
     } catch (DataStoreException ex) {
       ex.setRowNo(rowNo);
       try {
         ex.setColumn(getColumnName(colNo));
       } catch (DataStoreException e) {
       }
       ;
       v.add(ex);
     }
   }
   if (remoteRules) {
     try {
       DataStoreRow r = getDataStoreRow(rowNo, BUFFER_STANDARD);
       r.getDSDataRow().setProxyRow(rowNo);
       DataStoreException ex[] = getDataSourceProxy().validateRemoteRules(this, r, rowNo, colNo);
       for (int i = 0; i < ex.length; i++) v.add(ex[i]);
     } catch (DataStoreException dex) {
     }
   }
 }
Пример #2
0
  /** This method returns whether a column is updateable */
  public boolean isUpdateable(int col) throws DataStoreException {
    if (col < 0 || _desc.getColumnCount() == 0)
      throw new DataStoreException("Specified column (" + col + ") does not exist.");

    DSColumnDescriptor c = _desc.getColumn(col);
    return c.isUpdateable();
  }
Пример #3
0
  /**
   * This method is used to get whether a column should use bind variables for inserts and updates.
   * Valid values and BIND_TRUE, BIND_FALSE and BIND_DEFAULT (Use default for datastore)
   */
  public int getUseBindColumn(int col) throws DataStoreException {
    if (col < 0 || _desc.getColumnCount() == 0)
      throw new DataStoreException("Specified column (" + col + ") does not exist.");

    DSColumnDescriptor c = _desc.getColumn(col);
    return c.getUseBind();
  }
Пример #4
0
  /**
   * This method is used to get whether a column should be used in the update, delete concurrency
   * check.
   */
  public boolean getConcurrencyCheckColumn(int col) throws DataStoreException {
    if (col < 0 || _desc.getColumnCount() == 0)
      throw new DataStoreException("Specified column (" + col + ") does not exist.");

    DSColumnDescriptor c = _desc.getColumn(col);
    return c.getConcurrency();
  }
Пример #5
0
  /** This method returns the name of the database table that the column is for. */
  public String getColumnTableName(int col) throws DataStoreException {
    if (col < 0 || _desc.getColumnCount() == 0)
      throw new DataStoreException("Specified column (" + col + ") does not exist.");
    DSColumnDescriptor d = _desc.getColumn(col);
    String table = d.getTable();
    if (table == null) table = _desc.getDefaultTable();

    return null;
  }
Пример #6
0
  /**
   * This method returns an array of all the tables referenced in the datastore.
   *
   * @param updateable True if the table list should only include updateable tables and false if it
   *     should include all.
   */
  public String[] getTableList(boolean updateable) {

    DSColumnDescriptor col = null;

    Vector tables = new Vector();
    Vector pkey = new Vector();

    for (int i = 0; i < _desc.getColumnCount(); i++) {
      col = _desc.getColumn(i);
      String tableName = col.getTable();
      if (tableName == null) tableName = _desc.getDefaultTable();

      if ((!updateable) || col.isUpdateable()) {
        boolean found = false;
        for (int j = 0; j < tables.size(); j++) {
          if ((tables.elementAt(j)).equals(tableName)) {
            if (col.isPrimaryKey()) pkey.setElementAt(new Boolean(true), j);
            found = true;
            break;
          }
        }
        if (!found && tableName != null) {
          tables.addElement(tableName);
          pkey.addElement(new Boolean(col.isPrimaryKey()));
        }
      }
    }

    if (updateable) {
      for (int i = pkey.size() - 1; i > -1; i--) {
        if (!((Boolean) pkey.elementAt(i)).booleanValue()) tables.removeElementAt(i);
      }
    } else {
      for (int i = 0; i < getAliasCount(); i++) {
        try {
          String table = getTable(i);
          boolean found = false;
          for (int j = 0; j < tables.size(); j++) {
            if ((tables.elementAt(j)).equals(table)) found = true;
          }
          if (!found && table != null) tables.addElement(table);
        } catch (Exception e) {
        }
      }
    }

    String retVal[] = new String[tables.size()];
    tables.copyInto(retVal);

    return retVal;
  }