コード例 #1
0
  public LogicalModel getOrdersModel() {
    if (ordersModel == null) {
      if (USE_LEGACY_CWM) {

        CWM cwm = null;
        try {
          cwm = CWM.getInstance("Orders", true); // $NON-NLS-1$
          Assert.assertNotNull("CWM singleton instance is null", cwm);
          cwm.importFromXMI("samples/orders.xmi"); // $NON-NLS-1$
        } catch (Exception e) {
          e.printStackTrace();
          Assert.fail();
        }
        CwmSchemaFactory cwmSchemaFactory = new CwmSchemaFactory();

        SchemaMeta schemaMeta = cwmSchemaFactory.getSchemaMeta(cwm);
        org.pentaho.pms.schema.BusinessModel oldOrdersModel =
            schemaMeta.findModel("Orders"); // $NON-NLS-1$
        try {
          Domain domain = ThinModelConverter.convertFromLegacy(schemaMeta);
          ordersModel = domain.findLogicalModel("Orders"); // $NON-NLS-1$
          Assert.assertNotNull(ordersModel);
        } catch (Exception e) {
          e.printStackTrace();
        }
        // convert to and then from thin model just for giggles
      } else {
        try {
          Domain domain = new XmiParser().parseXmi(new FileInputStream("samples/orders.xmi"));
          ordersModel = domain.findLogicalModel("Orders");
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
    return ordersModel;
  }
コード例 #2
0
  public void loadOrdersModel() {
    CWM cwm = null;
    try {
      cwm = CWM.getInstance("Orders", true); // $NON-NLS-1$
      assertNotNull("CWM singleton instance is null", cwm);
      cwm.importFromXMI("samples/orders.xmi"); // $NON-NLS-1$
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
    cwmSchemaFactory = new CwmSchemaFactory();

    SchemaMeta schemaMeta = cwmSchemaFactory.getSchemaMeta(cwm);
    ordersModel = schemaMeta.findModel("Orders"); // $NON-NLS-1$
  }