lib/json-lib-2.4-jdk15.jar,\
lib/slf4j-api-1.7.36.jar,\
lib/postgresql-42.3.6.jar,\
+ lib/mchange-commons-java-0.2.11.jar,\
lib/cdmlib-cache-5.32.0-SNAPSHOT.jar,\
lib/org.swtchart_0.10.0.v20160212.jar,\
lib/commons-math3-3.6.1.jar,\
<version>4.4</version>\r
</dependency>\r
\r
+ <!-- used by taxeditor.local -->\r
+ <dependency>\r
+ <!-- used by datasource dialogue finish button -->\r
+ <groupId>com.mchange</groupId>\r
+ <artifactId>mchange-commons-java</artifactId>\r
+ <version>0.2.11</version>\r
+ </dependency>\r
+ \r
<!-- needed by taxeditor.test during test run, maybe move to test package only -->\r
<dependency>\r
<!-- when using bytebuddy for hibernate -->\r
import eu.etaxonomy.cdm.database.DatabaseTypeEnum;
import eu.etaxonomy.cdm.database.ICdmDataSource;
import eu.etaxonomy.taxeditor.local.datasource.common.CdmDataSourceRepository;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
* <p>CdmDataSourceWizard class.</p>
@Override
public boolean performFinish() {
- ICdmDataSource dataSource;
- switch(mode) {
- case EDIT:
- dataSource = dataSourcePage.getUpdatedDataSource();
- if(dataSourceName.equals(dataSource.getName())) {
- CdmDataSourceRepository.update(dataSourceName, dataSource);
- } else {
- CdmDataSourceRepository.replace(dataSourceName, dataSource);
- }
- return true;
- case CLONE:
- dataSource = dataSourcePage.getUpdatedDataSource();
- CdmDataSourceRepository.save(dataSourcePage.getDataSourceName(), dataSource);
- return true;
- case CREATE:
- if(dataSourceSelectionPage.getCredentialsWizardPage() != null){
- CdmDataSourceCredentialsWizardPage credentialsWizardPage = dataSourceSelectionPage.getCredentialsWizardPage();
- CdmDataSourceRepository.save(dataSourceSelectionPage.getDataSourceName(), credentialsWizardPage.getUpdatedDataSource());
- return true;
- } else {
- throw new IllegalStateException("Expected a datasource credentials page to exist");
- }
- default:
- return false;
- }
-
+ try {
+ ICdmDataSource dataSource;
+ switch(mode) {
+ case EDIT:
+ dataSource = dataSourcePage.getUpdatedDataSource();
+ if(dataSourceName.equals(dataSource.getName())) {
+ CdmDataSourceRepository.update(dataSourceName, dataSource);
+ } else {
+ CdmDataSourceRepository.replace(dataSourceName, dataSource);
+ }
+ return true;
+ case CLONE:
+ dataSource = dataSourcePage.getUpdatedDataSource();
+ CdmDataSourceRepository.save(dataSourcePage.getDataSourceName(), dataSource);
+ return true;
+ case CREATE:
+ if(dataSourceSelectionPage.getCredentialsWizardPage() != null){
+ CdmDataSourceCredentialsWizardPage credentialsWizardPage = dataSourceSelectionPage.getCredentialsWizardPage();
+ CdmDataSourceRepository.save(dataSourceSelectionPage.getDataSourceName(), credentialsWizardPage.getUpdatedDataSource());
+ return true;
+ } else {
+ throw new IllegalStateException("Expected a datasource credentials page to exist");
+ }
+ default:
+ return false;
+ }
+ } catch (Throwable e) {
+ MessagingUtils.errorDialog("Error when persisting change",
+ this,
+ e.getMessage(),
+ TaxeditorStorePlugin.PLUGIN_ID,
+ e,
+ true);
+ return false;
+ }
}
@Override