Package org.pentaho.metadata.model

Examples of org.pentaho.metadata.model.LogicalModel


    column2.setName( new LocalizedString( "en_US", "Sales Rep" ) );
    column2.setDescription( new LocalizedString( "en_US", "Sales Rep Employee Number" ) );
    column2.setDataType( DataType.NUMERIC );
    table.getPhysicalColumns().add( column2 );

    LogicalModel logicalModel = new LogicalModel();
    logicalModel.setPhysicalModel( model );
    logicalModel.setId( "MODEL" );
    logicalModel.setName( new LocalizedString( "en_US", "My Model" ) );
    logicalModel.setDescription( new LocalizedString( "en_US", "A Description of the Model" ) );

    LogicalTable logicalTable = new LogicalTable();
    logicalTable.setId( "LT" );
    logicalTable.setPhysicalTable( table );

    logicalModel.getLogicalTables().add( logicalTable );

    LogicalColumn logicalColumn = new LogicalColumn();
    logicalColumn.setId( "LC_CUSTOMERNAME" );
    logicalColumn.setPhysicalColumn( column );
    logicalColumn.setLogicalTable( logicalTable );
    logicalTable.addLogicalColumn( logicalColumn );

    LogicalColumn logicalColumn2 = new LogicalColumn();
    logicalColumn2.setId( "LC_SALESREP" );
    logicalColumn2.setPhysicalColumn( column2 );
    logicalColumn2.setLogicalTable( logicalTable );
    logicalTable.addLogicalColumn( logicalColumn2 );

    Category mainCategory = new Category();
    mainCategory.setId( "CATEGORY" );
    mainCategory.setName( new LocalizedString( "en_US", "Category" ) );
    mainCategory.addLogicalColumn( logicalColumn );
    mainCategory.addLogicalColumn( logicalColumn2 );

    logicalModel.getCategories().add( mainCategory );

    Domain domain = new Domain();
    domain.setId( "DOMAIN" );
    domain.addPhysicalModel( model );
    domain.addLogicalModel( logicalModel );
View Full Code Here


    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;
    }
    modelNode.addElement( "domain_id" ).setText( domainName ); //$NON-NLS-1$
    if ( model.getId() != null ) {
      modelNode.addElement( "model_id" ).setText( model.getId() ); //$NON-NLS-1$
    }
    if ( model.getName( locale ) != null ) {
      modelNode.addElement( "model_name" ).setText( model.getName( locale ) ); //$NON-NLS-1$
    }
    if ( model.getDescription( locale ) != null ) {
      modelNode.addElement( "model_description" ).setText( model.getDescription( locale ) ); //$NON-NLS-1$
    }

    Element tableNode;

    for ( Category category : model.getCategories() ) {
      tableNode = modelNode.addElement( "view" ); //$NON-NLS-1$
      if ( category.getId() != null ) {
        tableNode.addElement( "view_id" ).setText( category.getId() ); //$NON-NLS-1$
      }
      if ( category.getName( locale ) != null ) {
View Full Code Here

      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;
    }

    LogicalColumn column = model.findLogicalColumn( columnId );
    if ( column == null ) {
      root.addElement( "message" ).setText( Messages.getInstance().getString( "PMDUIComponent.USER_COLUMN_NOT_FOUND" ) ); //$NON-NLS-1$ //$NON-NLS-2$
      return doc;
    }

    // Temporary hack to get the BusinessCategory. When fixed properly, you should be able to interrogate the
    // business column thingie for it's containing BusinessCategory.
    Category view = null;
    for ( Category category : model.getCategories() ) {
      for ( LogicalColumn col : category.getLogicalColumns() ) {
        if ( col.getId().equals( column.getId() ) ) {
          view = category;
          break;
        }
View Full Code Here

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

    Domain domain = getTestDomain( ID1 );
    LogicalModel model = new LogicalModel();
    model.setId( "test" ); //$NON-NLS-1$
    domain.addLogicalModel( model );

    repo.storeDomain( domain, false );
    repo.storeDomain( getTestDomain( ID2 ), false );
View Full Code Here

      boolean changed = false;
      if ( domain.getLogicalModels().size() > 1 ) {
        Iterator<LogicalModel> iterator = domain.getLogicalModels().iterator();
        while ( iterator.hasNext() ) {
          LogicalModel logicalModel = iterator.next();
          Object property = logicalModel.getProperty( DSW_SOURCE_PROPERTY ); //$NON-NLS-1$
          if ( property != null ) {
            // This metadata file came from a DataSourceWizard, it may have embedded mondrian schema
            // that would incorrectly inform the system that there is mondrian schema attached. By
            // definition we only want to import the metadata portion.
            if ( logicalModel.getProperty( logicalModel.PROPERTY_OLAP_DIMS ) != null ) {
              // This logical model is an Olap model that needs to be removed from metadata
              iterator.remove();
            } else {
              // Remove properties that make this a DSW
              logicalModel.removeChildProperty( DSW_SOURCE_PROPERTY );
              logicalModel.removeChildProperty( "AGILE_BI_VERSION" );
            }
            changed = true;
          }
        }
        if ( changed ) {
View Full Code Here

    final Domain domain = getDomain( domainId );
    if ( null != domain ) {
      boolean found = false;
      final Iterator<LogicalModel> iter = domain.getLogicalModels().iterator();
      while ( iter.hasNext() ) {
        LogicalModel model = iter.next();
        if ( modelId.equals( model.getId() ) ) {
          iter.remove();
          found = true;
          break;
        }
      }
View Full Code Here

TOP

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

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.