当前位置: 首页>>代码示例>>Java>>正文


Java MetaStoreFactory.getElements方法代码示例

本文整理汇总了Java中org.pentaho.metastore.persist.MetaStoreFactory.getElements方法的典型用法代码示例。如果您正苦于以下问题:Java MetaStoreFactory.getElements方法的具体用法?Java MetaStoreFactory.getElements怎么用?Java MetaStoreFactory.getElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.metastore.persist.MetaStoreFactory的用法示例。


在下文中一共展示了MetaStoreFactory.getElements方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addDataSet

import org.pentaho.metastore.persist.MetaStoreFactory; //导入方法依赖的package包/类
public void addDataSet() {

    Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );

    IMetaStore metaStore = spoon.getMetaStore();

    try {
      MetaStoreFactory<DataSetGroup> groupFactory = new MetaStoreFactory<DataSetGroup>( DataSetGroup.class, metaStore, PentahoDefaults.NAMESPACE );
      List<DatabaseMeta> databases = getAvailableDatabases( spoon.getRepository() );
      groupFactory.addNameList( DataSetConst.DATABASE_LIST_KEY, databases );
      List<DataSetGroup> groups = groupFactory.getElements();

      MetaStoreFactory<DataSet> setFactory = new MetaStoreFactory<DataSet>( DataSet.class, metaStore, PentahoDefaults.NAMESPACE );
      setFactory.addNameList( DataSetConst.GROUP_LIST_KEY, groups );

      DataSet dataSet = new DataSet();

      editDataSet( spoon, dataSet, groups, setFactory, null );

    } catch ( Exception e ) {
      new ErrorDialog( spoon.getShell(), "Error", "Error creating a new data set", e );
    }
  }
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:24,代码来源:DataSetHelper.java

示例2: editDataSet

import org.pentaho.metastore.persist.MetaStoreFactory; //导入方法依赖的package包/类
public void editDataSet() {

    Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
    IMetaStore metaStore = spoon.getMetaStore();

    try {
      MetaStoreFactory<DataSetGroup> groupFactory = new MetaStoreFactory<DataSetGroup>( DataSetGroup.class, metaStore, PentahoDefaults.NAMESPACE );
      List<DatabaseMeta> databases = getAvailableDatabases( spoon.getRepository() );
      groupFactory.addNameList( DataSetConst.DATABASE_LIST_KEY, databases );
      List<DataSetGroup> groups = groupFactory.getElements();

      MetaStoreFactory<DataSet> setFactory = new MetaStoreFactory<DataSet>( DataSet.class, metaStore, PentahoDefaults.NAMESPACE );
      setFactory.addNameList( DataSetConst.GROUP_LIST_KEY, groups );

      List<String> setNames = setFactory.getElementNames();
      Collections.sort( setNames );
      EnterSelectionDialog esd = new EnterSelectionDialog( spoon.getShell(), setNames.toArray( new String[setNames.size()] ), "Select the set", "Select the data set to edit..." );
      String setName = esd.open();
      if ( setName != null ) {
        DataSet dataSet = setFactory.loadElement( setName );

        editDataSet( spoon, dataSet, groups, setFactory, setName );
      }
    } catch ( Exception e ) {
      new ErrorDialog( spoon.getShell(), "Error", "Error retrieving the list of data set groups", e );
    }
  }
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:28,代码来源:DataSetHelper.java

示例3: createDataSetFromStep

import org.pentaho.metastore.persist.MetaStoreFactory; //导入方法依赖的package包/类
/**
 * Create a new data set with the output from 
 */
public void createDataSetFromStep() {
  Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
  TransGraph transGraph = spoon.getActiveTransGraph();
  IMetaStore metaStore = spoon.getMetaStore();
  if ( transGraph == null ) {
    return;
  }
  StepMeta stepMeta = transGraph.getCurrentStep();
  TransMeta transMeta = spoon.getActiveTransformation();
  if ( stepMeta == null || transMeta == null ) {
    return;
  }

  try {
    MetaStoreFactory<DataSetGroup> groupFactory = new MetaStoreFactory<DataSetGroup>( DataSetGroup.class, metaStore, PentahoDefaults.NAMESPACE );
    List<DatabaseMeta> databases = getAvailableDatabases( spoon.getRepository() );
    groupFactory.addNameList( DataSetConst.DATABASE_LIST_KEY, databases );
    List<DataSetGroup> groups = groupFactory.getElements();

    MetaStoreFactory<DataSet> setFactory = new MetaStoreFactory<DataSet>( DataSet.class, metaStore, PentahoDefaults.NAMESPACE );
    setFactory.addNameList( DataSetConst.GROUP_LIST_KEY, groups );

    DataSet dataSet = new DataSet();
    RowMetaInterface rowMeta = transMeta.getStepFields( stepMeta );
    for ( int i = 0; i < rowMeta.size(); i++ ) {
      ValueMetaInterface valueMeta = rowMeta.getValueMeta( i );
      DataSetField field = new DataSetField( valueMeta.getName(), "field" + i, valueMeta.getType(), valueMeta.getLength(), valueMeta.getPrecision(), valueMeta.getComments() );
      dataSet.getFields().add( field );
    }

    editDataSet( spoon, dataSet, groups, setFactory, null );

  } catch ( Exception e ) {
    new ErrorDialog( spoon.getShell(), "Error", "Error creating a new data set", e );
  }
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:40,代码来源:DataSetHelper.java

示例4: findUnitTests

import org.pentaho.metastore.persist.MetaStoreFactory; //导入方法依赖的package包/类
private List<TransUnitTest> findUnitTests(TransMeta transMeta, DelegatingMetaStore metaStore) {
  
  MetaStoreFactory<TransUnitTest> factory = new MetaStoreFactory<TransUnitTest>(TransUnitTest.class, metaStore, PentahoDefaults.NAMESPACE);
  List<TransUnitTest> tests = new ArrayList<TransUnitTest>();
  
  try {
    List<TransUnitTest> allTests = factory.getElements();
    for (TransUnitTest test : allTests) {
      // Match the filename
      //
      if (StringUtils.isNotEmpty(transMeta.getFilename())) {
        if (transMeta.getFilename().equals(test.getTransFilename())) {
          tests.add(test);
        }
      } else {
        if (transMeta.getRepository()!=null) {
          // No filename, check the object_id ...
          //
          if (transMeta.getObjectId()!=null && transMeta.getObjectId().getId().equals(test.getTransObjectId())) {
            tests.add(test);
          } else {
            // Try the repository path..
            //
            // What is the repsository path?
            String repositoryPath = transMeta.getRepositoryDirectory().getPath() + "/" + transMeta.getName();
            if (repositoryPath.equals(test.getTransRepositoryPath())) {
              tests.add(test);
            }
          }
        }
      }
    }
    
  } catch(Exception exception) {
    new ErrorDialog(Spoon.getInstance().getShell(), 
        BaseMessages.getString(PKG, "ShowUnitTestMenuExtensionPoint.ErrorFindingUnitTestsForTransformation.Title"),
        BaseMessages.getString(PKG, "ShowUnitTestMenuExtensionPoint.ErrorFindingUnitTestsForTransformation.Message"), 
        exception);   
  }
  return tests;
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:42,代码来源:ShowUnitTestMenuExtensionPoint.java

示例5: testSerialisation

import org.pentaho.metastore.persist.MetaStoreFactory; //导入方法依赖的package包/类
@Test
public void testSerialisation() throws Exception {
  MetaStoreFactory<DataSetGroup> groupFactory = new MetaStoreFactory<DataSetGroup>( DataSetGroup.class, metaStore, NAMESPACE );
  MetaStoreFactory<DataSet> setFactory = new MetaStoreFactory<DataSet>( DataSet.class, metaStore, NAMESPACE );

  // Save the group...
  //
  groupFactory.saveElement( dataSetGroup );

  // Save the DataSet...
  //
  setFactory.saveElement( dataSet );

  // Load it back up...
  //
  // First load the data set groups
  //
  groupFactory.addNameList( DataSetConst.DATABASE_LIST_KEY, Arrays.asList( databaseMeta ) );
  List<DataSetGroup> groups = groupFactory.getElements();

  // Pass this list to the set factory for reference...
  //
  setFactory.addNameList( DataSetConst.GROUP_LIST_KEY, groups );

  // Re-load the data set
  //
  DataSet verify = setFactory.loadElement( NAME );

  // Verify if everything is still the same...
  //
  assertEquals( NAME, dataSet.getName() );
  assertEquals( NAME, verify.getName() );
  assertEquals( DESC, dataSet.getDescription() );
  assertEquals( DESC, verify.getDescription() );
  assertEquals( TABLE, dataSet.getTableName() );
  assertEquals( TABLE, verify.getTableName() );
  assertEquals( dataSetGroup, dataSet.getGroup() );
  assertEquals( dataSetGroup, verify.getGroup() );
  assertEquals( NR_FIELDS, dataSet.getFields().size() );
  assertEquals( NR_FIELDS, verify.getFields().size() );

  for ( int i = 0; i < NR_FIELDS; i++ ) {
    DataSetField referenceField = dataSet.getFields().get( i );
    DataSetField verifyField = verify.getFields().get( i );
    assertEquals( referenceField, verifyField );
  }
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:48,代码来源:DataSetTest.java

示例6: refreshGroups

import org.pentaho.metastore.persist.MetaStoreFactory; //导入方法依赖的package包/类
private void refreshGroups(IMetaStore metaStore) throws MetaStoreException {
  
  MetaStoreFactory<DataSetGroup> factory = new MetaStoreFactory<DataSetGroup>(DataSetGroup.class, metaStore, PentahoDefaults.NAMESPACE);
  factory.addNameList( DataSetConst.DATABASE_LIST_KEY, databases );
  
  groups = factory.getElements();
  
  List<String> names = factory.getElementNames();
  Collections.sort(names);
  wDataSetGroup.setItems(names.toArray(new String[names.size()]));      

}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:13,代码来源:DataSetDialog.java


注:本文中的org.pentaho.metastore.persist.MetaStoreFactory.getElements方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。