public boolean supportsOlap( Domain d ) { if ( d.getLogicalModels().size() < 2 ) { return false; } else { LogicalModel lModel = d.getLogicalModels().get( 1 ); return "true".equals( lModel.getProperty( "DUAL_MODELING_SCHEMA" ) ) || lModel.getProperty( "MondrianCatalogRef" ) != null; } }
@Override public void serializeIntoDomain( Domain d ) { LogicalModel lm = d.getLogicalModels().get( 0 ); lm.setProperty( "source_type", SOURCE_TYPE ); }
public void serializeIntoDomain( Domain d ) { LogicalModel lm = d.getLogicalModels().get( 0 ); lm.setProperty( "source_type", SOURCE_TYPE ); //$NON-NLS-1$ }
public LogicalModel getLogicalModel( ModelerPerspective type ) { switch ( type ) { case ANALYSIS: if ( this.getDomain().getLogicalModels().size() == 1 ) { // we don't have an ANALYSIS model to return return null; } else { return this.getDomain().getLogicalModels().get( 1 ); } default: return this.getDomain().getLogicalModels().get( 0 ); } }
public void serializeIntoDomain( Domain d ) { LogicalModel lm = d.getLogicalModels().get( 0 ); lm.setProperty( "source_type", SOURCE_TYPE ); }
protected boolean isContainsModel( Domain domain ) throws Exception { return !DatasourceService.isMetadataDatasource( domain ) && domain.getLogicalModels().size() > 1; }
/** * find a logical model via a model id * * @param modelId * the id to find * * @return logical model */ public LogicalModel findLogicalModel( String modelId ) { for ( LogicalModel model : getLogicalModels() ) { if ( modelId.equals( model.getId() ) ) { return model; } } return null; }
public void onDialogAccept( final Domain domain ) { refreshDatasources( domain.getId(), domain.getLogicalModels().get( 0 ).getId() ); }
@Override public void restoreSavedDatasource( Domain previousDomain, final XulServiceCallback<Void> callback ) { String serializedDatasource = (String) previousDomain.getLogicalModels().get( 0 ).getProperty( "datasourceModel" ); datasourceService.deSerializeModelState( serializedDatasource, new XulServiceCallback<DatasourceDTO>() { public void success( DatasourceDTO datasourceDTO ) { DatasourceDTO.populateModel( datasourceDTO, datasourceModel ); datasourceModel.getGuiStateModel().setDirty( false ); wizardModel.setEditing( true ); callback.success( null ); } public void error( String s, Throwable throwable ) { MessageHandler.getInstance().showErrorDialog( MessageHandler.getString( "ERROR" ), MessageHandler.getString( "DatasourceEditor.ERROR_0002_UNABLE_TO_SHOW_DIALOG", throwable.getLocalizedMessage() ) ); callback.error( s, throwable ); } } ); }
private LogicalTable findOlapCloneForTableInDomain( LogicalTable supposedLTable, Domain domain ) { if ( supposedLTable.getId().endsWith( BaseModelerWorkspaceHelper.OLAP_SUFFIX ) ) { return supposedLTable; } for ( LogicalTable table : domain.getLogicalModels().get( 1 ).getLogicalTables() ) { if ( table.getId().equals( supposedLTable.getId() + BaseModelerWorkspaceHelper.OLAP_SUFFIX ) ) { return table; } } throw new IllegalStateException( "Unable to find a OLAP copy for table: " + supposedLTable.getId() ); }
public static boolean isMetadataDatasource( Domain domain ) { if ( domain == null ) { return false; } List<LogicalModel> logicalModelList = domain.getLogicalModels(); if ( logicalModelList != null && logicalModelList.size() >= 1 ) { for ( LogicalModel logicalModel : logicalModelList ) { // keep this check for backwards compatibility for now Object property = logicalModel.getProperty( "AGILE_BI_GENERATED_SCHEMA" ); //$NON-NLS-1$ if ( property != null ) { return false; } // moving forward any non metadata generated datasource should have this property property = logicalModel.getProperty( "WIZARD_GENERATED_SCHEMA" ); //$NON-NLS-1$ if ( property != null ) { return false; } } return true; } else { return true; } }
@Override public void restoreSavedDatasource( Domain previousDomain, final XulServiceCallback<Void> callback ) { String serializedDatasource = (String) previousDomain.getLogicalModels().get( 0 ).getProperty( "datasourceModel" ); datasourceService.deSerializeModelState( serializedDatasource, new XulServiceCallback<DatasourceDTO>() { public void success( DatasourceDTO datasourceDTO ) { DatasourceDTO.populateModel( datasourceDTO, datasourceModel ); datasourceModel.getGuiStateModel().setDirty( false ); // initialize connections if ( datasourceModel.getGuiStateModel().getConnections() == null || datasourceModel.getGuiStateModel().getConnections().size() <= 0 ) { queryStep.reloadConnections(); } wizardModel.setEditing( true ); callback.success( null ); } public void error( String s, Throwable throwable ) { MessageHandler.getInstance().showErrorDialog( MessageHandler.getString( "ERROR" ), MessageHandler.getString( "DatasourceEditor.ERROR_0002_UNABLE_TO_SHOW_DIALOG", throwable.getLocalizedMessage() ) ); callback.error( s, throwable ); } } ); }
@Override public void success( IDatasourceSummary iDatasourceSummary ) { iDatasourceSummary.getDomain().getLogicalModels().get( 0 ) .setProperty( "DatasourceType", activeDatasource.getId() ); for ( IWizardListener wizardListener : wizardListeners ) { wizardListener.onFinish( iDatasourceSummary ); } }
@Override public Object clone() { Domain clone = new Domain(); // shallow copies clone( clone ); clone.physicalModels = physicalModels; clone.concepts = concepts; // deep copies clone.setLogicalModels( new ArrayList<LogicalModel>() ); for ( LogicalModel model : getLogicalModels() ) { clone.addLogicalModel( (LogicalModel) model.clone() ); } return clone; } }
public void setDomain( Domain domain ) { this.domain = domain; if ( domain != null ) { guiStateModel.setLogicalModels( domain.getLogicalModels() ); guiStateModel.setLocaleCode( domain.getLocales().get( 0 ).getCode() ); } else { guiStateModel.setLogicalModels( null ); guiStateModel.setLocaleCode( null ); } }
/** * This is a utility method that looks into an old domain for the same column ids, and then copies over the old * metadata into the new. * * @param oldDomain * @param newDomain */ public void copyOverMetadata( Domain oldDomain, Domain newDomain ) { Category category = newDomain.getLogicalModels().get( 0 ).getCategories().get( 0 ); LogicalModel oldModel = oldDomain.getLogicalModels().get( 0 ); for ( LogicalColumn column : category.getLogicalColumns() ) { LogicalColumn oldColumn = oldModel.findLogicalColumn( column.getId() ); if ( oldColumn != null ) { column.setDataType( oldColumn.getDataType() ); column.setName( oldColumn.getName() ); column.setAggregationList( oldColumn.getAggregationList() ); column.setAggregationType( oldColumn.getAggregationType() ); } } }
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 ); }
@Bindable public void setDatasourceName( String datasourceName ) { String previousVal = this.datasourceName; this.datasourceName = datasourceName; // if we're editing a generated or already defined domain, // we need to keep the datasource name in sync if ( domain != null ) { domain.setId( datasourceName ); LogicalModel model = domain.getLogicalModels().get( 0 ); String localeCode = domain.getLocales().get( 0 ).getCode(); model.getName().setString( localeCode, datasourceName ); } this.getModelInfo().setStageTableName( generateTableName() ); this.firePropertyChange( "datasourceName", previousVal, datasourceName ); //$NON-NLS-1$ validate(); }
private void addFieldsToTables( Domain domain, AbstractModelList<JoinTableModel> availableTables ) { String locale = LocalizedString.DEFAULT_LOCALE; Outter: for ( JoinTableModel table : availableTables ) { for ( LogicalTable tbl : domain.getLogicalModels().get( 0 ).getLogicalTables() ) { if ( tbl.getPhysicalTable().getProperty( "target_table" ).equals( table.getName() ) ) { for ( LogicalColumn col : tbl.getLogicalColumns() ) { JoinFieldModel field = new JoinFieldModel(); field.setName( col.getName( locale ) ); field.setParentTable( table ); table.getFields().add( field ); } continue Outter; } } } }
public void success( Domain retVal ) { model.setDomain( retVal ); if ( model.getLogicalModel( modelerPerspective ) != null ) { controller.setModelerPerspective( modelerPerspective ); } else { controller.setModelerPerspective( ModelerPerspective.REPORTING ); } controller.resetPropertyForm(); // disable edit button if required model not present (imported dsw) XulComponent editIcon = container.getDocumentRoot().getElementById( EDIT_TOOLBAR_BUTTON_ID ); boolean disabled = model.getDomain().getLogicalModels().get( 0 ).getProperty( "datasourceModel" ) == null; editIcon.setDisabled( disabled ); enableWaitCursor( false ); showDialog(); }