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; } }
public void resolveConnectionFromDomain() { // set up the datasource if ( domain != null && source != null ) { domain.getPhysicalModels().get( 0 ); // TODO: resolve GWT DatabaseMeta databaseMeta = ThinModelConverter.convertToLegacy(physicalModel.getId(), // physicalModel.getDatasource()); // TODO: resolve GWT source.setDatabaseMeta(databaseMeta); } }
@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(); }
@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 onDialogAccept( final Domain domain ) { refreshDatasources( domain.getId(), domain.getLogicalModels().get( 0 ).getId() ); }
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 ); } }
LogicalModel lModel = domain.getLogicalModels().get( 0 ); String catName = lModel.getName( LocalizedString.DEFAULT_LOCALE ); lModel.setProperty( "MondrianCatalogRef", catName ); //$NON-NLS-1$ "Provider=mondrian;DataSource=\"" + ( (SqlPhysicalModel) domain.getPhysicalModels().get( 0 ) ) .getId() + "\""; //$NON-NLS-1$ String catDef = "solution:" + solutionStorage + RepositoryFile.SEPARATOR //$NON-NLS-1$
public Domain generateDomain( final ImportStrategy importStrategy ) throws PentahoMetadataException { Domain domain = new Domain(); domain.setId( modelName ); domain.setLocales( locales ); domain.addPhysicalModel( physicalModel ); LogicalModel logicalModel = new LogicalModel(); logicalModel.setId( bmID ); domain.addLogicalModel( logicalModel );
generator.setTableNames( tableNames ); domain = generator.generateDomain( importStrategy ); for ( IPhysicalModel physicalModel : domain.getPhysicalModels() ) { for ( IPhysicalTable physicalTable : physicalModel.getPhysicalTables() ) { physicalTable.setName( new LocalizedString( locale, datasourceName ) ); for ( LogicalModel logicalModel : domain.getLogicalModels() ) { for ( LogicalTable logicalTable : logicalModel.getLogicalTables() ) { logicalTable.setName( new LocalizedString( locale, datasourceName ) ); domain.setId( tableName ); // replaced with user specified name later LogicalModel businessModel = domain.getLogicalModels().get( 0 ); // schemaMeta.getActiveModel(); businessModel.setProperty( "AGILE_BI_GENERATED_SCHEMA", "TRUE" ); businessModel.setProperty( "DUAL_MODELING_SCHEMA", "" + dualModelingMode ); if ( dualModelingMode ) { olapModel = ModelerConversionUtil.duplicateModelForOlap( businessModel ); domain.addLogicalModel( olapModel );
for ( Concept concept : domain.getConcepts() ) { for ( String key : domain.getChildProperties().keySet() ) { if ( key.startsWith( "LEGACY_EVENT_" ) ) { //$NON-NLS-1$ eventModelElement.appendChild( createTaggedValue( doc, shortkey, (String) domain.getChildProperties().get( key ), idGen.getNextId() ) ); for ( LocaleType localeType : domain.getLocales() ) { Element cwmParameter = doc.createElement( "CWM:Parameter" ); //$NON-NLS-1$ if ( beforeDesc == null ) { for ( IPhysicalModel model : domain.getPhysicalModels() ) { if ( model.getId().equals( "__MISSING_PARENT_PHYSICAL_MODEL__" ) ) { //$NON-NLS-1$ continue; for ( IPhysicalModel model : domain.getPhysicalModels() ) { if ( model instanceof SqlPhysicalModel ) { SqlPhysicalModel sqlModel = (SqlPhysicalModel) model; for ( LogicalModel model : domain.getLogicalModels() ) { Element mdbSchema = doc.createElement( "CWMMDB:Schema" ); //$NON-NLS-1$ mdbSchema.setAttribute( "name", model.getId() ); //$NON-NLS-1$
@SuppressWarnings( "unchecked" ) public static Domain convertFromLegacy( SchemaMeta schemaMeta ) throws Exception { Domain domain = new Domain(); domain.setId( schemaMeta.getDomainName() ); List<LocaleType> localeTypes = new ArrayList<LocaleType>(); domain.setLocales( localeTypes ); domain.addPhysicalModel( sqlModel ); BusinessTable businessTable = (BusinessTable) biztable; LogicalTable logicalTable = new LogicalTable(); IPhysicalTable physicalTable = domain.findPhysicalTable( businessTable.getPhysicalTable().getId() ); if ( physicalTable != null && logicalModel.getPhysicalModel() == null ) { logicalModel.setPhysicalModel( physicalTable.getPhysicalModel() ); logical.setComplexJoin( rel.getComplexJoin() ); logical.setJoinOrderKey( rel.getJoinOrderKey() ); if ( domain.getLocales().size() > 0 ) { logical.setRelationshipDescription( rel.getDescription() ); domain.addLogicalModel( logicalModel );
SchemaMeta schemaMeta = new SchemaMeta(); schemaMeta.setDomainName( domain.getId() ); if ( domain.getLocales() != null ) { int order = 0; for ( LocaleType localeType : domain.getLocales() ) { boolean found = false; for ( String code : schemaMeta.getLocales().getLocaleCodes() ) { for ( IPhysicalModel physicalModel : domain.getPhysicalModels() ) { if ( physicalModel instanceof SqlPhysicalModel ) { SqlPhysicalModel sqlModel = (SqlPhysicalModel) physicalModel; for ( LogicalModel logicalModel : domain.getLogicalModels() ) { BusinessModel model = new BusinessModel(); model.setConnection( database );
Domain domain = new Domain(); Map<String, Concept> xmiConceptMap = new HashMap<String, Concept>(); getKeyValuePairs( event, "CWM:TaggedValue", "tag", "value" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ for ( String key : kvp.keySet() ) { domain.setProperty( "LEGACY_EVENT_" + key, kvp.get( key ) ); //$NON-NLS-1$ domain.addConcept( c ); for ( Concept concept : domain.getConcepts() ) { String parentName = (String) concept.getChildProperty( "__TMP_CONCEPT_PARENT_NAME" ); //$NON-NLS-1$ if ( parentName != null ) { concept.removeChildProperty( "__TMP_CONCEPT_PARENT_NAME" ); //$NON-NLS-1$ Concept conceptParent = domain.findConcept( parentName ); concept.setParentConcept( conceptParent ); conceptParent.addChild( concept ); domain.addPhysicalModel( sqlPhysicalModel ); SqlDataSource sqlDataSource = new SqlDataSource(); sqlPhysicalModel.setDatasource( sqlDataSource ); missingParentModel = new SqlPhysicalModel(); missingParentModel.setId( "__MISSING_PARENT_PHYSICAL_MODEL__" ); //$NON-NLS-1$ domain.addPhysicalModel( missingParentModel ); SqlPhysicalModel model = (SqlPhysicalModel) domain.findPhysicalModel( databaseName ); SqlPhysicalTable table = new SqlPhysicalTable( model ); table.setId( physicalTable.getAttribute( "name" ) ); //$NON-NLS-1$
public void initialize( Domain domain ) throws ModelerException { SqlPhysicalModel model = (SqlPhysicalModel) domain.getPhysicalModels().get( 0 ); SqlPhysicalTable table = model.getPhysicalTables().get( 0 ); String targetTable = (String) table.getProperty( "target_table" ); //$NON-NLS-1$ if ( !StringUtils.isEmpty( targetTable ) ) { domain.setId( targetTable ); } this.databaseMeta = ThinModelConverter.convertToLegacy( model.getId(), model.getDatasource() ); }
/** * Returns a list of ModelInfo objects for the specified domain. These objects are small and this list is intended to * allow a client to provide a list of models to a user so the user can pick which one they want to work with. * * @param domain * @param models */ private void getModelInfos( final String domain, List<ModelInfo> models ) { IMetadataDomainRepository repo = getMetadataRepository(); Domain domainObject = repo.getDomain( domain ); // find the best locale String locale = LocaleHelper.getClosestLocale( LocaleHelper.getLocale().toString(), domainObject.getLocaleCodes() ); // iterate over all of the models in this domain for ( LogicalModel model : domainObject.getLogicalModels() ) { // create a new ModelInfo object and give it the envelope information about the model ModelInfo modelInfo = new ModelInfo(); modelInfo.setDomainId( domain ); modelInfo.setModelId( model.getId() ); modelInfo.setModelName( model.getName( locale ) ); if ( model.getDescription() != null ) { String modelDescription = model.getDescription( locale ); modelInfo.setModelDescription( modelDescription ); } models.add( modelInfo ); } return; }
this.generator.setTableNames( tableNames ); domain = this.generator.generateDomain(); domain.setId( datasourceName ); domain.getLogicalModels().get( 0 ).setProperty( "DUAL_MODELING_SCHEMA", "" + doOlap );
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$
public static double upConvertDomain( Domain domain ) { int modelCount = domain.getLogicalModels().size(); LogicalModel model = domain.getLogicalModels().get( 0 ); String versionString = (String) model.getProperty( "AGILE_BI_VERSION" ); String isAgileBiGenerated = (String) model.getProperty( "AGILE_BI_GENERATED_SCHEMA" ); if ( model.getLogicalTables().size() == domain.getLogicalModels().get( 1 ).getLogicalTables().size() ) { return currentVersion; domain.addLogicalModel( olapModel ); domain.addLogicalModel( olapModel );
public synchronized void storeDomain( Domain domain, boolean overwrite ) throws DomainIdNullException, DomainAlreadyExistsException, DomainStorageException { // stores a domain to system/metadata/DOMAIN_ID.domain.xml // ISolutionRepository repo = PentahoSystem.get(ISolutionRepository.class, session); // repo.addSolutionFile(baseUrl, path, fileName, data, overwrite) if ( domain.getId() == null ) { // todo: replace with exception throw new DomainIdNullException( Messages.getErrorString( "IMetadataDomainRepository.ERROR_0001_DOMAIN_ID_NULL" ) ); //$NON-NLS-1$ } if ( !overwrite && domains != null && domains.get( domain.getId() ) != null ) { throw new DomainAlreadyExistsException( Messages.getErrorString( "IMetadataDomainRepository.ERROR_0002_DOMAIN_OBJECT_EXISTS", domain.getId() ) ); //$NON-NLS-1$ } // adds the domain to the domains list if ( domains == null ) { domains = new HashMap<String, Domain>(); } domains.put( domain.getId(), domain ); }
public void success( String retVal ) { enableWaitCursor( false ); hideDialog(); model.getDomain().setId( retVal ); ModelerDialog.this.listener.onDialogAccept( model.getDomain() ); }