コード例 #1
0
  /**
   * Adds quotes to the value of the attribute whose type is string or date and returns the tables
   * in path for that object.
   *
   * @param simpleConditionsNode The conditio node to be checked.
   * @return The tables in path for that object.
   */
  private String addSingleQuotes(SimpleConditionsNode simpleConditionsNode) {
    String columnName = simpleConditionsNode.getCondition().getDataElement().getField();
    Logger.out.debug(" columnName:" + columnName);
    StringTokenizer stringToken = new StringTokenizer(columnName, ".");
    simpleConditionsNode.getCondition().getDataElement().setTable(stringToken.nextToken());
    Logger.out.debug(
        "tablename:" + simpleConditionsNode.getCondition().getDataElement().getTableAliasName());
    simpleConditionsNode.getCondition().getDataElement().setField(stringToken.nextToken());
    simpleConditionsNode.getCondition().getDataElement().setFieldType(stringToken.nextToken());
    String tableInPath = null;

    if (stringToken.hasMoreTokens()) {
      tableInPath = stringToken.nextToken();
    }

    Logger.out.debug("^^^^^^^^^^^Condition:" + simpleConditionsNode.getCondition());

    return tableInPath;
  }
コード例 #2
0
  /**
   * Returns SimpleConditionsNode if the object named aliasName contains the activityStatus data
   * member, else returns null.
   *
   * @param aliasName The alias name of the object.
   * @param className The fully qualified name of the class in which activity status field is to be
   *     searched.
   * @return SimpleConditionsNode if the object named aliasName contains the activityStatus data
   *     member, else returns null.
   */
  private SimpleConditionsNode getActivityStatusCondition(String aliasName, String className)
      throws DAOException, ClassNotFoundException {
    SimpleConditionsNode activityStatusCondition = null;

    if (className.equals(Constants.REPORTED_PROBLEM_CLASS_NAME)) {
      return null;
    }
    // Returns the Class object if it is a valid class else returns null.
    Class classObject = edu.wustl.common.util.Utility.getClassObject(className);
    if (classObject != null) {
      Field[] objectFields = classObject.getDeclaredFields();

      for (int i = 0; i < objectFields.length; i++) {
        if (objectFields[i].getName().equals(Constants.ACTIVITY_STATUS)) {
          activityStatusCondition = new SimpleConditionsNode();
          activityStatusCondition.getCondition().getDataElement().setTableName(aliasName);
          activityStatusCondition
              .getCondition()
              .getDataElement()
              .setField(Constants.ACTIVITY_STATUS_COLUMN);
          activityStatusCondition.getCondition().getOperator().setOperator("!=");
          activityStatusCondition.getCondition().setValue(Constants.ACTIVITY_STATUS_DISABLED);
          activityStatusCondition
              .getCondition()
              .getDataElement()
              .setFieldType(Constants.FIELD_TYPE_VARCHAR);
          return activityStatusCondition;
        }
      }

      Class superClass = classObject.getSuperclass();
      if ((activityStatusCondition == null)
          && (superClass.getName().equals("edu.wustl.common.domain.AbstractDomainObject")
              == false)) {
        String superClassAliasName = getAliasName(superClass);
        activityStatusCondition =
            getActivityStatusCondition(superClassAliasName, superClass.getName());
      }
    }

    return activityStatusCondition;
  }
コード例 #3
0
  /**
   * Adds single quotes (') for string and date type attributes in the condition collecion and the
   * returns the Set of objects to which the condition attributes belong.
   *
   * @param simpleConditionNodeCollection The condition collection.
   * @return the Set of objects to which the condition attributes belong.
   * @throws DAOException
   */
  public List handleStringAndDateConditions(
      Collection simpleConditionNodeCollection, List fromTables) throws DAOException {
    // Adding single quotes to strings and date values.
    Iterator iterator = simpleConditionNodeCollection.iterator();
    while (iterator.hasNext()) {
      SimpleConditionsNode simpleConditionsNode = (SimpleConditionsNode) iterator.next();

      // Add all the objects selected in UI to the fromtables Set.
      addInListIfNotPresent(
          fromTables, simpleConditionsNode.getCondition().getDataElement().getTableAliasName());

      // Adds single quotes to the value of attributes whose type is string or date.
      String tableInPath = addSingleQuotes(simpleConditionsNode);

      // Get the tables in path for this field and add it in the fromTables Set.
      if (tableInPath != null) {
        addTablesInPathToFromSet(fromTables, tableInPath);
      }

      addInListIfNotPresent(
          fromTables, simpleConditionsNode.getCondition().getDataElement().getTableAliasName());
    }
    return fromTables;
  }