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


Java LocalizedString类代码示例

本文整理汇总了Java中org.pentaho.metadata.model.concept.types.LocalizedString的典型用法代码示例。如果您正苦于以下问题:Java LocalizedString类的具体用法?Java LocalizedString怎么用?Java LocalizedString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LocalizedString类属于org.pentaho.metadata.model.concept.types包,在下文中一共展示了LocalizedString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: copyTable

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
protected boolean copyTable(Shell shell, LogicalModel logicalModel, String tableName) {
  
  LogicalTable originalTable = findLogicalTable(tableName);
  if (originalTable!=null) {
    // Copy
    //
    LogicalTable logicalTable = new LogicalTable();
    logicalTable.setId(UUID.randomUUID().toString());
    logicalTable.setName(new LocalizedString(locale, ConceptUtil.getName(originalTable, locale)+" (Copy)"));
    logicalTable.setDescription(new LocalizedString(locale, ConceptUtil.getDescription(originalTable, locale)+" (Copy)"));
    logicalTable.setProperty(DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME, originalTable.getProperty(DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME));
    logicalTable.setProperty(DefaultPropertyID.TABLE_TYPE.getId(), originalTable.getProperty(DefaultPropertyID.TABLE_TYPE.getId()));
    for (LogicalColumn column : originalTable.getLogicalColumns()) {
      logicalTable.getLogicalColumns().add((LogicalColumn) column.clone());
    }
    
    DimensionTableDialog dialog = new DimensionTableDialog(shell, logicalTable, locale);
    if (dialog.open()!=null) {
      logicalModel.addLogicalTable(logicalTable);
      return true;
    }
  }
  return false;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:25,代码来源:StarModelDialog.java

示例2: processFactTableName

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
private String processFactTableName() {
  String theName = null;
  String xmiFileLocation = getXmiFileLocation();
  if(xmiFileLocation == null){
    return BaseMessages.getString(IVisualization.class,"unavailable");
  }
  Domain theDomain = ModelerHelper.getInstance().loadDomain(xmiFileLocation);
  List<IPhysicalModel> theModels = theDomain.getPhysicalModels();
  if (theModels != null && theModels.size() > 0) {
    IPhysicalModel theModel = theModels.get(0);
    List<? extends IPhysicalTable> theTables = theModel.getPhysicalTables();
    if (theTables != null && theTables.size() > 0) {
      IPhysicalTable theTable = theTables.get(0);
      theName = theTable.getName(LocalizedString.DEFAULT_LOCALE);
    }
  }
  return theName;
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:19,代码来源:PRPTVisualizationController.java

示例3: exportLocalizedPropertiesRecursively

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
protected void exportLocalizedPropertiesRecursively( Properties props, IConcept parent, String locale ) {
  for ( String propName : parent.getChildProperties().keySet() ) {
    if ( parent.getChildProperty( propName ) instanceof LocalizedString ) {
      // externalize string
      String key = stringizeTokens( parent.getUniqueId() ) + ".[" + escapeKey( propName ) + "]";
      LocalizedString lstr = (LocalizedString) parent.getChildProperty( propName );
      String value = lstr.getLocalizedString( locale );
      if ( value == null ) {
        value = "";
      }
      props.setProperty( key, value );
    }
  }
  if ( parent.getChildren() != null ) {
    for ( IConcept child : parent.getChildren() ) {
      exportLocalizedPropertiesRecursively( props, child, locale );
    }
  } else {
    if ( logger.isDebugEnabled() ) {
      logger.debug( "concept " + stringizeTokens( parent.getUniqueId() ) + " does not have children" );
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:24,代码来源:LocalizationUtil.java

示例4: copyTable

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
protected boolean copyTable(Shell shell, LogicalModel logicalModel, String tableName) {

    LogicalTable originalTable = findLogicalTable(tableName);
    if (originalTable!=null) {
      // Copy
      //
      LogicalTable logicalTable = new LogicalTable();
      logicalTable.setId(UUID.randomUUID().toString());
      logicalTable.setName(new LocalizedString(locale, ConceptUtil.getName(originalTable, locale)+" (Copy)"));
      logicalTable.setDescription(new LocalizedString(locale, ConceptUtil.getDescription(originalTable, locale)+" (Copy)"));
      logicalTable.setProperty(DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME, originalTable.getProperty(DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME));
      logicalTable.setProperty(DefaultPropertyID.TABLE_TYPE.getId(), originalTable.getProperty(DefaultPropertyID.TABLE_TYPE.getId()));
      for (LogicalColumn column : originalTable.getLogicalColumns()) {
        logicalTable.getLogicalColumns().add((LogicalColumn) column.clone());
      }

      DimensionTableDialog dialog = new DimensionTableDialog(shell, logicalTable, locale);
      if (dialog.open()!=null) {
        logicalModel.addLogicalTable(logicalTable);
        return true;
      }
    }
    return false;
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:25,代码来源:StarModelDialog.java

示例5: extractId

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
private String extractId(Concept item) {
  LocalizedString localizedName = item.getName();
  Set<String> locales = localizedName.getLocales();
  if (locales.isEmpty()) return "";
  // Just grab the first locale we come across
  // This should normally only one for the star modeler
  //
  String locale = locales.iterator().next(); 
  
  String id = localizedName.getLocalizedString(locale);
  id = id.toUpperCase().replace(" ", "_");
  
  return id;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:15,代码来源:MetadataGenerator.java

示例6: addDimensionKeys

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
protected void addDimensionKeys() {
  // Import the technical keys from all the dimensions in the fact table...
  //
  List<LogicalColumn> keyColumns = new ArrayList<LogicalColumn>();
  List<LogicalTable> dimensionTables = ConceptUtil.findLogicalTables(logicalModel, TableType.DIMENSION);
  for (LogicalTable dimensionTable : dimensionTables) {
    // Find the technical or smart key
    //
    keyColumns.addAll( ConceptUtil.findLogicalColumns(dimensionTable, AttributeType.SMART_TECHNICAL_KEY) );
    keyColumns.addAll( ConceptUtil.findLogicalColumns(dimensionTable, AttributeType.TECHNICAL_KEY) );
  }

  for (LogicalColumn keyColumn : keyColumns) {
    LogicalColumn column = new LogicalColumn();
    String dimensionName = ConceptUtil.getName(keyColumn.getLogicalTable(), locale);
    
    column.setName(new LocalizedString(locale, dimensionName+" TK"));
    column.setDescription(new LocalizedString(locale, ConceptUtil.getDescription(keyColumn, locale)));
    column.setProperty(DefaultIDs.LOGICAL_COLUMN_PHYSICAL_COLUMN_NAME, dimensionName.toLowerCase().replace(' ', '_')+"_tk");
    column.setProperty(DefaultIDs.LOGICAL_COLUMN_ATTRIBUTE_TYPE, AttributeType.TECHNICAL_KEY.name());
    column.setDataType(keyColumn.getDataType());
    column.setProperty(DefaultIDs.LOGICAL_COLUMN_DIMENSION_NAME, dimensionName);
    column.setProperty(DefaultIDs.LOGICAL_COLUMN_LENGTH, ConceptUtil.getString(keyColumn, DefaultIDs.LOGICAL_COLUMN_LENGTH));
    column.setProperty(DefaultIDs.LOGICAL_COLUMN_LENGTH, ConceptUtil.getString(keyColumn, DefaultIDs.LOGICAL_COLUMN_LENGTH));
    column.setProperty(DefaultIDs.LOGICAL_COLUMN_CONVERSION_REMARKS, "Key to dimension '"+dimensionName+"'");
    addLogicalColumnToFactAttributesList(column);
  }
  
  wFactAttributes.removeEmptyRows();
  wFactAttributes.setRowNums();
  wFactAttributes.optWidth(true);
  
  getRelationshipsFromFact();
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:35,代码来源:StarModelDialog.java

示例7: newTable

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
protected boolean newTable(Shell shell, LogicalModel logicalModel) {
  LogicalTable logicalTable = new LogicalTable(logicalModel, null);
  logicalTable.setId(UUID.randomUUID().toString());
  logicalTable.setName(new LocalizedString(locale, "New table"));
  logicalTable.setDescription(new LocalizedString(locale, "New table description"));
  
  DimensionTableDialog dialog = new DimensionTableDialog(shell, logicalTable, locale);
  if (dialog.open()!=null) {
    logicalModel.addLogicalTable(logicalTable);
    return true;
  }
  return false;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:14,代码来源:StarModelDialog.java

示例8: ok

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
private void ok() {
  
  if (Const.isEmpty(wModelName.getText())) {
    MessageBox box = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
    box.setText(BaseMessages.getString(PKG, "StarModelDialog.ErrorModelHasNoName.Title"));
    box.setMessage(BaseMessages.getString(PKG, "StarModelDialog.ErrorModelHasNoName.Message"));
    box.open();
    return;
  }

  logicalModel.setName(new LocalizedString(locale, wModelName.getText()));
  logicalModel.setDescription(new LocalizedString(locale, wModelDescription.getText()));

  factTable.setName(new LocalizedString(locale, wFactTableName.getText()));
  factTable.setDescription(new LocalizedString(locale, wFactTableDescription.getText()));
  factTable.setProperty(DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME, wPhysicalFactName.getText());

  String factName = ConceptUtil.getName(factTable, locale);
  System.out.println("Fact name = "+factName+" has "+factTable.getLogicalColumns().size()+" columns");

  // Add the relationships informational
  //
  getRelationshipsFromFact();
  logicalModel.getLogicalRelationships().clear();
  logicalModel.getLogicalRelationships().addAll(logicalRelationships);
  
  // System.out.println("Fact name = "+factName+" has "+factTable.getLogicalColumns().size()+" columns");

  // If the fact table is not yet in the table list, add it.
  // If it is, replace it.
  //
  int factIndex = ConceptUtil.indexOfFactTable(logicalModel);
  if (factIndex<0) {
    logicalModel.getLogicalTables().add(factTable);
  }

  System.out.println("Fact name = "+factName+" has "+factTable.getLogicalColumns().size()+" columns");

  dispose();
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:41,代码来源:StarModelDialog.java

示例9: getFactColumns

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
private void getFactColumns() {
  factTable.getLogicalColumns().clear();
  int nr = wFactAttributes.nrNonEmpty();
  for (int i=0;i<nr;i++) {
    TableItem item = wFactAttributes.getNonEmpty(i);
    LogicalColumn logicalColumn = new LogicalColumn();
    
    int col=1;
    logicalColumn.setId(UUID.randomUUID().toString());
    logicalColumn.setName(new LocalizedString(locale, item.getText(col++)));
    logicalColumn.setDescription(new LocalizedString(locale, item.getText(col++)));
    String fieldTypeString = item.getText(col++);
    logicalColumn.setProperty(DefaultIDs.LOGICAL_COLUMN_ATTRIBUTE_TYPE, AttributeType.getAttributeType(fieldTypeString).name());
    logicalColumn.setProperty(DefaultIDs.LOGICAL_COLUMN_PHYSICAL_COLUMN_NAME, item.getText(col++));
    logicalColumn.setDataType(ConceptUtil.getDataType(item.getText(col++)));
    logicalColumn.setProperty(DefaultIDs.LOGICAL_COLUMN_DIMENSION_NAME, item.getText(col++));
    logicalColumn.setProperty(DefaultIDs.LOGICAL_COLUMN_LENGTH, item.getText(col++));
    logicalColumn.setProperty(DefaultIDs.LOGICAL_COLUMN_PRECISION, item.getText(col++));
    logicalColumn.setProperty(DefaultIDs.LOGICAL_COLUMN_SOURCE_DB, item.getText(col++));
    logicalColumn.setProperty(DefaultIDs.LOGICAL_COLUMN_SOURCE_TABLE, item.getText(col++));
    logicalColumn.setProperty(DefaultIDs.LOGICAL_COLUMN_SOURCE_COLUMN, item.getText(col++));
    logicalColumn.setProperty(DefaultIDs.LOGICAL_COLUMN_CONVERSION_REMARKS, item.getText(col++));
    
    logicalColumn.setLogicalTable(factTable);
    factTable.getLogicalColumns().add(logicalColumn);
  }
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:28,代码来源:StarModelDialog.java

示例10: createEmptyModel

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
public void createEmptyModel() {
  try {
    StarDomain starDomain = new StarDomain();
    
    starDomain.getDomain().setName(new LocalizedString(defaultLocale, "Star Model"));
    StarModelerPerspective.getInstance().createTabForModel(starDomain, MODELER_NAME);
    SpoonPerspectiveManager.getInstance().activatePerspective(StarModelerPerspective.class);
  } catch (Exception e) {
    new ErrorDialog(((Spoon) SpoonFactory.getInstance()).getShell(), "Error", "Error creating visualization", e);
  }
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:12,代码来源:ModelerHelper.java

示例11: addAttribute

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
private void addAttribute(String name, String description, String phName, AttributeType attributeType, DataType dataType, int length, int precision, String comment) {
  LogicalColumn column = new LogicalColumn();
  column.setLogicalTable(logicalTable);
  column.setName(new LocalizedString(locale, name));
  column.setDescription(new LocalizedString(locale, description));
  column.setDataType(dataType);
  column.setProperty(DefaultIDs.LOGICAL_COLUMN_ATTRIBUTE_TYPE, attributeType.name());
  column.setProperty(DefaultIDs.LOGICAL_COLUMN_PHYSICAL_COLUMN_NAME, phName);
  if (length>=0) column.setProperty(DefaultIDs.LOGICAL_COLUMN_LENGTH, Integer.toString(length));
  if (precision>=0) column.setProperty(DefaultIDs.LOGICAL_COLUMN_PRECISION, Integer.toString(precision));
  column.setProperty(DefaultIDs.LOGICAL_COLUMN_CONVERSION_REMARKS, comment);
  
  addLogicalColumnToAttributesList(column);
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:15,代码来源:DimensionTableDialog.java

示例12: exportSchema

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
public void exportSchema() {
  try {
    if (this.model.isValid()) {
      this.model.getWorkspaceHelper().populateDomain(this.model);
      LogicalModel lModel = this.model.getLogicalModel(ModelerPerspective.ANALYSIS);

      FileDialog fileDialog = new FileDialog(Spoon.getInstance().getShell(), SWT.SAVE);
      String[] theExtensions = { "*.xml" };
      fileDialog.setFilterExtensions(theExtensions);
      String theFile = fileDialog.open();
      if(theFile != null) {
        MondrianModelExporter exporter = new MondrianModelExporter(lModel, LocalizedString.DEFAULT_LOCALE);
        String mondrianSchema = exporter.createMondrianModelXML();
        logger.info(mondrianSchema);

        org.dom4j.Document schemaDoc = DocumentHelper.parseText(mondrianSchema);
        byte schemaBytes[] = schemaDoc.asXML().getBytes();

        File modelFile = new File(theFile);
        OutputStream out = new FileOutputStream(modelFile);
        out.write(schemaBytes);
        out.flush();
        out.close();
      }
    } else {
      StringBuffer validationErrors = new StringBuffer();
      for (String msg : this.model.getValidationMessages()) {
        validationErrors.append(msg);
        validationErrors.append("\n");
        logger.info(msg);
      }
      MessageDialog.openError(Spoon.getInstance().getShell(), "", validationErrors.toString());
    }
  } catch (Exception e) {
    logger.error("Error exporting Schema", e);
    MessageDialog.openError(Spoon.getInstance().getShell(), "", e.getMessage());
  }
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:39,代码来源:AgileBiModelerPerspective.java

示例13: exportSchema

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
public void exportSchema() {
  try {
    ModelerWorkspace model = this.meta.getController().getModel();
    if (model.isValid()) {
      model.getWorkspaceHelper().populateDomain(model);
      LogicalModel lModel = model.getLogicalModel(ModelerPerspective.ANALYSIS);

      FileDialog fileDialog = new FileDialog(Spoon.getInstance().getShell(), SWT.SAVE);
      String[] theExtensions = { "*.xml" };
      fileDialog.setFilterExtensions(theExtensions);
      String theFile = fileDialog.open();
      if(theFile != null) {
        MondrianModelExporter exporter = new MondrianModelExporter(lModel, LocalizedString.DEFAULT_LOCALE);
        String mondrianSchema = exporter.createMondrianModelXML();
        logger.info(mondrianSchema);

        org.dom4j.Document schemaDoc = DocumentHelper.parseText(mondrianSchema);
        byte schemaBytes[] = schemaDoc.asXML().getBytes();

        File modelFile = new File(theFile);
        OutputStream out = new FileOutputStream(modelFile);
        out.write(schemaBytes);
        out.flush();
        out.close();
      }
    } else {
      StringBuffer validationErrors = new StringBuffer();
      for (String msg : model.getValidationMessages()) {
        validationErrors.append(msg);
        validationErrors.append("\n");
        logger.info(msg);
      }
      MessageDialog.openError(Spoon.getInstance().getShell(), "", validationErrors.toString());
    }
  } catch (Exception e) {
    logger.error("Error exporting schema", e);
    MessageDialog.openError(Spoon.getInstance().getShell(), "", e.getMessage());
  }
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:40,代码来源:AgileBiModelerPerspectiveController.java

示例14: processFactTableName

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
private String processFactTableName() {
	String theName = null;
	Domain theDomain = ModelerHelper.getInstance().loadDomain(this.xmiFileLocation);
	List<IPhysicalModel> theModels = theDomain.getPhysicalModels();
	if (theModels != null && theModels.size() > 0) {
		IPhysicalModel theModel = theModels.get(0);
		List theTables = theModel.getPhysicalTables();
		if (theTables != null && theTables.size() > 0) {
			IPhysicalTable theTable = (IPhysicalTable) theTables.get(0);
			theName = theTable.getName(LocalizedString.DEFAULT_LOCALE);
		}
	}
	return theName;
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:15,代码来源:AnalyzerVisualizationController.java

示例15: createBusinessTable

import org.pentaho.metadata.model.concept.types.LocalizedString; //导入依赖的package包/类
private LogicalTable createBusinessTable( SqlPhysicalTable physicalTable, String locale ) {

    // Create a business table with a new ID and localized name
    //
    LogicalTable businessTable = new LogicalTable( null, physicalTable );

    // Try to set the name of the business table to something nice (beautify)
    //
    String tableName = PhysicalTableImporter.beautifyName( physicalTable.getTargetTable() );
    businessTable.setName( new LocalizedString( locale, tableName ) );

    businessTable.setId( Util.proposeSqlBasedLogicalTableId( locale, businessTable, physicalTable ) );

    // Add columns to this by copying the physical columns to the business
    // columns...
    //
    for ( IPhysicalColumn physicalColumn : physicalTable.getPhysicalColumns() ) {

      LogicalColumn businessColumn = new LogicalColumn();
      businessColumn.setPhysicalColumn( physicalColumn );
      businessColumn.setLogicalTable( businessTable );

      // We're done, add the business column.
      //
      // Propose a new ID
      businessColumn.setId( Util.proposeSqlBasedLogicalColumnId( locale, businessTable,
          (SqlPhysicalColumn) physicalColumn ) );
      businessTable.addLogicalColumn( businessColumn );
    }

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


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