public static final String proposeSqlBasedCategoryId( String locale, LogicalTable table, Category category ) { String baseID = ( table != null ) ? Util.toId( (String) table.getProperty( SqlPhysicalTable.TARGET_TABLE ) ) : ""; //$NON-NLS-1$ String namePart = ( ( category != null ) && ( category.getName( locale ) != null ) ) ? "_" + Util.toId( category.getName( locale ) ) : ""; //$NON-NLS-1$ //$NON-NLS-2$ String id = Util.getCategoryIdPrefix() + baseID + namePart; return id.toUpperCase(); }
public static WAQRTransport createFromMetadata( Domain domain ) { // this assumes a single logical model with a single logical category LogicalModel model = domain.getLogicalModels().get( 0 ); Iterator<String> iter = model.getName().getLocales().iterator(); String locale = iter.next(); Category category = model.getCategories().get( 0 ); String domainId = domain.getId(); String modelId = model.getId(); String modelName = model.getName() != null ? model.getName().getString( locale ) : null; String categoryId = category.getId(); String categoryName = category.getName() != null ? category.getName().getString( locale ) : null; String schemaName = model.getName( locale ); return createDomain( domainId, modelId, modelName, categoryId, categoryName, schemaName ); }
/** * Creates a lightweight, serializable category objects from a logical model category * * @param m * @param c * @return */ private Category createCategory( LogicalModel m, org.pentaho.metadata.model.Category c ) { // create a thin category object Category cat = new Category(); cat.setName( c.getName( getLocale() ) ); cat.setId( c.getId() ); List<Column> columns = new ArrayList<Column>(); for ( LogicalColumn col : c.getLogicalColumns() ) { columns.add( createColumn( m, col, c ) ); } cat.setColumns( columns.toArray( new Column[ columns.size() ] ) ); return cat; }
for ( Category cat : lModel.getCategories() ) { String catName = BaseModelerWorkspaceHelper.getCleanCategoryName( cat.getName( workspaceHelper.getLocale() ), this, i++ ); CategoryMetaData catMeta = new CategoryMetaData( catName ); for ( LogicalColumn col : cat.getLogicalColumns() ) {