Bundle-ManifestVersion: 2
Bundle-Name: EDIT Taxonomic Editor - DataStore Bundle
Bundle-SymbolicName: eu.etaxonomy.taxeditor.store;singleton:=true
-Bundle-Version: 2.0.0.v20090624-1625
+Bundle-Version: 2.0.0.v20090630-1147
Bundle-Activator: eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin
Bundle-Vendor: EDIT
Export-Package: eu.etaxonomy.taxeditor.datasource,
*/
protected CdmDataSourceMySQLWizardPage(ICdmDataSource dataSource) {
super("MySQL");
- setTitle("Enter credentials for MySQL database");
+ setTitle("MySQL Server");
+ setDescription("Enter credentials for MySQL database");
this.setDataSource(dataSource);
}
text_port.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
text_port.addModifyListener(this);
- if(getDataSource() != null){
- text_server.setText(getDataSource().getServer());
- text_port.setText(getDataSource().getPort()+"");
- text_databaseName.setText(getDataSource().getDatabase());
- text_username.setText(getDataSource().getUsername());
- text_password.setText(getDataSource().getPassword());
- }
}
/* (non-Javadoc)
@Override
public void updateLocation() {
server = text_server.getText();
- port = new Integer(text_port.getText());
+ try{
+ port = new Integer(text_port.getText());
+ }catch(NumberFormatException e){
+ // pass
+ }
}
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.springframework.security.BadCredentialsException;
+import org.springframework.security.LockedException;
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
import eu.etaxonomy.taxeditor.store.CdmStore;
try{
CdmStore.getAuthenticationManager().authenticate(token);
}catch(BadCredentialsException e){
- logger.error("Bad credentials");
+ logger.error("Bad credentials", e);
+ }catch(LockedException e){
+ logger.error("Account is locked", e);
}catch(IllegalArgumentException e){
- logger.error("Null argument for either user or password");
+ logger.error("Null argument for either user or password", e);
}
super.okPressed();
import eu.etaxonomy.cdm.io.berlinModel.in.BerlinModelImportConfigurator;
import eu.etaxonomy.cdm.io.common.Source;
import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
+import eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceSQLServerWizardPage;
import eu.etaxonomy.taxeditor.datasource.wizard.CdmDataSourceTypeSelectionWizardPage;
import eu.etaxonomy.taxeditor.store.CdmStore;
private static final Logger logger = Logger
.getLogger(BerlinModelImportWizard.class);
- CdmDataSourceTypeSelectionWizardPage dataSourceSelectionPage;
+ CdmDataSourceSQLServerWizardPage dataSourcePage;
BerlinModelImportConfigurator configurator;
@Override
public boolean performFinish() {
- ICdmDataSource dataSource;
- String dataSourceName = dataSourceSelectionPage.getDataSourceName();
- if(dataSourceSelectionPage.getCredentialsWizardPage() != null){
- dataSource = dataSourceSelectionPage.getCredentialsWizardPage().getDataSource();
+ ICdmDataSource dataSource =null;
+ if(dataSourcePage != null){
+ dataSource = dataSourcePage.getDataSource();
}else{
throw new IllegalStateException("Expected a datasource credentials page to exist");
}
configurator.setSource(source);
+ // should be obsolete because we want to pass application context but is not at the moment (throws NPE when not given)
configurator.setDestination(CdmDataSourceRepository.getDefault().getCurrentDataSource());
configurator.setCdmAppController(CdmStore.getApplicationController());
public void addPages() {
super.addPages();
- dataSourceSelectionPage = new CdmDataSourceTypeSelectionWizardPage(null);
- addPage(dataSourceSelectionPage);
+ dataSourcePage = new CdmDataSourceSQLServerWizardPage(null);
+ addPage(dataSourcePage);
}
}
package eu.etaxonomy.taxeditor.preference;\r
\r
import java.util.ArrayList;\r
+import java.util.HashSet;\r
import java.util.List;\r
import java.util.Set;\r
\r
* Generic method to get term preferences for a term vocabulary\r
* \r
* @param <T>\r
- * @param initialFeatures\r
+ * @param initialTerms\r
* @return\r
*/\r
- public static <T extends DefinedTermBase> List<T> getPreferredTerms(Set<T> initialFeatures){\r
+ public static <T extends DefinedTermBase> List<T> getPreferredTerms(Set<T> initialTerms){\r
+ \r
+ // set default for non existent preferences\r
+ defaultTerms(initialTerms);\r
+ \r
List<T> preferredTerms = new ArrayList<T>();\r
\r
- for (T term : initialFeatures){\r
+ for (T term : initialTerms){\r
if(getPreferenceStore().getBoolean(getPreferenceKey(term))){\r
preferredTerms.add(term);\r
}\r
return preferredTerms; \r
}\r
\r
+ private static <T extends DefinedTermBase> boolean defaultTerms(Set<T> initialTerms){\r
+ // set default for non existen preferences\r
+ for(T term : initialTerms){\r
+ if(getPreferenceStore().getBoolean(term.getClass().getName())){\r
+ break;\r
+ }else{\r
+ getPreferenceStore().setValue(term.getClass().getName(), true);\r
+ setPreferredTerms(new ArrayList(initialTerms), initialTerms);\r
+ break;\r
+ }\r
+ }\r
+ return true;\r
+ }\r
+ \r
\r
/** @return a <code>List</code> containing user preferred <code>Feature</code> terms */\r
public static List<SpecimenTypeDesignationStatus> getPreferredSpecimenTypeDesignationStatus() { return getPreferredTerms(VocabularyStore.getSpecimenTypeDesignationStatus());}\r
* @return
*/
public List<TaxonomicTree> getTaxonomicTrees() {
- return applicationController.getTaxonService().getAllTaxonomicTrees(10000, 0);
+ return applicationController.getTaxonService().listTaxonomicTrees(null, null, null, null);
}
ITaxonServiceConfigurator configurator = new TaxonServiceConfiguratorImpl();
- configurator.setSearchString(queryString);
+ configurator.setSearchString(queryString.trim());
configurator.setDoTaxa(true);
configurator.setMatchMode(MatchMode.BEGINNING);
if (restrictToTaxonObjs) {