Package org.pentaho.metadata.model

Examples of org.pentaho.metadata.model.LogicalColumn


    final Query queryObject = parseQuery(queryName);
    List<Selection> selections = queryObject.getSelections();
    TypedMetaTableModel tableModel = new TypedMetaTableModel();
    for (final Selection selection : selections)
    {
      LogicalColumn logicalColumn = selection.getLogicalColumn();
      String id = logicalColumn.getId();
      DataType dataType = logicalColumn.getDataType();
      tableModel.addColumn(id, mapDataType(dataType));
    }
    return new PmdMetaTableModel(tableModel, selections);
  }
View Full Code Here


    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" ) );
View Full Code Here

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

    if ( view == null ) {
      root.addElement( "message" ).setText( Messages.getInstance().getString( "PMDUIComponent.USER_VIEW_NOT_FOUND" ) ); //$NON-NLS-1$ //$NON-NLS-2$
      return doc;
    }

    String mql =
        "<mql><domain_type>relational</domain_type><domain_id>" + domainName + "</domain_id><model_id>" + modelId + "</model_id>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    if ( column.getProperty( "lookup" ) == null ) { //$NON-NLS-1$
      mql += "<selection><view>" + view.getId() + "</view><column>" + column.getId() + "</column></selection>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      mql +=
          "<orders><order><direction>asc</direction><view_id>" + view.getId() + "</view_id><column_id>" + column.getId() + "</column_id></order></orders>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    } else {

      String lookup = (String) column.getProperty( "lookup" ); //$NON-NLS-1$
      // assume model and view are the same...
      StringTokenizer tokenizer1 = new StringTokenizer( lookup, ";" ); //$NON-NLS-1$
      while ( tokenizer1.hasMoreTokens() ) {
        StringTokenizer tokenizer2 = new StringTokenizer( tokenizer1.nextToken(), "." ); //$NON-NLS-1$
        if ( tokenizer2.countTokens() == 2 ) {
View Full Code Here

TOP

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

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.