/**
   * Illustrates how to perform data normalization
   *
   * @param normalizeType type of normalization to perform
   * @param xformResult name of the result transformation view
   * @throws JDMException if transformation failed
   */
  public static void normalizeData(OraNormalizeType normalizeType, String xformResult)
      throws JDMException {
    // Schema where the original data and resulting transformations reside
    String schema = (m_dmeConn.getConnectionSpec().getName()).toUpperCase();

    OraNormalizeTransform ont =
        m_xformFactory.createNormalizeTransform(normalizeType, new Integer(6));

    // Specify the list of excluded attributes
    String[] excludedList = new String[] {"CUST_ID", "CUST_GENDER"};
    ont.setExcludeColumnList(excludedList);

    ArrayList xformList = new ArrayList();
    xformList.add(ont);
    // Create a transformation sequence object
    OraTransformationSequence xformSeq =
        m_xformFactory.createTransformationSequence(
            schema + "." + "MINING_DATA_BUILD_V", // name of the input data set
            xformList, // List of transformations. In this case only one type of transformation
            // i.e., supervised binning
            schema + "." + xformResult // name of the transformation result
            );
    String xformSeqName = "nmz_" + normalizeType.name() + "_xfSeq";
    m_dmeConn.saveObject(xformSeqName, xformSeq, true);

    OraTransformationTask xformTask = m_xformTaskFactory.create(xformSeqName, false);
    executeTask(xformTask, "xformNormalize_jdm");
    displayNormalizeResults(schema, "AGE", normalizeType, xformResult);
  }
  /**
   * Shows results of the normalization for selected attribute
   *
   * @param schema schema where result transformation view resides
   * @param attribute name of the attribute which was normalized
   * @param normalizeType type of normalization performed
   * @param xformResult name of the result transformation view
   */
  public static void displayNormalizeResults(
      String schema, String attribute, OraNormalizeType normalizeType, String xformResult) {
    System.out.println("\nShowing results of the normalization transformation");
    System.out.println(
        "\tNormalize type: "
            + (true == normalizeType.equals(OraNormalizeType.min_max) ? "min_max" : "z_score"));
    System.out.println(
        "\tMinimum and maximum values for:" + attribute + " before normalize transformation");

    String sqlQuery =
        MessageFormat.format(
            "SELECT MIN ({0}) MIN_VALUE, MAX ({0}) MAX_VALUE FROM ({1})",
            new String[] {"\"" + attribute + "\"", schema + "." + "MINING_DATA_BUILD_V"});
    getMinMax(sqlQuery);

    System.out.println(
        "\tMinimum and maximum values for:" + attribute + " after normalize transformation");
    sqlQuery =
        MessageFormat.format(
            "SELECT MIN ({0}) MIN_VALUE, MAX ({0}) MAX_VALUE FROM ({1})",
            new String[] {"\"" + attribute + "\"", schema + "." + xformResult});
    getMinMax(sqlQuery);
  }