Package org.pentaho.metadata.model

Examples of org.pentaho.metadata.model.Domain


      final InputStream stream = createStream(resourceManager, contextKey, xmiFile);
      try
      {
        final InMemoryMetadataDomainRepository repo = new InMemoryMetadataDomainRepository();
        final XmiParser parser = new XmiParser();
        final Domain domain = parser.parseXmi(stream);
        domain.setId(domainId);
        repo.storeDomain(domain, true);
        return repo;
      }
      finally
      {
View Full Code Here


    }
    try
    {
      final InMemoryMetadataDomainRepository repo = new InMemoryMetadataDomainRepository();
      final XmiParser parser = new XmiParser();
      final Domain domain = parser.parseXmi(stream);
      domain.setId(String.valueOf(o));
      repo.storeDomain(domain, true);
      return new SimpleResource(key, repo, IMetadataDomainRepository.class, version);
    }
    catch (ResourceCreationException e)
    {
View Full Code Here

        final InputStream stream = createStream(resourceManager, contextKey, xmiFile);
        try
        {
          final InMemoryMetadataDomainRepository repo = new InMemoryMetadataDomainRepository();
          final XmiParser parser = new XmiParser();
          final Domain domain = parser.parseXmi(stream);
          // add a couple of agg types to the quantity ordered physical column
          final IPhysicalTable table = ((SqlPhysicalModel) domain.getPhysicalModels().get(0)).getPhysicalTables().get(7);
          final IPhysicalColumn col = table.getPhysicalColumns().get(3);
          final List<AggregationType> list = new ArrayList<AggregationType>();
          list.add(AggregationType.SUM);
          list.add(AggregationType.AVERAGE);
          col.setAggregationList(list);
          domain.setId(domainId);
          repo.storeDomain(domain, true);
          return repo;
        }
        finally
        {
View Full Code Here

    // TODO: need to define the IDBDatasourceService.class
    microPlatform.define( IDBDatasourceService.class, JndiDatasourceService.class, Scope.GLOBAL );
    try {
      KettleEnvironment.init( false );
      IMetadataDomainRepository repo = PentahoSystem.get( IMetadataDomainRepository.class, null );
      Domain domain = getBasicDomain();
      Domain domain2 = getJdbcDomain();
      // System.out.println(new SerializationService().serializeDomain(domain));

      Domain domain3 = getJdbcDomain();
      domain3.setId( "JDBCDOMAIN2" );
      domain3.getLogicalModels().get( 0 ).setProperty( "max_rows", new BigDecimal( 10 ) );

      Domain domain4 = getBasicDomain();
      ( (SqlPhysicalModel) domain4.getPhysicalModels().get( 0 ) ).getDatasource().setDialectType( "MYSQL" );
      Map<String, String> attributes = new HashMap<String, String>();
      attributes.put( "QUOTE_ALL_FIELDS", "Y" );
      ( (SqlPhysicalModel) domain4.getPhysicalModels().get( 0 ) ).getDatasource().setAttributes( attributes );

      domain4.setId( "MYSQL_DOMAIN" );
      repo.storeDomain( domain, true );
      repo.storeDomain( domain2, true );
      repo.storeDomain( domain3, true );
      repo.storeDomain( domain4, true );
    } catch ( Exception e ) {
View Full Code Here

    }

  }

  public Domain getJdbcDomain() {
    Domain domain = getBasicDomain();
    SqlDataSource dataSource = ( (SqlPhysicalModel) domain.getPhysicalModels().get( 0 ) ).getDatasource();
    dataSource.setType( DataSourceType.NATIVE );
    dataSource.setDatabaseName( "file:test-src/solution/system/data/sampledata" );
    dataSource.setUsername( "pentaho_user" );
    dataSource.setPort( "-1" );
    dataSource.setPassword( "password" );
    domain.setId( "JDBCDOMAIN" );
    return domain;
  }
View Full Code Here

    mainCategory.addLogicalColumn( logicalColumn );
    mainCategory.addLogicalColumn( logicalColumn2 );

    logicalModel.getCategories().add( mainCategory );

    Domain domain = new Domain();
    domain.setId( "DOMAIN" );
    domain.addPhysicalModel( model );
    domain.addLogicalModel( logicalModel );

    return domain;
  }
View Full Code Here

  private void addThinDomainModels( final String domain, final Element modelsNode, final Element root ) {

    IMetadataDomainRepository repo = getMetadataRepository();

    Domain domainObject = repo.getDomain( domain );

    String locale = LocaleHelper.getClosestLocale( LocaleHelper.getLocale().toString(), domainObject.getLocaleCodes() );

    Element modelNode;
    for ( LogicalModel model : domainObject.getLogicalModels() ) {
      String vis = (String) model.getProperty( "visible" );
      if ( vis != null ) {
        String[] visibleContexts = vis.split( "," );
        boolean visibleToContext = false;
        for ( String context : visibleContexts ) {
View Full Code Here

    }

    Element modelNode = root.addElement( "model" ); //$NON-NLS-1$

    // because it's lighter weight, check the thin model
    Domain domain = getMetadataRepository().getDomain( domainName );
    if ( domain == null ) {
      root.addElement( "message" ).setText( Messages.getInstance().getString( "PMDUIComponent.USER_DOMAIN_LOADING_ERROR", domainName ) ); //$NON-NLS-1$ //$NON-NLS-2$
      return doc;
    }
    String locale = LocaleHelper.getClosestLocale( LocaleHelper.getLocale().toString(), domain.getLocaleCodes() );
    LogicalModel model = domain.findLogicalModel( modelId );

    if ( model == null ) {
      root.addElement( "message" ).setText( Messages.getInstance().getString( "PMDUIComponent.USER_MODEL_LOADING_ERROR", modelId ) ); //$NON-NLS-1$ //$NON-NLS-2$
      error( Messages.getInstance().getString( "PMDUIComponent.USER_MODEL_LOADING_ERROR", modelId ) ); //$NON-NLS-1$
      return doc;
View Full Code Here

      // we can't do this without a view
      root.addElement( "message" ).setText( Messages.getInstance().getString( "PMDUIComponent.USER_NO_COLUMN_SPECIFIED" ) ); //$NON-NLS-1$ //$NON-NLS-2$
      return doc;
    }

    Domain domain = getMetadataRepository().getDomain( domainName );
    String locale = LocaleHelper.getClosestLocale( LocaleHelper.getLocale().toString(), domain.getLocaleCodes() );
    LogicalModel model = domain.findLogicalModel( modelId ); // This is the business view that was selected.
    if ( model == null ) {
      root.addElement( "message" ).setText( Messages.getInstance().getString( "PMDUIComponent.USER_MODEL_LOADING_ERROR", modelId ) ); //$NON-NLS-1$ //$NON-NLS-2$
      return doc;
    }
View Full Code Here

    SessionCachingMetadataDomainRepository repo = new SessionCachingMetadataDomainRepository( mock );
    PentahoSessionHolder.setSession( new StandaloneSession( "Standalone Session", SESSION_ID ) ); //$NON-NLS-1$

    assertEquals( 0, mock.getInvocationCount( "getDomain" ) ); //$NON-NLS-1$
    Domain d = repo.getDomain( ID );
    assertEquals( ID, d.getId() );
    // Make sure the domain we got back has our session embedded in it (tests mock repository)
    assertEquals( SESSION_ID, d.getDescription( TEST_LOCALE ) );
    assertEquals( 1, mock.getInvocationCount( "getDomain" ) ); //$NON-NLS-1$
    // Cache should contain a domain for this session
    assertEquals( 1, PentahoSystem.getCacheManager( null ).getAllKeysFromRegionCache( CACHE_NAME ).size() );

    d = repo.getDomain( ID );
View Full Code Here

TOP

Related Classes of org.pentaho.metadata.model.Domain

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.