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


Java LogicalModel.getProperty方法代码示例

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


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

示例1: testWriteAndParseLevelFormatter

import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
@Test
public void testWriteAndParseLevelFormatter() throws Exception {
  Domain domain = parser.parseXmi( getClass().getResourceAsStream( "/example_olap.xmi" ) );
  LogicalModel analysisModel = domain.getLogicalModels().get( 0 );
  @SuppressWarnings( "unchecked" )
  List<OlapDimension> dims = (List<OlapDimension>) analysisModel.getProperty( LogicalModel.PROPERTY_OLAP_DIMS );

  OlapHierarchyLevel firstLevel = dims.get( 0 ).getHierarchies().get( 0 ).getHierarchyLevels().get( 0 );
  firstLevel.setFormatter( "InlineMemberFormatter" );

  String xmi = parser.generateXmi( domain );
  assertTrue( xmi.contains( "<CWM:TaggedValue tag=\"HIERARCHY_LEVEL_FORMATTER\" value=\"InlineMemberFormatter\"" ) );

  domain = parser.parseXmi( new ByteArrayInputStream( xmi.getBytes() ) );
  analysisModel = domain.getLogicalModels().get( 0 );
  @SuppressWarnings( "unchecked" )
  List<OlapDimension> parsedDims = (List<OlapDimension>) analysisModel.getProperty( LogicalModel.PROPERTY_OLAP_DIMS );
  firstLevel = parsedDims.get( 0 ).getHierarchies().get( 0 ).getHierarchyLevels().get( 0 );
  assertEquals( "InlineMemberFormatter", firstLevel.getFormatter() );
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:21,代码来源:XmiParserIT.java

示例2: testMeasureFormatString

import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
@Test
public void testMeasureFormatString() throws Exception {
  LogicalModel businessModel = getTestModel( TargetTableType.TABLE, "tableName", "schemaName", true );
  List<OlapCube> cubes = (List<OlapCube>) businessModel.getProperty( "olap_cubes" );
  cubes.get( 0 ).getOlapMeasures().get( 0 ).getLogicalColumn().setProperty( "mask", "###.##" );
  MondrianModelExporter exporter = new MondrianModelExporter( businessModel, "en_US" );
  String data = exporter.createMondrianModelXML();

  TestHelper.assertEqualsIgnoreWhitespaces( "<Schema name=\"model\">\n" + "  <Dimension name=\"Dim1\">\n"
    + "    <Hierarchy name=\"Hier1\" hasAll=\"false\">\n"
    + "    <Table name=\"tableName\" schema=\"schemaName\" />\n"
    + "      <Level name=\"Lvl1\" uniqueMembers=\"false\" column=\"pc1\" type=\"Numeric\" visible=\"false\">\n"
    + "      </Level>\n"
    + "    </Hierarchy>\n" + "  </Dimension>\n" + "  <Cube name=\"Cube1\">\n"
    + "    <Table name=\"tableName\" schema=\"schemaName\" />\n"
    + "    <DimensionUsage name=\"Dim1\" source=\"Dim1\" foreignKey=\"pc2\"/>\n"
    + "    <Measure name=\"bc1\" column=\"pc1\" aggregator=\"sum\" formatString=\"###.##\" visible=\"false\"/>\n"
    + "  </Cube>\n"
    + "</Schema>", data );
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:21,代码来源:MondrianModelExporterTest.java

示例3: getTestModelWithCalcMembers

import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
private LogicalModel getTestModelWithCalcMembers( TargetTableType tableType, String targetTable, String targetSchema,
    boolean hiddenMembers ) {

  LogicalModel businessModel = getTestModel( tableType, targetTable, targetSchema, hiddenMembers );

  List<OlapCube> cubes = (List<OlapCube>) businessModel.getProperty( "olap_cubes" );
  OlapCube cube = cubes.get( 0 );

  // Add calculated member
  OlapCalculatedMember hiddenCalculatedMember = new OlapCalculatedMember(
      "hcm", "Dim1", "[Measures].[Meas1] * 2", null, true
  );
  hiddenCalculatedMember.setHidden( hiddenMembers );
  List<OlapCalculatedMember> calculatedMembers = new ArrayList<>();
  calculatedMembers.add( hiddenCalculatedMember );
  cube.setOlapCalculatedMembers( calculatedMembers );

  return businessModel;
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:20,代码来源:MondrianModelExporterTest.java

示例4: initialize

import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
/**
 * Initialize the first model in the domain with our configuration.
 *
 * @param domain Domain to initialize
 *
 * @throws ModelerException error initializing domain
 */
@Override
public void initialize(Domain domain) throws ModelerException {
  super.initialize(domain);
  LogicalModel lm = domain.getLogicalModels().get(0);
  if(lm.getProperty(getFilenamePropertyName()) != null) {
    setFilename(lm.getProperty(getFilenamePropertyName()).toString());
  }
  if (lm.getProperty(getRepositoryNamePropertyName()) != null) {
    setRepositoryName(lm.getProperty(getRepositoryNamePropertyName()).toString());
  }
  if (lm.getProperty(getMetaIdPropertyName()) != null) {
    setMetaId(lm.getProperty(getMetaIdPropertyName()).toString());
  }
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:22,代码来源:KettleModelerSource.java

示例5: testCalculatedMembers

import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
@Test
public void testCalculatedMembers() throws Exception {
  LogicalModel businessModel = getTestModel( TargetTableType.INLINE_SQL, "select * from customer", "" );
  List<OlapCalculatedMember> members = new ArrayList<OlapCalculatedMember>();
  members.add( new OlapCalculatedMember( "Constant One", "Measures", "1", "Currency", false ) );
  members.add( new OlapCalculatedMember( "Constant Two", "Measures", "2", "Currency", true ) );

  @SuppressWarnings( "unchecked" )
  List<OlapCube> cubes = (List<OlapCube>) businessModel.getProperty( "olap_cubes" );
  OlapCube cube = cubes.get( 0 );
  cube.setOlapCalculatedMembers( members );

  MondrianModelExporter exporter = new MondrianModelExporter( businessModel, "en_US" );
  String data = exporter.createMondrianModelXML();

  TestHelper.assertEqualsIgnoreWhitespaces( "<Schema name=\"model\">\n" + "  <Dimension name=\"Dim1\">\n"
      + "    <Hierarchy name=\"Hier1\" hasAll=\"false\">\n" + "    <View alias=\"FACT\">\n"
      + "        <SQL dialect=\"generic\">\n" + "         <![CDATA[select * from customer]]>\n" + "        </SQL>\n"
      + "    </View>\n" + "      <Level name=\"Lvl1\" uniqueMembers=\"false\" column=\"pc1\" type=\"Numeric\">\n"
      + "      </Level>\n" + "    </Hierarchy>\n" + "  </Dimension>\n" + "  <Cube name=\"Cube1\">\n"
      + "    <View alias=\"FACT\">\n" + "        <SQL dialect=\"generic\">\n"
      + "         <![CDATA[select * from customer]]>\n" + "        </SQL>\n" + "    </View>\n"
      + "    <DimensionUsage name=\"Dim1\" source=\"Dim1\" foreignKey=\"pc2\"/>\n"
      + "    <Measure name=\"bc1\" column=\"pc1\" aggregator=\"sum\"/>\n"
      + "    <CalculatedMember name=\"Constant One\" dimension=\"Measures\" formatString=\"Currency\">\n"
      + "      <Formula><![CDATA[1]]></Formula>\n"
      + "      <CalculatedMemberProperty name=\"SOLVE_ORDER\" value=\"0\"/>\n"
      + "    </CalculatedMember>\n"
      + "    <CalculatedMember name=\"Constant Two\" dimension=\"Measures\" formatString=\"Currency\">\n"
      + "      <Formula><![CDATA[2]]></Formula>\n"
      + "      <CalculatedMemberProperty name=\"SOLVE_ORDER\" value=\"200\"/>\n"
      + "    </CalculatedMember>\n"
      + "  </Cube>\n"
      + "</Schema>", data );
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:36,代码来源:MondrianModelExporterTest.java

示例6: testDescriptions

import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
@Test
public void testDescriptions() throws Exception {
  LogicalModel businessModel = getTestModel( TargetTableType.TABLE, "table", "schema" );
  @SuppressWarnings( "unchecked" )
  List<OlapCube> cubes = (List<OlapCube>) businessModel.getProperty( LogicalModel.PROPERTY_OLAP_CUBES );
  OlapMeasure measure = cubes.get( 0 ).getOlapMeasures().get( 0 );
  measure.getLogicalColumn().setDescription( new LocalizedString( "en_US", "it's a measure" ) );
  OlapHierarchyLevel level =
      cubes.get( 0 ).getOlapDimensionUsages().get( 0 ).getOlapDimension().getHierarchies().get( 0 )
          .getHierarchyLevels().get( 0 );
  OlapAnnotation description = new OlapAnnotation();
  description.setName( "description.en_US" );
  description.setValue( "description with > in there" );
  level.getAnnotations().add( description );

  MondrianModelExporter exporter = new MondrianModelExporter( businessModel, "en_US" );
  final String schema = exporter.createMondrianModelXML();

  TestHelper.assertEqualsIgnoreWhitespaces(
      "<Schema name=\"model\">\n"
          + "  <Dimension name=\"Dim1\">\n"
          + "    <Hierarchy name=\"Hier1\" hasAll=\"false\">\n"
          + "      <Table name=\"table\" schema=\"schema\"/>\n"
          + "      <Level name=\"Lvl1\" uniqueMembers=\"false\" column=\"pc1\" type=\"Numeric\">\n"
          + "        <Annotations>\n"
          + "          <Annotation name=\"description.en_US\">description with &gt; in there</Annotation>\n"
          + "        </Annotations>\n"
          + "      </Level>\n"
          + "    </Hierarchy>\n"
          + "  </Dimension>\n"
          + "  <Cube name=\"Cube1\">\n"
          + "    <Table name=\"table\" schema=\"schema\"/>\n"
          + "    <DimensionUsage name=\"Dim1\" source=\"Dim1\" foreignKey=\"pc2\"/>\n"
          + "    <Measure name=\"bc1\" column=\"pc1\" aggregator=\"sum\" description=\"it&#39;s a measure\"/>\n"
          + "  </Cube>\n" + "</Schema>", schema );
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:37,代码来源:MondrianModelExporterTest.java

示例7: open

import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
public boolean open(Node transNode, String fname, boolean importfile) {
  Spoon spoon = ((Spoon)SpoonFactory.getInstance());
  try {
    File f = new File( fname );
    reportName = f.getName();
    reportName = reportName.substring(0, reportName.indexOf(".xanalyzer")); //$NON-NLS-1$
    FileInputStream in = new FileInputStream( f );
    StringBuilder sb = new StringBuilder();
    byte b[] = new byte[2048];
    int n = in.read(b);
    while( n != -1 ) {
      sb.append( new String(b, 0, n) );
      n = in.read(b);
    }
    
    Document doc = DocumentHelper.parseText(sb.toString());
    Dom4jXPath xpath = new Dom4jXPath( "//@catalog"); //$NON-NLS-1$
    Dom4jXPath xpath2 = new Dom4jXPath( "//@cube"); //$NON-NLS-1$
    HashMap map = new HashMap();
    map.put( "pho", "http://www.pentaho.com"); //$NON-NLS-1$ //$NON-NLS-2$
    xpath.setNamespaceContext( new SimpleNamespaceContext( map));
    xpath2.setNamespaceContext( new SimpleNamespaceContext( map));
    org.dom4j.Node node = (org.dom4j.Node) xpath.selectSingleNode( doc);
    org.dom4j.Node node2 = (org.dom4j.Node) xpath2.selectSingleNode( doc);

    String modelFileName = node.getText();
    String modelId = node2.getText();            
    
    SwtXulLoader theXulLoader = new SwtXulLoader();
    theXulLoader.registerClassLoader(getClass().getClassLoader());
    AnalyzerVisualizationController theController = new AnalyzerVisualizationController(spoon.tabfolder.getSwtTabset(), this, modelFileName, modelId, f.toString(), f.getName());
    theController.setDirty(false);
  	XulDomContainer theXulContainer = theXulLoader.loadXul(WEB_VISUALIZATION, new PDIMessages(IVisualization.class));
	theXulContainer.addEventHandler(theController);
	Composite theMainBox = (Composite) theXulContainer.getDocumentRoot().getElementById("mainVBox").getManagedObject(); //$NON-NLS-1$
	SwtXulRunner theRunner = new SwtXulRunner();
	theRunner.addContainer(theXulContainer);
	theRunner.initialize();

	ModelerWorkspace model = new ModelerWorkspace(new SpoonModelerWorkspaceHelper(), SpoonModelerWorkspaceHelper.initGeoContext());
   XmiParser parser = new XmiParser();
   FileInputStream inputStream = new FileInputStream(new File(modelFileName));
   Domain domain = parser.parseXmi(inputStream);
   inputStream.close();
   if(model.getDomain() != null) {
      LogicalModel logical = model.getLogicalModel(ModelerPerspective.ANALYSIS);
      Object property = logical.getProperty("source_type"); //$NON-NLS-1$
      if( property != null ) {
        IModelerSource theSource = ModelerSourceFactory.generateSource(property.toString());
        theSource.initialize(domain);
        model.setModelSource(theSource);
      }
    }
    if (domain.getId() == null) {
      domain.setId(modelId);
    }
   model.setDomain(domain);
   model.setModelName(domain.getId());
   model.setFileName(modelFileName); 
   model.setTemporary(false);
   theController.setModel(model);
   theXulContainer.addEventHandler(theController);
	
    createTabForBrowser(theMainBox, theController, model);

    // flush the cache before opening an analyzer visualization
    flushAnalyzerCache();
    theController.openReport(fname);
    
    String fullPath = f.getAbsolutePath();
    spoon.getProperties().addLastFile("Analyzer", fullPath, null, false, null); //$NON-NLS-1$
    spoon.addMenuLast();
  } catch (Throwable e) {
    throw new RuntimeException(e);
  }    return true;
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:77,代码来源:AnalyzerVisualization.java

示例8: open

import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
public boolean open(Node transNode, String fname, boolean importfile) {
  try {
    
    if(ClassicEngineBoot.getInstance().isBootDone() == false){

      ObjectUtilities.setClassLoader(getClass().getClassLoader());
      ObjectUtilities.setClassLoaderSource(ObjectUtilities.CLASS_CONTEXT);
      
      LibLoaderBoot.getInstance().start();
      LibFontBoot.getInstance().start();
      ClassicEngineBoot.getInstance().start();
    }      
    
    ResourceManager theResourceManager = new ResourceManager();
    theResourceManager.registerDefaults();
    File theReportFile = new File(fname);
    Resource theResource = theResourceManager.createDirectly(theReportFile, MasterReport.class);
    MasterReport masterReport = (MasterReport) theResource.getResource();
    
    
    XulTabAndPanel tabAndPanel = AgileBiVisualizationPerspective.getInstance().createTab();
    AgileBiVisualizationPerspective.getInstance().setNameForTab(tabAndPanel.tab, getPathAndFilename(fname)[1].replace(".prpt", "")); //$NON-NLS-1$ //$NON-NLS-2$

    SpoonPerspectiveManager.getInstance().activatePerspective(AgileBiVisualizationPerspective.class);
    SwtXulLoader theXulLoader = new SwtXulLoader();
    theXulLoader.registerClassLoader(getClass().getClassLoader());
    theXulLoader.register("PRPT", "org.pentaho.agilebi.spoon.visualizations.xul.PrptViewerTag"); //$NON-NLS-1$ //$NON-NLS-2$
    XulDomContainer theXulContainer = theXulLoader.loadXul("org/pentaho/agilebi/spoon/visualizations/prpt/prptVisualization.xul", new PDIMessages(IVisualization.class)); //$NON-NLS-1$
    
    PRPTMeta meta = new PRPTMeta();
    meta.setTab(tabAndPanel.tab);
    AgileBiVisualizationPerspective.getInstance().setMetaForTab(tabAndPanel.tab, meta);
    
    PRPTVisualizationController controller = new PRPTVisualizationController(meta, masterReport);
    controller.setFileName(fname);
    controller.setDirty(false);
    PmdDataFactory theDataFactory = (PmdDataFactory) masterReport.getDataFactory();
    String theXmiFile = theDataFactory.getXmiFile();
    
    ModelerWorkspace model = new ModelerWorkspace(new SpoonModelerWorkspaceHelper(), SpoonModelerWorkspaceHelper.initGeoContext());
    XmiParser parser = new XmiParser();
    FileInputStream inputStream = new FileInputStream(new File(theXmiFile));
    Domain domain = parser.parseXmi(inputStream);
    inputStream.close();

    LogicalModel logical = domain.getLogicalModels().get(0);
    Object property = logical.getProperty("source_type"); //$NON-NLS-1$
    if( property != null ) {
      IModelerSource theSource = ModelerSourceFactory.generateSource(property.toString());
      theSource.initialize(domain);   
      model.setModelSource(theSource);
    }

    model.setDomain(domain);
    model.setModelName(domain.getId());
    model.setFileName(theXmiFile); 
    model.setTemporary(false);
    controller.setModel(model);
    theXulContainer.addEventHandler(controller);
    
    Composite theMainBox = (Composite) theXulContainer.getDocumentRoot().getElementById("mainContainer").getManagedObject(); //$NON-NLS-1$
    SwtXulRunner theRunner = new SwtXulRunner();
    theRunner.addContainer(theXulContainer);
    theRunner.initialize();
    theMainBox.setParent((Composite) tabAndPanel.panel.getManagedObject());

    ((Composite) tabAndPanel.panel.getManagedObject()).layout(true);

    AgileBiVisualizationPerspective.getInstance().setSelectedMeta(meta);
    return true;
  } catch(Exception e){
    e.printStackTrace();
  }
  return false;
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:76,代码来源:PRPTVisualization.java

示例9: createVisualizationFromMasterReport

import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
public void createVisualizationFromMasterReport(MasterReport rpt, boolean tempModel){
  try{
    
    if(ClassicEngineBoot.getInstance().isBootDone() == false){
      LibLoaderBoot.getInstance().start();
      LibFontBoot.getInstance().start();
      ClassicEngineBoot.getInstance().start();
    }
    
    XulTabAndPanel tabAndPanel = AgileBiVisualizationPerspective.getInstance().createTab();      
    AgileBiVisualizationPerspective.getInstance().setNameForTab(tabAndPanel.tab, "Untitled Report"); //$NON-NLS-1$
   
    SpoonPerspectiveManager.getInstance().activatePerspective(AgileBiVisualizationPerspective.class);
    SwtXulLoader theXulLoader = new SwtXulLoader();
    theXulLoader.registerClassLoader(getClass().getClassLoader());
    theXulLoader.register("PRPT", "org.pentaho.agilebi.spoon.visualizations.xul.PrptViewerTag"); //$NON-NLS-1$ //$NON-NLS-2$
    XulDomContainer theXulContainer = theXulLoader.loadXul("org/pentaho/agilebi/spoon/visualizations/prpt/prptVisualization.xul", new PDIMessages(IVisualization.class)); //$NON-NLS-1$
    Composite theMainBox = (Composite) theXulContainer.getDocumentRoot().getElementById("mainContainer").getManagedObject(); //$NON-NLS-1$
    
    PRPTMeta meta = new PRPTMeta();
    AgileBiVisualizationPerspective.getInstance().setMetaForTab(tabAndPanel.tab, meta);
    meta.setTab(tabAndPanel.tab);
    
    PRPTVisualizationController controller = new PRPTVisualizationController(meta, rpt);  
    
    PmdDataFactory theDataFactory = (PmdDataFactory) rpt.getDataFactory();
    String theXmiFile = theDataFactory.getXmiFile();
    
    XmiParser parser = new XmiParser();
    FileInputStream inputStream = new FileInputStream(new File(theXmiFile));
    Domain domain = parser.parseXmi(inputStream);
    inputStream.close();      
    
    ModelerWorkspace model = new ModelerWorkspace(new SpoonModelerWorkspaceHelper(), SpoonModelerWorkspaceHelper.initGeoContext());
    LogicalModel logical = domain.getLogicalModels().get(0);
    Object property = logical.getProperty("source_type"); //$NON-NLS-1$
    if( property != null ) {
      IModelerSource theSource = ModelerSourceFactory.generateSource(property.toString());
      theSource.initialize(domain);   
      model.setModelSource(theSource);
    }
    
    model.setDomain(domain);
    model.setModelName(domain.getLogicalModels().get(0).getName(LocalizedString.DEFAULT_LOCALE));
    model.setFileName(theXmiFile); 
    model.setTemporary(tempModel);
    controller.setModel(model);
    theXulContainer.addEventHandler(controller);
    
    SwtXulRunner theRunner = new SwtXulRunner();
    theRunner.addContainer(theXulContainer);
    theRunner.initialize();
    theMainBox.setParent((Composite) tabAndPanel.panel.getManagedObject());
    
    ((Composite) tabAndPanel.panel.getManagedObject()).layout(true);
    AgileBiVisualizationPerspective.getInstance().setSelectedMeta(meta);
    Spoon.getInstance().enableMenus();
    
  } catch(Exception e){
    logger.error("Error creating visualization", e);
  }
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:63,代码来源:PRPTVisualization.java


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