Index: src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportOptionsPage.java =================================================================== RCS file: /cvs/dev/com.metamatrix.modeler.jdbc.ui/src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportOptionsPage.java,v retrieving revision 1.9.2.2.2.5 diff -u -r1.9.2.2.2.5 JdbcImportOptionsPage.java --- src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportOptionsPage.java 26 Jul 2007 00:44:58 -0000 1.9.2.2.2.5 +++ src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportOptionsPage.java 19 Jul 2010 17:44:40 -0000 @@ -101,6 +101,7 @@ private static final String NAME_LABEL = getString("nameLabel"); //$NON-NLS-1$ private static final String FOLDER_LABEL = getString("folderLabel"); //$NON-NLS-1$ private static final String UPDATE_CHECKBOX = getString("updateCheckBox"); //$NON-NLS-1$ + private static final String VIRTUAL_MODEL_CHECKBOX = "Make target model virtual"; //getString("updateCheckBox"); //$NON-NLS-1$ private static final String INCLUDE_GROUP = getString("includeGroup"); //$NON-NLS-1$ private static final String MODEL_OBJECT_NAMES_GROUP = getString("modelObjectNamesGroup"); //$NON-NLS-1$ private static final String SOURCE_OBJECT_NAMES_GROUP = getString("sourceObjectNamesGroup"); //$NON-NLS-1$ @@ -120,7 +121,8 @@ private static final String NOT_RELATIONAL_MODEL_MESSAGE = getString("notRelationalModelMessage"); //$NON-NLS-1$ private static final String READ_ONLY_MODEL_MESSAGE = getString("readOnlyModelMessage"); //$NON-NLS-1$ private static final String VIRTUAL_MODEL_MESSAGE = getString("virtualModelMessage"); //$NON-NLS-1$ - + private static final String PHYSICAL_MODEL_MESSAGE = "The model to update is not a virtual model."; //$NON-NLS-1$ + // =========================================================================================================================== // Static Methods @@ -146,11 +148,12 @@ private JdbcImportSettings importSettings; private Text nameText, folderText; private Button updateCheckBox, catalogCheckBox, schemaCheckBox, noneButton, uppercaseButton, lowercaseButton, emptyButton, - unqualifiedButton, qualifiedButton; + unqualifiedButton, qualifiedButton, virtualModelBox; private boolean initd; private IContainer folder; private boolean usesHiddenProject = false; private IFile selectedModel; + private boolean isVirtual = false; // =========================================================================================================================== // Constructors @@ -225,6 +228,15 @@ }); } + this.virtualModelBox = WidgetFactory.createCheckBox(pg, VIRTUAL_MODEL_CHECKBOX, 0, COLUMN_COUNT); + this.virtualModelBox.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(final SelectionEvent event) { + virtualModelBoxSelected(); + } + }); + this.virtualModelBox.setSelection(isVirtual); + this.updateCheckBox = WidgetFactory.createCheckBox(pg, UPDATE_CHECKBOX, 0, COLUMN_COUNT); this.updateCheckBox.addSelectionListener(new SelectionAdapter() { @@ -486,6 +498,15 @@ if ((resources != null) && (resources.length > 0)) { IFile model = (IFile)resources[0]; + + try { + ModelResource mr = ModelUtilities.getModelResource(model, true); + this.isVirtual = mr.getModelAnnotation().getModelType().equals(ModelType.VIRTUAL_LITERAL); + this.virtualModelBox.setSelection(this.isVirtual); + } catch (ModelWorkspaceException theException) { + Util.log(theException); + } + this.selectedModel = model; IContainer folder = model.getParent(); @@ -801,6 +822,15 @@ } validatePage(); } + + void virtualModelBoxSelected() { + // Need to set the JDBC IMport Settings to create or update "Virtual" relational model and NOT Physical + + // ALSO Need to change the "VALIDATION" for this page. If IS VIRTUAL and UPDATE is checked, then Selected Relational + // MODEL MUST be VIRTUAL, NOT PHYSICAL + this.isVirtual = virtualModelBox.getSelection(); + validatePage(); + } /** * Get the selected ModelResource. This method will check the selectedModel field - if it is @@ -901,10 +931,14 @@ WizardUtil.setPageComplete(this, NOT_RELATIONAL_MODEL_MESSAGE, ERROR); return; } - if (model.getModelType().getValue() == ModelType.VIRTUAL) { + if (!isVirtual() && model.getModelType().getValue() == ModelType.VIRTUAL) { WizardUtil.setPageComplete(this, VIRTUAL_MODEL_MESSAGE, ERROR); return; } + if (isVirtual() && model.getModelType().getValue() == ModelType.PHYSICAL) { + WizardUtil.setPageComplete(this, PHYSICAL_MODEL_MESSAGE, ERROR); + return; + } } catch (final ModelWorkspaceException err) { Util.log(err); WidgetUtil.showError(err.getLocalizedMessage()); @@ -1026,4 +1060,8 @@ public void setInitd(boolean initd) { this.initd = initd; } + + public boolean isVirtual() { + return this.isVirtual; + } } Index: src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportWizard.java =================================================================== RCS file: /cvs/dev/com.metamatrix.modeler.jdbc.ui/src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportWizard.java,v retrieving revision 1.16.2.6.2.4.14.1 diff -u -r1.16.2.6.2.4.14.1 JdbcImportWizard.java --- src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportWizard.java 14 Jul 2008 07:40:50 -0000 1.16.2.6.2.4.14.1 +++ src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportWizard.java 19 Jul 2010 17:44:40 -0000 @@ -142,6 +142,7 @@ private boolean debugTimingEnabled = false; private boolean controlsHaveBeenCreated = false; + private boolean isVirtual; private IJdbcImportPostProcessor[] postProcessors; @@ -360,10 +361,17 @@ final ModelAnnotation modelAnnotation = resrc.getModelAnnotation(); modelAnnotation.setPrimaryMetamodelUri(RelationalPackage.eNS_URI); - modelAnnotation.setModelType(ModelType.PHYSICAL_LITERAL); + ModelType type = ModelType.PHYSICAL_LITERAL; + + isVirtual = optionsPg.isVirtual(); + + if( isVirtual ) { + type = ModelType.VIRTUAL_LITERAL; + } + modelAnnotation.setModelType(type); if (resrc instanceof ModelResourceImpl) { - ((ModelResourceImpl)resrc).setModelType(ModelType.PHYSICAL_LITERAL); + ((ModelResourceImpl)resrc).setModelType(type); } if (processor != null && processor instanceof RelationalModelProcessorImpl) { JdbcImportWizard.this.drDifferenceReport = ((RelationalModelProcessorImpl)processor).generateDifferenceReport(resrc, @@ -706,9 +714,17 @@ final ModelAnnotation modelAnnotation = resrc.getModelAnnotation(); modelAnnotation.setPrimaryMetamodelUri(RelationalPackage.eNS_URI); - modelAnnotation.setModelType(ModelType.PHYSICAL_LITERAL); + ModelType type = ModelType.PHYSICAL_LITERAL; + + this.isVirtual = this.optionsPg.isVirtual(); + + if( this.isVirtual ) { + type = ModelType.VIRTUAL_LITERAL; + } + modelAnnotation.setModelType(type); + if (resrc instanceof ModelResourceImpl) { - ((ModelResourceImpl)resrc).setModelType(ModelType.PHYSICAL_LITERAL); + ((ModelResourceImpl)resrc).setModelType(type); } // Moved this call to AFTER the MODEL TYPE has been set. ModelUtilities.initializeModelContainers(resrc, "Jdbc Import", this); //$NON-NLS-1$ @@ -756,6 +772,13 @@ Stopwatch.logTimedMessage(" JDBC Import Wizard: Updating Model Contents - Delta ", sWatch.getTotalDuration()); //$NON-NLS-1$ sWatch.start(true); + + // Check if Virtual, then re-set ModelType + if( isVirtual ) { + ppProcessorPack.getModelResource().getModelAnnotation().setModelType(ModelType.VIRTUAL_LITERAL); + ((ModelResourceImpl)ppProcessorPack.getModelResource()).setModelType(ModelType.VIRTUAL_LITERAL); + } + // Auto save the model & refresh ppProcessorPack.getModelResource().save(monitor, true); sWatch.stop(); Index: jdbc_ui_patch.txt =================================================================== RCS file: jdbc_ui_patch.txt diff -N jdbc_ui_patch.txt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ jdbc_ui_patch.txt 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,177 @@ +Index: src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportOptionsPage.java +=================================================================== +RCS file: /cvs/dev/com.metamatrix.modeler.jdbc.ui/src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportOptionsPage.java,v +retrieving revision 1.9.2.2.2.5 +diff -u -r1.9.2.2.2.5 JdbcImportOptionsPage.java +--- src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportOptionsPage.java 26 Jul 2007 00:44:58 -0000 1.9.2.2.2.5 ++++ src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportOptionsPage.java 19 Jul 2010 17:23:40 -0000 +@@ -101,6 +101,7 @@ + private static final String NAME_LABEL = getString("nameLabel"); //$NON-NLS-1$ + private static final String FOLDER_LABEL = getString("folderLabel"); //$NON-NLS-1$ + private static final String UPDATE_CHECKBOX = getString("updateCheckBox"); //$NON-NLS-1$ ++ private static final String VIRTUAL_MODEL_CHECKBOX = "Make target model virtual"; //getString("updateCheckBox"); //$NON-NLS-1$ + private static final String INCLUDE_GROUP = getString("includeGroup"); //$NON-NLS-1$ + private static final String MODEL_OBJECT_NAMES_GROUP = getString("modelObjectNamesGroup"); //$NON-NLS-1$ + private static final String SOURCE_OBJECT_NAMES_GROUP = getString("sourceObjectNamesGroup"); //$NON-NLS-1$ +@@ -120,7 +121,8 @@ + private static final String NOT_RELATIONAL_MODEL_MESSAGE = getString("notRelationalModelMessage"); //$NON-NLS-1$ + private static final String READ_ONLY_MODEL_MESSAGE = getString("readOnlyModelMessage"); //$NON-NLS-1$ + private static final String VIRTUAL_MODEL_MESSAGE = getString("virtualModelMessage"); //$NON-NLS-1$ +- ++ private static final String PHYSICAL_MODEL_MESSAGE = "The model to update is not a virtual model."; //$NON-NLS-1$ ++ + // =========================================================================================================================== + // Static Methods + +@@ -146,11 +148,12 @@ + private JdbcImportSettings importSettings; + private Text nameText, folderText; + private Button updateCheckBox, catalogCheckBox, schemaCheckBox, noneButton, uppercaseButton, lowercaseButton, emptyButton, +- unqualifiedButton, qualifiedButton; ++ unqualifiedButton, qualifiedButton, virtualModelBox; + private boolean initd; + private IContainer folder; + private boolean usesHiddenProject = false; + private IFile selectedModel; ++ private boolean isVirtual = false; + + // =========================================================================================================================== + // Constructors +@@ -225,6 +228,15 @@ + }); + } + ++ this.virtualModelBox = WidgetFactory.createCheckBox(pg, VIRTUAL_MODEL_CHECKBOX, 0, COLUMN_COUNT); ++ this.virtualModelBox.addSelectionListener(new SelectionAdapter() { ++ ++ public void widgetSelected(final SelectionEvent event) { ++ virtualModelBoxSelected(); ++ } ++ }); ++ this.virtualModelBox.setSelection(isVirtual); ++ + this.updateCheckBox = WidgetFactory.createCheckBox(pg, UPDATE_CHECKBOX, 0, COLUMN_COUNT); + this.updateCheckBox.addSelectionListener(new SelectionAdapter() { + +@@ -486,6 +498,15 @@ + + if ((resources != null) && (resources.length > 0)) { + IFile model = (IFile)resources[0]; ++ ++ try { ++ ModelResource mr = ModelUtilities.getModelResource(model, true); ++ this.isVirtual = mr.getModelAnnotation().getModelType().equals(ModelType.VIRTUAL_LITERAL); ++ this.virtualModelBox.setSelection(this.isVirtual); ++ } catch (ModelWorkspaceException theException) { ++ Util.log(theException); ++ } ++ + this.selectedModel = model; + IContainer folder = model.getParent(); + +@@ -801,6 +822,15 @@ + } + validatePage(); + } ++ ++ void virtualModelBoxSelected() { ++ // Need to set the JDBC IMport Settings to create or update "Virtual" relational model and NOT Physical ++ ++ // ALSO Need to change the "VALIDATION" for this page. If IS VIRTUAL and UPDATE is checked, then Selected Relational ++ // MODEL MUST be VIRTUAL, NOT PHYSICAL ++ this.isVirtual = virtualModelBox.getSelection(); ++ validatePage(); ++ } + + /** + * Get the selected ModelResource. This method will check the selectedModel field - if it is +@@ -901,10 +931,14 @@ + WizardUtil.setPageComplete(this, NOT_RELATIONAL_MODEL_MESSAGE, ERROR); + return; + } +- if (model.getModelType().getValue() == ModelType.VIRTUAL) { ++ if (!isVirtual() && model.getModelType().getValue() == ModelType.VIRTUAL) { + WizardUtil.setPageComplete(this, VIRTUAL_MODEL_MESSAGE, ERROR); + return; + } ++ if (isVirtual() && model.getModelType().getValue() == ModelType.PHYSICAL) { ++ WizardUtil.setPageComplete(this, PHYSICAL_MODEL_MESSAGE, ERROR); ++ return; ++ } + } catch (final ModelWorkspaceException err) { + Util.log(err); + WidgetUtil.showError(err.getLocalizedMessage()); +@@ -1026,4 +1060,8 @@ + public void setInitd(boolean initd) { + this.initd = initd; + } ++ ++ public boolean isVirtual() { ++ return this.isVirtual; ++ } + } +Index: src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportWizard.java +=================================================================== +RCS file: /cvs/dev/com.metamatrix.modeler.jdbc.ui/src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportWizard.java,v +retrieving revision 1.16.2.6.2.4.14.1 +diff -u -r1.16.2.6.2.4.14.1 JdbcImportWizard.java +--- src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportWizard.java 14 Jul 2008 07:40:50 -0000 1.16.2.6.2.4.14.1 ++++ src/com/metamatrix/modeler/internal/jdbc/ui/wizards/JdbcImportWizard.java 19 Jul 2010 17:23:40 -0000 +@@ -142,6 +142,7 @@ + private boolean debugTimingEnabled = false; + + private boolean controlsHaveBeenCreated = false; ++ private boolean isVirtual; + + private IJdbcImportPostProcessor[] postProcessors; + +@@ -360,10 +361,15 @@ + + final ModelAnnotation modelAnnotation = resrc.getModelAnnotation(); + modelAnnotation.setPrimaryMetamodelUri(RelationalPackage.eNS_URI); +- modelAnnotation.setModelType(ModelType.PHYSICAL_LITERAL); ++ ModelType type = ModelType.PHYSICAL_LITERAL; ++ ++ if( isVirtual ) { ++ type = ModelType.VIRTUAL_LITERAL; ++ } ++ modelAnnotation.setModelType(type); + + if (resrc instanceof ModelResourceImpl) { +- ((ModelResourceImpl)resrc).setModelType(ModelType.PHYSICAL_LITERAL); ++ ((ModelResourceImpl)resrc).setModelType(type); + } + if (processor != null && processor instanceof RelationalModelProcessorImpl) { + JdbcImportWizard.this.drDifferenceReport = ((RelationalModelProcessorImpl)processor).generateDifferenceReport(resrc, +@@ -706,9 +712,14 @@ + + final ModelAnnotation modelAnnotation = resrc.getModelAnnotation(); + modelAnnotation.setPrimaryMetamodelUri(RelationalPackage.eNS_URI); +- modelAnnotation.setModelType(ModelType.PHYSICAL_LITERAL); ++ ModelType type = ModelType.PHYSICAL_LITERAL; ++ ++ modelAnnotation.setModelType(type); ++ ++ this.isVirtual = this.optionsPg.isVirtual(); ++ + if (resrc instanceof ModelResourceImpl) { +- ((ModelResourceImpl)resrc).setModelType(ModelType.PHYSICAL_LITERAL); ++ ((ModelResourceImpl)resrc).setModelType(type); + } + // Moved this call to AFTER the MODEL TYPE has been set. + ModelUtilities.initializeModelContainers(resrc, "Jdbc Import", this); //$NON-NLS-1$ +@@ -756,7 +767,14 @@ + Stopwatch.logTimedMessage(" JDBC Import Wizard: Updating Model Contents - Delta ", sWatch.getTotalDuration()); //$NON-NLS-1$ + sWatch.start(true); + ++ ++ // Check if Virtual, then re-set ModelType ++ if( isVirtual ) { ++ ppProcessorPack.getModelResource().getModelAnnotation().setModelType(ModelType.VIRTUAL_LITERAL); ++ } ++ + // Auto save the model & refresh ++ + ppProcessorPack.getModelResource().save(monitor, true); + sWatch.stop(); + if (debugTimingEnabled)