Package oracle.AWXML

Examples of oracle.AWXML.AW


    // Delete the analytic workspace if it already exists.
    deleteExistingAW(awConnection, user, awName);

    // Create an AW object and give it a name.
    AW globalAW = new AW();
    globalAW.setName(awName);

    // Create Dimension objects, and pass each Dimension to a method that
    // creates Attribute, Hierarchy, and Level objects for it.

    // Create the TIME_AW Dimension and set names for the object.
    Dimension timeDim = globalAW.createDimension();
    timeDim.setName("TIME_AW");
    timeDim.setShortName("TIME_AW");
    timeDim.setLongName("TIME_AW dimension");
    timeDim.setIsTime(true);

    // Create the Attribute, Level, and Hierarchy objects for the Dimension.
    this.createTimeDim(timeDim);

    // Get the detail level to use when creating a Cube.
    Vector _time_levels = timeDim.getLevels();
    Level monthLevel = (Level)_time_levels.elementAt(0);

    // Create the CUSTOMER_AW Dimension and set names for the object.
    Dimension customerDim = globalAW.createDimension();
    customerDim.setName("CUSTOMER_AW");
    customerDim.setShortName("CUSTOMER_AW");
    customerDim.setLongName("CUSTOMER_AW dimension");

    // Create the Attribute, Level, and Hierarchy objects for the Dimension.
    this.createCustomerDim(customerDim);

    // Get the detail level to use when creating a Cube.
    Vector customerDim_levels = customerDim.getLevels();
    Level shipToLevel = (Level)customerDim_levels.elementAt(0);

    // Create the PRODUCT_AW Dimension and set names for the object.
    Dimension productDim = globalAW.createDimension();
    productDim.setName("PRODUCT_AW");
    productDim.setShortName("PRODUCT_AW");
    productDim.setLongName("PRODUCT_AW Dimension");

    // Create the Attribute, Level, and Hierarchy objects for the Dimension.
    this.createProductDim(productDim);

    // Get the detail level to use when creating a Cube.
    Vector productDim_levels = productDim.getLevels();
    Level itemLevel = (Level)productDim_levels.elementAt(0);

    // Create the CHANNEL_AW Dimension and set names for the object.
    Dimension channelDim = globalAW.createDimension();
    channelDim.setName("CHANNEL_AW");
    channelDim.setShortName("CHANNEL_AW");
    channelDim.setLongName("CHANNEL_AW dimension");

    // Create the Attribute, Level, and Hierarchy objects for the Dimension.
    this.createChannelDimension(channelDim);

    // Get the detail level, which is shared by all dimension hierarchies,
    // to use when creating a Cube.
    Vector _channel_levels = channelDim.getLevels();
    Level channelLevel = (Level)_channel_levels.elementAt(0);

    // Create the UNITS_CUBE_AW Cube and the measures to associate with it.
    this.clearCubeMapVectors();
    Cube unitsCube = globalAW.createCube();
    unitsCube.setName("UNITS_CUBE_AW");

    // Add the dimensions to the _dimList Vector.
    _dimList.add(timeDim);
    _dimList.add(customerDim);
    _dimList.add(productDim);
    _dimList.add(channelDim);

    // Specify the dimensions for the Cube.
    this.associateCubeDimensions(unitsCube, _dimList);

    // Create an aggregation map for the Cube.
    this.precomputeNA(unitsCube, "AGGMAP_UC");

    // Create a Measure for the quantities of units sold.
    Measure units = unitsCube.createMeasure();

    units.setName("UNITS_AW");
    units.setShortName("UNITS_AW");
    units.setLongName("UNITS_AW measure");
    units.setDataType("NUMBER");

    // Add the Measure to the _measures Vector.
    _measures.add(units);
    // Add the column of the Global schema relational table to the
    // _measCols Vector.
    _measCols.add("GLOBAL.UNITS_HISTORY_FACT.UNITS");

    // Create a Measure for the monetary amount of units sold.
    Measure sales = unitsCube.createMeasure();

    sales.setName("SALES_AW");
    sales.setShortName("SALES_AW");
    sales.setLongName("SALES_AW measure");
    sales.setDataType("NUMBER");
    _measures.add(sales);
    _measCols.add("GLOBAL.UNITS_HISTORY_FACT.SALES");

    // Add the detail levels for the dimensions to the _levels Vector and
    // the relational columns for the levels to the _cols Vector.
    _levels.add(monthLevel);
    _cols.add("GLOBAL.UNITS_HISTORY_FACT.MONTH_ID");
    _levels.add(shipToLevel);
    _cols.add("GLOBAL.UNITS_HISTORY_FACT.SHIP_TO_ID");
    _levels.add(itemLevel);
    _cols.add("GLOBAL.UNITS_HISTORY_FACT.ITEM_ID");
    _levels.add(channelLevel);
    _cols.add("GLOBAL.UNITS_HISTORY_FACT.CHANNEL_ID");

    // Map the columns of the relational tables to the dimensions and measures
    // of the analytic workspace Cube.
    this.createCubeMap(unitsCube, _levels, _cols, _measures, _measCols);

   
    // Create the PRICE_COST_CUBE_AW Cube and the measures to associate with it.
    this.clearCubeMapVectors();

    Cube priceCostCube = globalAW.createCube();
    priceCostCube.setName("PRICE_COST_CUBE_AW");

    _dimList.add(productDim);
    _dimList.add(timeDim);

    this.associateCubeDimensions(priceCostCube, _dimList);
    this.precomputeNA(priceCostCube, "AGGMAP_PCC");

    // Create a Measure for unit prices.
    Measure price = priceCostCube.createMeasure();

    price.setName("UNIT_PRICE_AW");
    price.setShortName("UNIT_PRICE_AW");
    price.setLongName("UNIT_PRICE_AW measure");
    price.setDataType("NUMBER");
    _measures.add(price);
    _measCols.add("GLOBAL.PRICE_AND_COST_HIST_FACT.UNIT_PRICE");

    // Create a Measure for unit costs.
    Measure cost = priceCostCube.createMeasure();

    cost.setName("UNIT_COST_AW");
    price.setShortName("UNIT_COST_AW");
    cost.setLongName("UNIT_COST_AW measure");
    cost.setDataType("NUMBER");
    _measures.add(cost);
    _measCols.add("GLOBAL.PRICE_AND_COST_HIST_FACT.UNIT_COST");
   
    _levels.add(itemLevel);
    _cols.add("GLOBAL.PRICE_AND_COST_HIST_FACT.ITEM_ID");
    _levels.add(monthLevel);
    _cols.add("GLOBAL.PRICE_AND_COST_HIST_FACT.MONTH_ID");

    this.createCubeMap(priceCostCube, _levels, _cols, _measures, _measCols);

    // Create a MeasureFolder and add the measures to it.
    // A MeasureFolder appears as an MdmSchema object to an
    // Oracle OLAP Java API application.
    MeasureFolder measureFolder = globalAW.createMeasureFolder();
    measureFolder.setName("GLOBALAW_SCHEMA");
    measureFolder.setShortName("GLOBALAW_SCHEMA");
    measureFolder.setLongName("GLOBALAW_SCHEMA schema");
    measureFolder.addMeasure(units);
    measureFolder.addMeasure(sales);
    measureFolder.addMeasure(cost);
    measureFolder.addMeasure(price);

    // Write the XML string for the analytic workspace.
    String XML = globalAW.WriteToXML();

    try
    {
      File xmlFile = new File(xmlStr);
      FileWriter xmlout = new FileWriter(xmlFile);
      xmlout.write(XML);
      xmlout.write("\n");
      xmlout.close();
    }
    catch (Exception e)
    {
      System.out.println("Failure to write XML string to file: " +
                          e.toString());
    }

    // Build the analytic workspace framework.
    System.out.println("Building the " + awName + " framework.");
    globalAW.Create(awConnection);
    globalAW.Commit(awConnection);

    System.out.println(awName + " framework built!");

    // Populate the analytic workspace with the metadata objects and
    // the data from the relational schema.
View Full Code Here


    // Delete the analytic workspace if it already exists.
    deleteExistingAW(awConnection, user, awName);

    // Create an AW object and give it a name.
    AW globalAW = new AW();
    globalAW.setName(awName);

    // Create Dimension objects, and pass each Dimension to a method that
    // creates Attribute, Hierarchy, and Level objects for it.

    // Create the TIME_AW Dimension and set names for the object.
    Dimension timeDim = globalAW.createDimension();
    timeDim.setName("TIME_AW");
    timeDim.setShortName("TIME_AW");
    timeDim.setLongName("TIME_AW dimension");
    timeDim.setIsTime(true);

    // Create the Attribute, Level, and Hierarchy objects for the Dimension.
    this.createTimeDim(timeDim);

    // Get the detail level to use when creating a Cube.
    Vector _time_levels = timeDim.getLevels();
    Level monthLevel = (Level)_time_levels.elementAt(0);

    // Create the CUSTOMER_AW Dimension and set names for the object.
    Dimension customerDim = globalAW.createDimension();
    customerDim.setName("CUSTOMER_AW");
    customerDim.setShortName("CUSTOMER_AW");
    customerDim.setLongName("CUSTOMER_AW dimension");

    // Create the Attribute, Level, and Hierarchy objects for the Dimension.
    this.createCustomerDim(customerDim);

    // Get the detail level to use when creating a Cube.
    Vector customerDim_levels = customerDim.getLevels();
    Level shipToLevel = (Level)customerDim_levels.elementAt(0);

    // Create the PRODUCT_AW Dimension and set names for the object.
    Dimension productDim = globalAW.createDimension();
    productDim.setName("PRODUCT_AW");
    productDim.setShortName("PRODUCT_AW");
    productDim.setLongName("PRODUCT_AW Dimension");

    // Create the Attribute, Level, and Hierarchy objects for the Dimension.
    this.createProductDim(productDim);

    // Get the detail level to use when creating a Cube.
    Vector productDim_levels = productDim.getLevels();
    Level itemLevel = (Level)productDim_levels.elementAt(0);

    // Create the CHANNEL_AW Dimension and set names for the object.
    Dimension channelDim = globalAW.createDimension();
    channelDim.setName("CHANNEL_AW");
    channelDim.setShortName("CHANNEL_AW");
    channelDim.setLongName("CHANNEL_AW dimension");

    // Create the Attribute, Level, and Hierarchy objects for the Dimension.
    this.createChannelDimension(channelDim);

    // Get the detail level, which is shared by all dimension hierarchies,
    // to use when creating a Cube.
    Vector _channel_levels = channelDim.getLevels();
    Level channelLevel = (Level)_channel_levels.elementAt(0);

    // Create the UNITS_CUBE_AW Cube and the measures to associate with it.
    this.clearCubeMapVectors();
    Cube unitsCube = globalAW.createCube();
    unitsCube.setName("UNITS_CUBE_AW");

    // Add the dimensions to the _dimList Vector.
    _dimList.add(timeDim);
    _dimList.add(customerDim);
    _dimList.add(productDim);
    _dimList.add(channelDim);

    // Specify the dimensions for the Cube.
    this.associateCubeDimensions(unitsCube, _dimList);

    // Create an aggregation map for the Cube.
    this.precomputeNA(unitsCube, "AGGMAP_UC");

    // Create a Measure for the quantities of units sold.
    Measure units = unitsCube.createMeasure();

    units.setName("UNITS_AW");
    units.setShortName("UNITS_AW");
    units.setLongName("UNITS_AW measure");
    units.setDataType("NUMBER");

    // Add the Measure to the _measures Vector.
    _measures.add(units);
    // Add the column of the Global schema relational table to the
    // _measCols Vector.
    _measCols.add("GLOBAL.UNITS_HISTORY_FACT.UNITS");

    // Create a Measure for the monetary amount of units sold.
    Measure sales = unitsCube.createMeasure();

    sales.setName("SALES_AW");
    sales.setShortName("SALES_AW");
    sales.setLongName("SALES_AW measure");
    sales.setDataType("NUMBER");
    _measures.add(sales);
    _measCols.add("GLOBAL.UNITS_HISTORY_FACT.SALES");

    // Add the detail levels for the dimensions to the _levels Vector and
    // the relational columns for the levels to the _cols Vector.
    _levels.add(monthLevel);
    _cols.add("GLOBAL.UNITS_HISTORY_FACT.MONTH_ID");
    _levels.add(shipToLevel);
    _cols.add("GLOBAL.UNITS_HISTORY_FACT.SHIP_TO_ID");
    _levels.add(itemLevel);
    _cols.add("GLOBAL.UNITS_HISTORY_FACT.ITEM_ID");
    _levels.add(channelLevel);
    _cols.add("GLOBAL.UNITS_HISTORY_FACT.CHANNEL_ID");

    // Map the columns of the relational tables to the dimensions and measures
    // of the analytic workspace Cube.
    this.createCubeMap(unitsCube, _levels, _cols, _measures, _measCols);

   
    // Create the PRICE_COST_CUBE_AW Cube and the measures to associate with it.
    this.clearCubeMapVectors();

    Cube priceCostCube = globalAW.createCube();
    priceCostCube.setName("PRICE_COST_CUBE_AW");

    _dimList.add(productDim);
    _dimList.add(timeDim);

    this.associateCubeDimensions(priceCostCube, _dimList);
    this.precomputeNA(priceCostCube, "AGGMAP_PCC");

    // Create a Measure for unit prices.
    Measure price = priceCostCube.createMeasure();

    price.setName("UNIT_PRICE_AW");
    price.setShortName("UNIT_PRICE_AW");
    price.setLongName("UNIT_PRICE_AW measure");
    price.setDataType("NUMBER");
    _measures.add(price);
    _measCols.add("GLOBAL.PRICE_AND_COST_HIST_FACT.UNIT_PRICE");

    // Create a Measure for unit costs.
    Measure cost = priceCostCube.createMeasure();

    cost.setName("UNIT_COST_AW");
    price.setShortName("UNIT_COST_AW");
    cost.setLongName("UNIT_COST_AW measure");
    cost.setDataType("NUMBER");
    _measures.add(cost);
    _measCols.add("GLOBAL.PRICE_AND_COST_HIST_FACT.UNIT_COST");
   
    _levels.add(itemLevel);
    _cols.add("GLOBAL.PRICE_AND_COST_HIST_FACT.ITEM_ID");
    _levels.add(monthLevel);
    _cols.add("GLOBAL.PRICE_AND_COST_HIST_FACT.MONTH_ID");

    this.createCubeMap(priceCostCube, _levels, _cols, _measures, _measCols);

    // Create a MeasureFolder and add the measures to it.
    // A MeasureFolder appears as an MdmSchema object to an
    // Oracle OLAP Java API application.
    MeasureFolder measureFolder = globalAW.createMeasureFolder();
    measureFolder.setName("GLOBALAW_SCHEMA");
    measureFolder.setShortName("GLOBALAW_SCHEMA");
    measureFolder.setLongName("GLOBALAW_SCHEMA schema");
    measureFolder.addMeasure(units);
    measureFolder.addMeasure(sales);
    measureFolder.addMeasure(cost);
    measureFolder.addMeasure(price);

    // Write the XML string for the analytic workspace.
    String XML = globalAW.WriteToXML();

    try
    {
      File xmlFile = new File(xmlStr);
      FileWriter xmlout = new FileWriter(xmlFile);
      xmlout.write(XML);
      xmlout.write("\n");
      xmlout.close();
    }
    catch (Exception e)
    {
      System.out.println("Failure to write XML string to file: " +
                          e.toString());
    }

    // Build the analytic workspace framework.
    System.out.println("Building the " + awName + " framework.");
    globalAW.Create(awConnection);
    globalAW.Commit(awConnection);

    System.out.println(awName + " framework built!");

    // Populate the analytic workspace with the metadata objects and
    // the data from the relational schema.
View Full Code Here

TOP

Related Classes of oracle.AWXML.AW

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.