/**
   * clear unused column hints
   *
   * @throws BirtException
   */
  private final void clearUnusedColumnHints(DataSetHandle dataSetHandle, IResultMetaData metaData)
      throws BirtException {

    PropertyHandle handle = dataSetHandle.getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP);
    if (handle != null && handle.getListValue() != null) {
      ArrayList list = handle.getListValue();
      int count = list.size();
      for (int n = count - 1; n >= 0; n--) {
        ColumnHint hint = (ColumnHint) list.get(n);
        String columnName =
            (String) hint.getProperty(handle.getModule(), ColumnHint.COLUMN_NAME_MEMBER);
        String alias = (String) hint.getProperty(handle.getModule(), ColumnHint.ALIAS_MEMBER);
        boolean found = false;
        if (!isEmpty(hint, handle.getModule().getModuleHandle())) {
          for (int m = 0; m < metaData.getColumnCount() && !found; m++) {
            String name = metaData.getColumnName(m + 1);
            if (name != null && (name.equals(columnName)) || name.equals(alias)) {
              found = true;
              break;
            }
          }
          if (!found) {
            try {
              // remove the item
              handle.removeItem(hint);
            } catch (PropertyValueException e) {
            }
          }
        }
      }
    }
  }
Esempio n. 2
0
 /**
  * Removes the filter condition.
  *
  * @param fc the filter condition structure
  * @throws SemanticException if the given condition doesn't exist in the filters
  */
 public void removeFilter(FilterCondition fc) throws SemanticException {
   PropertyHandle propHandle = getPropertyHandle(FILTER_PROP);
   propHandle.removeItem(fc);
 }