Revision 1103732d
Added by Katja Luther almost 8 years ago
eu.etaxonomy.taxeditor.cdmlib/.classpath | ||
---|---|---|
29 | 29 |
<classpathentry exported="true" kind="lib" path="lib/batik-xml-1.7.jar"/> |
30 | 30 |
<classpathentry exported="true" kind="lib" path="lib/c3p0-0.9.5.2.jar"/> |
31 | 31 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-4.3.0-SNAPSHOT.jar"/> |
32 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-4.3.0-SNAPSHOT.jar"/> |
|
33 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-io-4.3.0-SNAPSHOT.jar"/> |
|
34 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-model-4.3.0-SNAPSHOT.jar"/> |
|
32 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-4.3.0-SNAPSHOT.jar" sourcepath="C:/Users/k.luther/.m2/repository/eu/etaxonomy/cdmlib-ext/4.3.0-SNAPSHOT/cdmlib-ext-4.3.0-SNAPSHOT-sources.jar"/>
|
|
33 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-io-4.3.0-SNAPSHOT.jar" sourcepath="C:/Users/k.luther/.m2/repository/eu/etaxonomy/cdmlib-io/4.3.0-SNAPSHOT/cdmlib-io-4.3.0-SNAPSHOT-sources.jar"/>
|
|
34 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-model-4.3.0-SNAPSHOT.jar" sourcepath="C:/Users/k.luther/.m2/repository/eu/etaxonomy/cdmlib-model/4.3.0-SNAPSHOT/cdmlib-model-4.3.0-SNAPSHOT-sources.jar"/>
|
|
35 | 35 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-4.3.0-SNAPSHOT.jar"/> |
36 | 36 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-print-4.3.0-SNAPSHOT.jar"/> |
37 | 37 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-4.3.0-SNAPSHOT.jar"/> |
38 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-services-4.3.0-SNAPSHOT.jar"/> |
|
38 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-services-4.3.0-SNAPSHOT.jar" sourcepath="C:/Users/k.luther/.m2/repository/eu/etaxonomy/cdmlib-services/4.3.0-SNAPSHOT/cdmlib-services-4.3.0-SNAPSHOT-sources.jar"/>
|
|
39 | 39 |
<classpathentry exported="true" kind="lib" path="lib/cdmlib-test-4.3.0-SNAPSHOT.jar"/> |
40 | 40 |
<classpathentry exported="true" kind="lib" path="lib/cglib-3.2.0.jar"/> |
41 | 41 |
<classpathentry exported="true" kind="lib" path="lib/cglib-nodep-3.2.0.jar"/> |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroupedContainer.java | ||
---|---|---|
900 | 900 |
getNameViewer().getTextWidget().setFont(defaultFont); |
901 | 901 |
|
902 | 902 |
getNameViewer().getDocument().set(getEmptyTextPrompt()); |
903 |
// placeCursor();
|
|
903 |
placeCursor(); |
|
904 | 904 |
} |
905 | 905 |
|
906 | 906 |
/** |
... | ... | |
1123 | 1123 |
AbstractGroupedContainer.this.handleSplitText(text); |
1124 | 1124 |
} |
1125 | 1125 |
|
1126 |
|
|
1127 | 1126 |
}; |
1128 | 1127 |
|
1129 | 1128 |
getNameViewer().getTextWidget().addVerifyListener(lineBreakListener); |
1130 |
//getNameViewer().getTextWidget().addKeyListener(lineBreakListener); |
|
1129 |
|
|
1131 | 1130 |
} |
1132 | 1131 |
|
1133 | 1132 |
abstract class LabelEllipsisListener extends ControlAdapter { |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/LineBreakListener.java | ||
---|---|---|
44 | 44 |
* @created 19.05.2008 |
45 | 45 |
* @version 1.0 |
46 | 46 |
*/ |
47 |
|
|
47 | 48 |
public abstract class LineBreakListener implements VerifyListener{ |
48 | 49 |
|
50 |
|
|
49 | 51 |
private static String LINE_BREAK = System.getProperty("line.separator"); |
50 | 52 |
|
51 | 53 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientClassificationService.java | ||
---|---|---|
992 | 992 |
|
993 | 993 |
@Override |
994 | 994 |
public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification( |
995 |
UUID classificationUuid, List<UUID> excludeTaxa, Integer limit,
|
|
995 |
UUID classificationUuid, Integer limit, |
|
996 | 996 |
String pattern) { |
997 |
return defaultService.getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(classificationUuid, excludeTaxa, limit, pattern);
|
|
997 |
return defaultService.getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(classificationUuid, limit, pattern); |
|
998 | 998 |
} |
999 | 999 |
|
1000 | 1000 |
@Override |
1001 | 1001 |
public List<UuidAndTitleCache<TaxonNode>> getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification( |
1002 |
Classification classification, List<UUID> excludeTaxa,
|
|
1002 |
Classification classification, |
|
1003 | 1003 |
Integer limit, String pattern) { |
1004 |
return defaultService.getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(classification, excludeTaxa, limit, pattern);
|
|
1004 |
return defaultService.getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(classification, limit, pattern); |
|
1005 | 1005 |
} |
1006 | 1006 |
|
1007 | 1007 |
@Override |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/operation/CreateClassification.java | ||
---|---|---|
66 | 66 |
|
67 | 67 |
if(classification.getReference() == null){ |
68 | 68 |
Reference reference = ReferenceFactory.newGeneric(); |
69 |
reference.setTitleCache(classification.getTitleCache(), true);
|
|
69 |
reference.setTitle(classification.getTitleCache());
|
|
70 | 70 |
classification.setReference(reference); |
71 | 71 |
} |
72 | 72 |
|
eu.etaxonomy.taxeditor.store/plugin.xml | ||
---|---|---|
229 | 229 |
name="%view.name" |
230 | 230 |
restorable="true"> |
231 | 231 |
</view> |
232 |
<view |
|
233 |
allowMultiple="true" |
|
234 |
class="eu.etaxonomy.taxeditor.view.dataimport.SpecimenImportView" |
|
235 |
id="eu.etaxonomy.taxeditor.view.dataimport.SpecimenImportView" |
|
236 |
name="%view.name.7"> |
|
237 |
</view> |
|
238 |
<view |
|
239 |
allowMultiple="true" |
|
240 |
class="eu.etaxonomy.taxeditor.view.dataimport.GbifResponseImportView" |
|
241 |
id="eu.etaxonomy.taxeditor.view.dataimport.GbifResponseImportView" |
|
242 |
name="%view.name.8"> |
|
243 |
</view> |
|
232 | 244 |
<view |
233 | 245 |
name="%view.name.0" |
234 | 246 |
category="org.eclipse.ui" |
... | ... | |
799 | 811 |
id="eu.etaxonomy.taxeditor.io.import.tcs" |
800 | 812 |
name="%wizard.name"> |
801 | 813 |
</wizard> |
814 |
<wizard |
|
815 |
category="eu.etaxonomy.taxeditor.import.category.cdm" |
|
816 |
class="eu.etaxonomy.taxeditor.view.dataimport.SpecimenSearchWizard" |
|
817 |
id="eu.etaxonomy.taxeditor.view.dataimport.SpecimenSearchWizard" |
|
818 |
name="%wizard.name.21"> |
|
819 |
<description> |
|
820 |
%wizard.description |
|
821 |
</description> |
|
822 |
</wizard> |
|
823 |
|
|
802 | 824 |
<!-- <wizard |
803 | 825 |
category="eu.etaxonomy.taxeditor.import.category.cdm" |
804 | 826 |
class="eu.etaxonomy.taxeditor.io.wizard.JaxbImportWizard" |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/AbstractIOManager.java | ||
---|---|---|
30 | 30 |
protected ICdmApplicationConfiguration applicationConfiguration; |
31 | 31 |
|
32 | 32 |
public static enum TYPE { |
33 |
Jaxb, Tcs, Excel_Taxa, Endnote, Sdd, Abcd, SpecimenCdmExcel, Excel_Name, SpecimenSearch |
|
33 |
Jaxb, Tcs, Excel_Taxa, Endnote, Sdd, Abcd, SpecimenCdmExcel, Excel_Name, SpecimenSearch, Gbif
|
|
34 | 34 |
} |
35 | 35 |
|
36 | 36 |
/** |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ImportManager.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
import java.io.File; |
14 | 14 |
import java.io.InputStream; |
15 |
import java.net.URI; |
|
15 | 16 |
import java.nio.file.Files; |
16 | 17 |
import java.nio.file.Path; |
17 | 18 |
import java.nio.file.Paths; |
18 | 19 |
import java.util.List; |
20 |
import java.util.Set; |
|
19 | 21 |
import java.util.UUID; |
20 | 22 |
|
21 | 23 |
import org.apache.commons.io.IOUtils; |
... | ... | |
30 | 32 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
31 | 33 |
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration; |
32 | 34 |
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor; |
35 |
import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery; |
|
33 | 36 |
import eu.etaxonomy.cdm.io.common.CdmDefaultImport; |
34 | 37 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator; |
35 | 38 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE; |
36 | 39 |
import eu.etaxonomy.cdm.io.common.ImportResult; |
40 |
import eu.etaxonomy.cdm.io.dwca.in.DwcaImportConfigurator; |
|
37 | 41 |
import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator; |
38 | 42 |
import eu.etaxonomy.cdm.io.jaxb.JaxbImportConfigurator; |
39 | 43 |
import eu.etaxonomy.cdm.io.reference.endnote.in.EndnoteImportConfigurator; |
... | ... | |
302 | 306 |
return SpecimenCdmExcelImportConfigurator.NewInstance(null, null); |
303 | 307 |
case SpecimenSearch: |
304 | 308 |
return Abcd206ImportConfigurator.NewInstance(null, null); |
309 |
case Gbif: |
|
310 |
return DwcaImportConfigurator.NewInstance(null, null); |
|
305 | 311 |
default: |
306 | 312 |
MessagingUtils.notImplementedMessage(this); |
307 | 313 |
throw new IllegalArgumentException("Import not supported yet"); |
... | ... | |
386 | 392 |
public SpecimenCdmExcelImportConfigurator SpecimenCdmExcelImportConfigurator() { |
387 | 393 |
return (SpecimenCdmExcelImportConfigurator) getConfigurator(TYPE.SpecimenCdmExcel); |
388 | 394 |
} |
395 |
|
|
396 |
public DwcaImportConfigurator DwcaImportConfigurator() { |
|
397 |
return (DwcaImportConfigurator) getConfigurator(TYPE.Gbif); |
|
398 |
} |
|
399 |
|
|
389 | 400 |
|
390 | 401 |
/** |
391 | 402 |
* {@inheritDoc} |
... | ... | |
402 | 413 |
|
403 | 414 |
} |
404 | 415 |
|
416 |
public Job createIOServiceJob(final DwcaImportConfigurator configurator) { |
|
417 |
Assert.isNotNull(configurator, "Configuration may not be null"); |
|
418 |
final Display display = Display.getDefault(); |
|
419 |
Job job = new Job("Import: " + " Dwca") { |
|
420 |
|
|
421 |
@Override |
|
422 |
protected IStatus run(IProgressMonitor monitor) { |
|
423 |
monitor.beginTask("Importing data", IProgressMonitor.UNKNOWN); |
|
424 |
IIOService ioService = CdmApplicationState.getIOService(); |
|
425 |
|
|
426 |
ImportResult result = ioService.importDataFromStream(configurator); |
|
427 |
monitor.done(); |
|
428 |
|
|
429 |
display.asyncExec(new Runnable() { |
|
430 |
|
|
431 |
@Override |
|
432 |
public void run() { |
|
433 |
CdmStore.getContextManager().notifyContextRefresh(); |
|
434 |
} |
|
435 |
}); |
|
436 |
|
|
437 |
return Status.OK_STATUS; |
|
438 |
} |
|
439 |
}; |
|
440 |
|
|
441 |
return job; |
|
442 |
|
|
443 |
} |
|
444 |
|
|
405 | 445 |
|
406 | 446 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonNodeSelectionDialog.java | ||
---|---|---|
152 | 152 |
|
153 | 153 |
//FIXME prelim |
154 | 154 |
pattern = pattern + "*"; |
155 |
model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification.getUuid(), excludeTaxa, limitOfInitialElements, pattern);
|
|
155 |
model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedClassification.getUuid(), limitOfInitialElements, pattern); |
|
156 | 156 |
} |
157 | 157 |
|
158 | 158 |
/** {@inheritDoc} */ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/RepresentationElement.java | ||
---|---|---|
135 | 135 |
ICdmFormElement formElement, int style) { |
136 | 136 |
|
137 | 137 |
combo_language = formFactory.createDefinedTermComboElement(TermType.Language, formElement, |
138 |
"", null, true, style);
|
|
138 |
"", null, false, style);
|
|
139 | 139 |
|
140 | 140 |
combo_language.addSelectionListener(this); |
141 | 141 |
|
... | ... | |
174 | 174 |
element_Label.setText(selectedRepresentation.getLabel()); |
175 | 175 |
element_abbrevLabel.setText(selectedRepresentation.getAbbreviatedLabel()); |
176 | 176 |
element_text.setText(selectedRepresentation.getDescription()); |
177 |
|
|
177 |
|
|
178 | 178 |
}else { |
179 |
|
|
179 | 180 |
element_Label.setEnabled(false); |
180 | 181 |
element_abbrevLabel.setEnabled(false); |
181 | 182 |
element_text.setEnabled(false); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TranslatableRepresentationElement.java | ||
---|---|---|
17 | 17 |
|
18 | 18 |
import eu.etaxonomy.cdm.model.common.Representation; |
19 | 19 |
import eu.etaxonomy.cdm.model.common.TermBase; |
20 |
import eu.etaxonomy.cdm.model.common.TermType; |
|
20 | 21 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
21 | 22 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
22 | 23 |
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermTranslationWizard; |
... | ... | |
40 | 41 |
public TranslatableRepresentationElement(CdmFormFactory formFactory, ICdmFormElement formElement, |
41 | 42 |
Representation representation, TermBase term, Integer textHeight, int style, boolean fill) { |
42 | 43 |
super(formFactory, formElement, representation, term, textHeight, style, fill); |
44 |
|
|
43 | 45 |
|
44 | 46 |
} |
45 | 47 |
|
... | ... | |
93 | 95 |
} |
94 | 96 |
@Override |
95 | 97 |
protected void createRepresentationEditingElements(ICdmFormElement formElement, int style) { |
96 |
super.createRepresentationEditingElements(formElement, style); |
|
98 |
super.createRepresentationEditingElements(formElement, style );
|
|
97 | 99 |
button = formFactory.createButton(getLayoutComposite(), |
98 | 100 |
"Open In Translation Editor", SWT.PUSH); |
99 | 101 |
addControl(button); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/translation/TermTranslationWizardPage.java | ||
---|---|---|
122 | 122 |
text_source = formFactory.createRepresentationElement(element, preferredRepresentation,term, TEXT_HEIGHT, SWT.NULL, true); |
123 | 123 |
text_source.setTerm(term, true); |
124 | 124 |
|
125 |
|
|
126 | 125 |
} |
127 | 126 |
|
128 | 127 |
/** |
... | ... | |
131 | 130 |
*/ |
132 | 131 |
private void createRightControls(ICdmFormElement element){ |
133 | 132 |
text_target = formFactory.createRepresentationElement(element, null, term, TEXT_HEIGHT, SWT.NULL, false); |
133 |
|
|
134 | 134 |
} |
135 | 135 |
|
136 | 136 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/DataImportEditorContextMenu.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.taxeditor.view.dataimport; |
2 | 2 |
|
3 | 3 |
import java.io.IOException; |
4 |
import java.util.HashSet; |
|
5 |
import java.util.Set; |
|
4 | 6 |
|
5 | 7 |
import org.apache.http.client.ClientProtocolException; |
6 | 8 |
import org.apache.log4j.Logger; |
... | ... | |
89 | 91 |
public void handleEvent(Event event) { |
90 | 92 |
try{ |
91 | 93 |
DataSetResponse response = new GbifQueryServiceWrapper().queryOriginalDataSet(gbifResponse); |
92 |
final BioCaseEditorInput input = new BioCaseEditorInput(new OccurenceQuery(response.getUnitId()), response.getEndpoint()); |
|
94 |
Set<String[]> unitIds = new HashSet<String[]>(); |
|
95 |
String[] tripleId = {response.getUnitId()}; |
|
96 |
unitIds.add(tripleId); |
|
97 |
final BioCaseEditorInput input = new BioCaseEditorInput(new OccurenceQuery(unitIds), response.getEndpoint()); |
|
93 | 98 |
// EditorUtil.open(input); |
94 | 99 |
Job queryJob = new Job("Querying for original record...") { |
95 | 100 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/GbifResponseImportView.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.view.dataimport; |
11 | 11 |
|
12 | 12 |
import java.io.IOException; |
13 |
import java.io.InputStream; |
|
13 | 14 |
import java.net.URISyntaxException; |
15 |
import java.util.ArrayList; |
|
14 | 16 |
import java.util.Collection; |
17 |
import java.util.HashSet; |
|
18 |
import java.util.Set; |
|
15 | 19 |
|
16 | 20 |
import org.apache.http.client.ClientProtocolException; |
21 |
import org.eclipse.core.runtime.jobs.Job; |
|
17 | 22 |
|
23 |
import eu.etaxonomy.cdm.ext.occurrence.bioCase.BioCaseQueryServiceWrapper; |
|
24 |
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifDataSetProtocol; |
|
18 | 25 |
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifQueryServiceWrapper; |
19 | 26 |
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse; |
27 |
import eu.etaxonomy.cdm.io.common.CdmDefaultImport; |
|
28 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE; |
|
29 |
import eu.etaxonomy.cdm.io.dwca.in.DwcaImportConfigurator; |
|
30 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
|
31 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
20 | 32 |
|
21 | 33 |
/** |
22 | 34 |
* @author pplitzner |
... | ... | |
48 | 60 |
public void query() { |
49 | 61 |
String errorMessage = "Could not execute query " + query; |
50 | 62 |
try{ |
51 |
Collection<GbifResponse> results = new GbifQueryServiceWrapper().query(query); |
|
52 |
setResults(results); |
|
53 |
} catch (ClientProtocolException e) { |
|
54 |
logger.error(errorMessage, e); |
|
55 |
} catch (IOException e) { |
|
56 |
logger.error(errorMessage, e); |
|
57 |
} catch (URISyntaxException e) { |
|
58 |
logger.error(errorMessage, e); |
|
63 |
//Collection<GbifResponse> results = new GbifQueryServiceWrapper().query(query); |
|
64 |
//setResults(results); |
|
65 |
|
|
66 |
// String errorMessage = "Could not execute query " + query; |
|
67 |
|
|
68 |
// Collection<SpecimenOrObservationBase<?>> results = new ArrayList<SpecimenOrObservationBase<?>>(); |
|
69 |
Collection<GbifResponse> results = new GbifQueryServiceWrapper().query(query); |
|
70 |
|
|
71 |
setResults(results); |
|
72 |
|
|
73 |
|
|
74 |
// |
|
75 |
// results = repo.getUnits(); |
|
76 |
|
|
77 |
} catch (ClientProtocolException e) { |
|
78 |
logger.error(errorMessage, e); |
|
79 |
} catch (IOException e) { |
|
80 |
logger.error(errorMessage, e); |
|
81 |
} catch (URISyntaxException e) { |
|
82 |
// TODO Auto-generated catch block |
|
83 |
e.printStackTrace(); |
|
84 |
} |
|
59 | 85 |
} |
60 | 86 |
|
61 |
} |
|
87 |
// setResults(results); |
|
88 |
// |
|
89 |
// } |
|
90 |
// } catch (ClientProtocolException e) { |
|
91 |
// logger.error(errorMessage, e); |
|
92 |
// } catch (IOException e) { |
|
93 |
// logger.error(errorMessage, e); |
|
94 |
// } catch (URISyntaxException e) { |
|
95 |
// logger.error(errorMessage, e); |
|
96 |
// } |
|
97 |
|
|
98 |
// } |
|
62 | 99 |
|
63 | 100 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SaveImportedSpecimenAction.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.taxeditor.view.dataimport; |
2 | 2 |
|
3 |
import java.util.Collection; |
|
4 |
import java.util.HashSet; |
|
5 |
import java.util.Set; |
|
6 |
|
|
3 | 7 |
import org.apache.log4j.Logger; |
8 |
import org.eclipse.core.runtime.jobs.Job; |
|
4 | 9 |
import org.eclipse.jface.action.Action; |
5 | 10 |
import org.eclipse.swt.widgets.Table; |
6 | 11 |
import org.eclipse.swt.widgets.TableItem; |
... | ... | |
11 | 16 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
12 | 17 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
13 | 18 |
import eu.etaxonomy.cdm.api.service.ITermService; |
19 |
import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery; |
|
20 |
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifDataSetProtocol; |
|
14 | 21 |
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse; |
22 |
import eu.etaxonomy.cdm.io.dwca.in.DwcaImportConfigurator; |
|
15 | 23 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
16 | 24 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
17 | 25 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
... | ... | |
32 | 40 |
if(activePart instanceof DataImportView<?>){ |
33 | 41 |
DataImportView<?> dataImportView = (DataImportView<?>)activePart; |
34 | 42 |
Table table = dataImportView.getTable(); |
43 |
Collection<GbifResponse> checkedResults = new HashSet<GbifResponse>(); |
|
44 |
Object data; |
|
45 |
Set<String[]> unitIds = new HashSet<String[]>(); |
|
35 | 46 |
for(TableItem item:table.getItems()){ |
36 | 47 |
if(item.getChecked()){ |
37 | 48 |
//Save Specimen |
38 |
Object data = item.getData(); |
|
39 |
if(data instanceof GbifResponse){ |
|
40 |
data = ((GbifResponse) item.getData()).getDerivedUnitFacade().innerFieldUnit(); |
|
41 |
} |
|
42 |
if(data instanceof SpecimenOrObservationBase){ |
|
43 |
ConversationHolder conversation = dataImportView.getConversationHolder(); |
|
44 |
SpecimenOrObservationBase<?> specimen = (SpecimenOrObservationBase<?>) data; |
|
45 |
conversation.bind(); |
|
46 |
IOccurrenceService occurrenceService = CdmStore.getService(IOccurrenceService.class); |
|
47 |
for(ICdmBase cdmEntity:occurrenceService.getNonCascadedAssociatedElements(specimen)){ |
|
48 |
if(cdmEntity instanceof DefinedTermBase){ |
|
49 |
persistTerm((DefinedTermBase<?>) cdmEntity, CdmStore.getService(ITermService.class), conversation); |
|
50 |
} |
|
51 |
else if(cdmEntity instanceof TaxonNameBase){ |
|
52 |
//user interaction |
|
53 |
} |
|
54 |
} |
|
55 |
occurrenceService.saveOrUpdate(specimen); |
|
56 |
dataImportView.getConversationHolder().commit(true); |
|
57 |
} |
|
49 |
data = item.getData(); |
|
50 |
if(data instanceof GbifResponse){ |
|
51 |
checkedResults.add((GbifResponse)item.getData()); |
|
52 |
} |
|
53 |
} |
|
54 |
} |
|
55 |
for (GbifResponse response:checkedResults){ |
|
56 |
if (response != null){ |
|
57 |
System.err.println("response: " + response.getDataSetUri() + " " + response.getDataSetProtocol()); |
|
58 |
|
|
59 |
String[] tripleId = response.getTripleID(); |
|
60 |
unitIds.add(tripleId); |
|
61 |
|
|
62 |
} |
|
58 | 63 |
} |
64 |
|
|
65 |
DwcaImportConfigurator configurator = DwcaImportConfigurator.NewInstance(null, null); |
|
66 |
OccurenceQuery query = new OccurenceQuery(unitIds); |
|
67 |
configurator.setQuery(query); |
|
68 |
|
|
69 |
Job job = CdmStore.getImportManager().createIOServiceJob(configurator); |
|
70 |
CdmStore.getImportManager().run(job); |
|
71 |
|
|
72 |
|
|
59 | 73 |
} |
60 | 74 |
} |
61 |
} |
|
75 |
|
|
62 | 76 |
|
63 | 77 |
private void persistTerm(DefinedTermBase<?> term, ITermService termService, ConversationHolder conversation){ |
64 | 78 |
if(term!=null){ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenSearchWizard.java | ||
---|---|---|
116 | 116 |
try { |
117 | 117 |
|
118 | 118 |
dataImportView = (GbifResponseImportView) activePart.showView(GbifResponseImportView.ID, "query_"+query.toString().replaceAll(",", ""), IWorkbenchPage.VIEW_ACTIVATE); |
119 |
|
|
119 |
dataImportView.setQuery(query); |
|
120 | 120 |
// (GbifResponseImportView) activePart.showView(GbifResponseImportView.ID);getWorkbench().getActiveWorkbenchWindow().getActivePage() |
121 | 121 |
// .showView(GbifResponseImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE); |
122 | 122 |
|
Also available in: Unified diff
minor