Revision 5bceba97
Added by Katja Luther over 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/ImportPreferencesWizard.java | ||
---|---|---|
25 | 25 |
public ImportPreferencesWizard() { |
26 | 26 |
setWindowTitle("Abcd Import Configuration Wizard"); |
27 | 27 |
|
28 |
configPage = AbcdImportConfiguratorWizardPage.createPreferencePage(PreferencesUtil.getLocalAbcdImportConfigurator()); |
|
28 |
configPage = AbcdImportConfiguratorWizardPage.createPreferencePage(PreferencesUtil.getLocalAbcdImportConfigurator(false));
|
|
29 | 29 |
|
30 | 30 |
} |
31 | 31 |
@Override |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/abcd/AbcdImportWizardE4.java | ||
---|---|---|
68 | 68 |
/** {@inheritDoc} */ |
69 | 69 |
@Override |
70 | 70 |
public void init() { |
71 |
configurator = PreferencesUtil.getLocalAbcdImportConfigurator(); |
|
71 |
configurator = PreferencesUtil.getLocalAbcdImportConfigurator(false);
|
|
72 | 72 |
} |
73 | 73 |
|
74 | 74 |
@Override |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportConfiguratorWizardPage.java | ||
---|---|---|
26 | 26 |
import org.eclipse.swt.widgets.Text; |
27 | 27 |
|
28 | 28 |
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator; |
29 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
|
30 | 29 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
31 | 30 |
import eu.etaxonomy.taxeditor.databaseAdmin.wizard.AbstractPreferenceWizard; |
32 | 31 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
32 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
33 | 33 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
34 | 34 |
|
35 | 35 |
/** |
... | ... | |
301 | 301 |
}catch(IllegalArgumentException e){ |
302 | 302 |
//TODO: check prior or message |
303 | 303 |
} |
304 |
PreferencesUtil.setStringValue(PreferencePredicate.AbcdImportConfig.getKey(), abcdImportConfigurator.toString());
|
|
304 |
PreferencesUtil.setStringValue(IPreferenceKeys.LAST_USED_ABCD_CONFIG, abcdImportConfigurator.toString());
|
|
305 | 305 |
|
306 | 306 |
|
307 | 307 |
} |
... | ... | |
323 | 323 |
} |
324 | 324 |
|
325 | 325 |
public void createAbcdImportConfig() { |
326 |
this.abcdImportConfigurator = PreferencesUtil.getLocalAbcdImportConfigurator(); |
|
326 |
this.abcdImportConfigurator = PreferencesUtil.getLocalAbcdImportConfigurator(false);
|
|
327 | 327 |
|
328 | 328 |
} |
329 | 329 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/AbcdImportWizard.java | ||
---|---|---|
12 | 12 |
import java.io.File; |
13 | 13 |
import java.net.URI; |
14 | 14 |
|
15 |
import org.apache.commons.lang.StringUtils; |
|
15 | 16 |
import org.apache.log4j.Logger; |
16 | 17 |
import org.eclipse.jface.viewers.IStructuredSelection; |
17 | 18 |
import org.eclipse.ui.IWorkbench; |
... | ... | |
19 | 20 |
import eu.etaxonomy.cdm.database.DbSchemaValidation; |
20 | 21 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE; |
21 | 22 |
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator; |
23 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
22 | 24 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
23 | 25 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
24 | 26 |
|
... | ... | |
62 | 64 |
@Override |
63 | 65 |
public void init(IWorkbench workbench, IStructuredSelection selection) { |
64 | 66 |
super.init(workbench, selection); |
65 |
configurator = PreferencesUtil.getLocalAbcdImportConfigurator(); |
|
67 |
String configString = PreferencesUtil.getStringValue(IPreferenceKeys.LAST_USED_ABCD_CONFIG); |
|
68 |
if (StringUtils.isBlank(configString)){ |
|
69 |
configurator = PreferencesUtil.getLocalAbcdImportConfigurator(false); |
|
70 |
}else{ |
|
71 |
configurator = Abcd206ImportConfigurator.NewInstance(null, null); |
|
72 |
PreferencesUtil.extractAbcdConfiguratorFromPreferenceString(configurator, configString); |
|
73 |
} |
|
66 | 74 |
} |
67 | 75 |
|
68 | 76 |
@Override |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/AbcdImportPreference.java | ||
---|---|---|
381 | 381 |
}else{ |
382 | 382 |
PreferencesUtil.setBooleanValue( PreferencesUtil.prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey()), override); |
383 | 383 |
} |
384 |
PreferencesUtil.setStringValue(IPreferenceKeys.LAST_USED_ABCD_CONFIG, ""); |
|
384 | 385 |
|
385 | 386 |
|
386 | 387 |
} |
... | ... | |
424 | 425 |
PreferencesUtil.prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey()), true) != null? PreferencesUtil.getBooleanValue( |
425 | 426 |
PreferencesUtil.prefOverrideKey(PreferencePredicate.AbcdImportConfig.getKey()), true):false; |
426 | 427 |
if (allowOverride && override){ |
427 |
configurator = PreferencesUtil.getLocalAbcdImportConfigurator(); |
|
428 |
String configString = PreferencesUtil.getStringValue(PreferencePredicate.AbcdImportConfig.getKey(), true); |
|
429 |
configurator = Abcd206ImportConfigurator.NewInstance(null, null); |
|
430 |
PreferencesUtil.extractAbcdConfiguratorFromPreferenceString(configurator, configString); |
|
428 | 431 |
}else{ |
429 | 432 |
PreferencesUtil.extractAbcdConfiguratorFromPreferenceString(configurator, preference.getValue()); |
430 | 433 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java | ||
---|---|---|
173 | 173 |
|
174 | 174 |
|
175 | 175 |
public static final String LAST_SELECTED_REFERENCES = "eu.etaxonomy.taxeditor.references.selection.lastSelected"; |
176 |
public static final String LAST_USED_ABCD_CONFIG = "eu.etaxonomy.taxeditor.io.abcd.lastUsedConfig"; |
|
176 | 177 |
|
177 | 178 |
// public static final String DO_NOT_PUBLISH = "DO NOT PUBLISH"; |
178 | 179 |
// public static final String INHERIT_FROM_PARENT = "PARENT"; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java | ||
---|---|---|
1579 | 1579 |
} |
1580 | 1580 |
} |
1581 | 1581 |
} |
1582 |
|
|
1583 | 1582 |
public static Abcd206ImportConfigurator getLocalAbcdImportConfigurator(){ |
1583 |
return getLocalAbcdImportConfigurator(true); |
|
1584 |
} |
|
1585 |
public static Abcd206ImportConfigurator getLocalAbcdImportConfigurator(boolean skipCheckOverride){ |
|
1584 | 1586 |
Abcd206ImportConfigurator config = Abcd206ImportConfigurator.NewInstance(null,null); |
1585 |
String configString = getStringValue(PreferencePredicate.AbcdImportConfig.getKey(), true); |
|
1586 |
extractAbcdConfiguratorFromPreferenceString(config, configString); |
|
1587 |
String configString = PreferencesUtil.getStringValue(IPreferenceKeys.LAST_USED_ABCD_CONFIG); |
|
1588 |
if (StringUtils.isBlank(configString)){ |
|
1589 |
configString = getStringValue(PreferencePredicate.AbcdImportConfig.getKey(), skipCheckOverride); |
|
1590 |
extractAbcdConfiguratorFromPreferenceString(config, configString); |
|
1591 |
if (config.getNomenclaturalCode() == null){ |
|
1592 |
config.setNomenclaturalCode(getPreferredNomenclaturalCode()); |
|
1593 |
} |
|
1594 |
}else{ |
|
1595 |
config = Abcd206ImportConfigurator.NewInstance(null, null); |
|
1596 |
PreferencesUtil.extractAbcdConfiguratorFromPreferenceString(config, configString); |
|
1597 |
} |
|
1598 |
|
|
1587 | 1599 |
return config; |
1588 | 1600 |
|
1589 | 1601 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/DataImportViewE4.java | ||
---|---|---|
41 | 41 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
42 | 42 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
43 | 43 |
import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery; |
44 |
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator; |
|
44 | 45 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
45 | 46 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
46 | 47 |
import eu.etaxonomy.taxeditor.databaseAdmin.wizard.ImportPreferencesWizard; |
... | ... | |
48 | 49 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
49 | 50 |
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData; |
50 | 51 |
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; |
52 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
51 | 53 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
52 | 54 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory; |
53 | 55 |
|
... | ... | |
87 | 89 |
|
88 | 90 |
private Button openConfigurator; |
89 | 91 |
|
92 |
private Abcd206ImportConfigurator config; |
|
93 |
|
|
90 | 94 |
public Classification getClassification() { |
91 | 95 |
return classification; |
92 | 96 |
} |
... | ... | |
160 | 164 |
textReferenceString.setLayoutData(gd_textReferenceString); |
161 | 165 |
|
162 | 166 |
//open configuration |
167 |
|
|
168 |
PreferencesUtil.getLocalAbcdImportConfigurator(false); |
|
169 |
|
|
163 | 170 |
openConfigurator = new Button(composite_1, SWT.PUSH); |
164 | 171 |
openConfigurator.setText("Configuration"); |
165 | 172 |
new Label(composite_1, SWT.NONE); |
166 | 173 |
new Label(composite_1, SWT.NONE); |
174 |
|
|
167 | 175 |
openConfigurator.addSelectionListener(new SelectionAdapter(){ |
168 | 176 |
@Override |
169 | 177 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
171 | 179 |
IWizard wizard = new ImportPreferencesWizard(); |
172 | 180 |
WizardDialog dialog = new WizardDialog(e.display.getActiveShell(), wizard); |
173 | 181 |
dialog.open(); |
182 |
|
|
174 | 183 |
} |
175 | 184 |
}); |
176 | 185 |
|
... | ... | |
228 | 237 |
} |
229 | 238 |
}); |
230 | 239 |
//import button |
240 |
|
|
231 | 241 |
saveImportedSpecimenAction = new SaveImportedSpecimenActionE4(this); |
232 | 242 |
initializeToolBar(); |
233 | 243 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SaveImportedSpecimenActionE4.java | ||
---|---|---|
94 | 94 |
if (!response.getDataSetUri().equals(dataSetUri)){ |
95 | 95 |
dataSetUri = response.getDataSetUri(); |
96 | 96 |
|
97 |
configuratorAbcd = PreferencesUtil.getLocalAbcdImportConfigurator(); |
|
97 |
configuratorAbcd = PreferencesUtil.getLocalAbcdImportConfigurator(false);
|
|
98 | 98 |
configuratorAbcd.setSourceUri(dataSetUri); |
99 |
// configuratorAbcd.addMediaAsMediaSpecimen(true); |
|
100 |
// configuratorAbcd.setIgnoreAuthorship(true); |
|
101 |
// configuratorAbcd.setMoveNewTaxaToDefaultClassification(false); |
|
99 |
|
|
102 | 100 |
|
103 | 101 |
unitIdsBioCase = new HashSet<String[]>(); |
104 | 102 |
bioCaseOccurrenceQuery = new OccurenceQuery(unitIdsBioCase); |
105 | 103 |
configuratorAbcd.setOccurenceQuery(bioCaseOccurrenceQuery); |
106 |
// configuratorAbcd.setGetSiblings(true); |
|
104 |
|
|
107 | 105 |
if (dataImportView.getClassification() != null){ |
108 | 106 |
configuratorAbcd.setClassificationUuid(dataImportView.getClassification().getUuid()); |
109 | 107 |
} |
Also available in: Unified diff
ref #8494: save last abcd import configurator