Revision 298cf041
Added by Katja Luther about 8 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/BioCaseEditorInput.java | ||
---|---|---|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
10 |
package eu.etaxonomy.taxeditor.editor.view.dataimport;
|
|
10 |
package eu.etaxonomy.taxeditor.view.dataimport; |
|
11 | 11 |
|
12 | 12 |
import java.io.IOException; |
13 | 13 |
import java.io.InputStream; |
... | ... | |
23 | 23 |
import eu.etaxonomy.cdm.io.common.CdmDefaultImport; |
24 | 24 |
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator; |
25 | 25 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
26 |
import eu.etaxonomy.taxeditor.editor.view.dataimport.transientServices.TransientCdmRepository; |
|
27 | 26 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
28 | 27 |
|
29 | 28 |
/** |
... | ... | |
57 | 56 |
InputStream resultStream; |
58 | 57 |
resultStream = new BioCaseQueryServiceWrapper().query(query, endPoint); |
59 | 58 |
Abcd206ImportConfigurator configurator = Abcd206ImportConfigurator.NewInstance(resultStream, null, false); |
60 |
TransientCdmRepository repo = |
|
59 |
/* TransientCdmRepository repo =
|
|
61 | 60 |
new TransientCdmRepository(CdmStore.getCurrentApplicationConfiguration()); |
62 | 61 |
configurator.setCdmAppController(repo); |
63 |
|
|
62 |
*/ |
|
64 | 63 |
CdmDefaultImport<Abcd206ImportConfigurator> importer = new CdmDefaultImport<Abcd206ImportConfigurator>(); |
65 | 64 |
importer.invoke(configurator); |
66 |
results = repo.getUnits(); |
|
65 |
// results = repo.getUnits();
|
|
67 | 66 |
setResults(results); |
68 | 67 |
} catch (ClientProtocolException e) { |
69 | 68 |
logger.error(errorMessage, e); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/DataImportEditorContextMenu.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.editor.view.dataimport;
|
|
1 |
package eu.etaxonomy.taxeditor.view.dataimport; |
|
2 | 2 |
|
3 | 3 |
import java.io.IOException; |
4 | 4 |
|
... | ... | |
19 | 19 |
import org.eclipse.swt.widgets.MenuItem; |
20 | 20 |
import org.eclipse.ui.IEditorPart; |
21 | 21 |
import org.eclipse.ui.IWorkbenchWindow; |
22 |
import org.eclipse.ui.PartInitException; |
|
23 | 22 |
import org.eclipse.ui.PlatformUI; |
24 | 23 |
import org.eclipse.ui.actions.CompoundContributionItem; |
25 | 24 |
|
... | ... | |
30 | 29 |
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifQueryServiceWrapper; |
31 | 30 |
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse; |
32 | 31 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
33 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
|
34 | 32 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
35 | 33 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
36 | 34 |
|
... | ... | |
92 | 90 |
try{ |
93 | 91 |
DataSetResponse response = new GbifQueryServiceWrapper().queryOriginalDataSet(gbifResponse); |
94 | 92 |
final BioCaseEditorInput input = new BioCaseEditorInput(new OccurenceQuery(response.getUnitId()), response.getEndpoint()); |
95 |
EditorUtil.open(input); |
|
93 |
// EditorUtil.open(input);
|
|
96 | 94 |
Job queryJob = new Job("Querying for original record...") { |
97 | 95 |
|
98 | 96 |
@Override |
... | ... | |
106 | 104 |
logger.error("Query for single record failed.", e); |
107 | 105 |
} catch (IOException e) { |
108 | 106 |
logger.error("Query for single record failed.", e); |
109 |
} catch (PartInitException e) { |
|
110 |
logger.error("Could not open editor.", e); |
|
111 | 107 |
} |
108 |
// } catch (PartInitException e) { |
|
109 |
// logger.error("Could not open editor.", e); |
|
110 |
// } |
|
112 | 111 |
} |
113 | 112 |
}); |
114 | 113 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenImportView.java | ||
---|---|---|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
10 |
package eu.etaxonomy.taxeditor.editor.view.dataimport;
|
|
10 |
package eu.etaxonomy.taxeditor.view.dataimport; |
|
11 | 11 |
|
12 | 12 |
import java.io.IOException; |
13 | 13 |
import java.io.InputStream; |
... | ... | |
23 | 23 |
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE; |
24 | 24 |
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator; |
25 | 25 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
26 |
import eu.etaxonomy.taxeditor.editor.view.dataimport.transientServices.TransientCdmRepository; |
|
27 | 26 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
28 | 27 |
|
29 | 28 |
/** |
... | ... | |
33 | 32 |
*/ |
34 | 33 |
public class SpecimenImportView extends DataImportView<SpecimenOrObservationBase<?>> { |
35 | 34 |
|
36 |
public static final String ID = "eu.etaxonomy.taxeditor.editor.view.dataimport.SpecimenImportView"; //$NON-NLS-1$
|
|
35 |
public static final String ID = "eu.etaxonomy.taxeditor.view.dataimport.SpecimenImportView"; //$NON-NLS-1$ |
|
37 | 36 |
|
38 | 37 |
private URI endPoint; |
39 | 38 |
|
... | ... | |
48 | 47 |
} |
49 | 48 |
|
50 | 49 |
/* (non-Javadoc) |
51 |
* @see eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportView#getTextForTableItem(java.lang.Object)
|
|
50 |
* @see eu.etaxonomy.taxeditor.view.dataimport.DataImportView#getTextForTableItem(java.lang.Object) |
|
52 | 51 |
*/ |
53 | 52 |
@Override |
54 | 53 |
protected String getTextForTableItem(SpecimenOrObservationBase<?> item) { |
... | ... | |
56 | 55 |
} |
57 | 56 |
|
58 | 57 |
/* (non-Javadoc) |
59 |
* @see eu.etaxonomy.taxeditor.editor.view.dataimport.DataImportView#query()
|
|
58 |
* @see eu.etaxonomy.taxeditor.view.dataimport.DataImportView#query() |
|
60 | 59 |
*/ |
61 | 60 |
@Override |
62 | 61 |
public void query() { |
... | ... | |
68 | 67 |
InputStream resultStream; |
69 | 68 |
resultStream = new BioCaseQueryServiceWrapper().query(query, endPoint); |
70 | 69 |
Abcd206ImportConfigurator configurator = Abcd206ImportConfigurator.NewInstance(null, null); |
71 |
TransientCdmRepository repo = |
|
72 |
new TransientCdmRepository(CdmStore.getCurrentApplicationConfiguration()); |
|
73 |
configurator.setCdmAppController(repo); |
|
70 |
// TransientCdmRepository repo =
|
|
71 |
// new TransientCdmRepository(CdmStore.getCurrentApplicationConfiguration());
|
|
72 |
//configurator.setCdmAppController(repo);
|
|
74 | 73 |
configurator.setAddMediaAsMediaSpecimen(true); |
75 | 74 |
if(CdmStore.getCurrentSessionManager().isRemoting()) { |
76 | 75 |
Job job = CdmStore.getImportManager().createIOServiceJob(configurator, resultStream, SOURCE_TYPE.INPUTSTREAM); |
... | ... | |
80 | 79 |
CdmDefaultImport<Abcd206ImportConfigurator> importer = new CdmDefaultImport<Abcd206ImportConfigurator>(); |
81 | 80 |
importer.invoke(configurator); |
82 | 81 |
} |
83 |
results = repo.getUnits(); |
|
82 |
// results = repo.getUnits();
|
|
84 | 83 |
setResults(results); |
85 | 84 |
} catch (ClientProtocolException e) { |
86 | 85 |
logger.error(errorMessage, e); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenSearchWizard.java | ||
---|---|---|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
10 |
package eu.etaxonomy.taxeditor.editor.view.dataimport;
|
|
10 |
package eu.etaxonomy.taxeditor.view.dataimport; |
|
11 | 11 |
|
12 | 12 |
import org.apache.log4j.Logger; |
13 | 13 |
import org.eclipse.core.runtime.IProgressMonitor; |
... | ... | |
19 | 19 |
import org.eclipse.swt.widgets.Display; |
20 | 20 |
import org.eclipse.ui.IImportWizard; |
21 | 21 |
import org.eclipse.ui.IWorkbench; |
22 |
import org.eclipse.ui.IWorkbenchPage; |
|
23 |
import org.eclipse.ui.PartInitException; |
|
24 | 22 |
|
23 |
import eu.etaxonomy.cdm.database.DbSchemaValidation; |
|
25 | 24 |
import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery; |
26 |
import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
|
|
25 |
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
|
|
27 | 26 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
28 | 27 |
|
29 | 28 |
/** |
... | ... | |
61 | 60 |
|
62 | 61 |
DataImportView<?> dataImportView = null; |
63 | 62 |
query = searchPage.getQuery(); |
64 |
try { |
|
65 |
switch (providerSelectionPage.getQueryType()) { |
|
66 |
case BIOCASE: |
|
67 |
SpecimenImportView specimenImportView = (SpecimenImportView) TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage() |
|
68 |
.showView(SpecimenImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE); |
|
69 |
specimenImportView.setEndpoint(providerSelectionPage.getEndPoint()); |
|
70 |
dataImportView = specimenImportView; |
|
71 |
break; |
|
72 |
case GBIF: |
|
73 |
dataImportView = (GbifResponseImportView) TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage() |
|
74 |
.showView(GbifResponseImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE); |
|
75 |
break; |
|
76 |
} |
|
77 |
} catch ( PartInitException e ) { |
|
78 |
logger.error("Could not open import view for query: " + query.toString(), e); |
|
63 |
Abcd206ImportConfigurator configurator = CdmStore.getImportManager().AbcdConfigurator(); |
|
64 |
configurator.setOccurenceQuery(query); |
|
65 |
configurator.setSourceUri(providerSelectionPage.getEndPoint()); |
|
66 |
configurator.setDbSchemaValidation(DbSchemaValidation.CREATE); |
|
67 |
if(CdmStore.getCurrentSessionManager().isRemoting()) { |
|
68 |
//Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.INPUTSTREAM); |
|
69 |
//CdmStore.getImportManager().run(job); |
|
70 |
|
|
71 |
CdmStore.getImportManager().run(configurator); |
|
79 | 72 |
} |
80 |
if(dataImportView!=null){ |
|
81 |
dataImportView.setQuery(query); |
|
82 |
// dataImportView.query(); |
|
83 |
// Display.getDefault().asyncExec(new Runnable() { |
|
84 |
// |
|
85 |
// @Override |
|
86 |
// public void run() { |
|
87 |
// CdmStore.getContextManager().notifyContextRefresh(); |
|
88 |
// } |
|
89 |
// }); |
|
73 |
// try { |
|
74 |
// switch (providerSelectionPage.getQueryType()) { |
|
75 |
// case BIOCASE: |
|
76 |
// SpecimenImportView specimenImportView = (SpecimenImportView) TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage() |
|
77 |
// .showView(SpecimenImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE); |
|
78 |
// specimenImportView.setEndpoint(providerSelectionPage.getEndPoint()); |
|
79 |
// dataImportView = specimenImportView; |
|
80 |
// break; |
|
81 |
// case GBIF: |
|
82 |
// dataImportView = (GbifResponseImportView) TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage() |
|
83 |
// .showView(GbifResponseImportView.ID, "query_"+query.toString().replaceAll(",", ""),IWorkbenchPage.VIEW_ACTIVATE); |
|
84 |
// break; |
|
85 |
// } |
|
86 |
// } catch ( PartInitException e ) { |
|
87 |
// logger.error("Could not open import view for query: " + query.toString(), e); |
|
88 |
// } |
|
89 |
// if(dataImportView!=null){ |
|
90 |
// dataImportView.setQuery(query); |
|
91 |
//// dataImportView.query(); |
|
92 |
//// Display.getDefault().asyncExec(new Runnable() { |
|
93 |
//// |
|
94 |
//// @Override |
|
95 |
//// public void run() { |
|
96 |
//// CdmStore.getContextManager().notifyContextRefresh(); |
|
97 |
//// } |
|
98 |
//// }); |
|
90 | 99 |
Job queryJob = new QueryJob("Query specimen provider", dataImportView); |
91 | 100 |
queryJob.schedule(); |
92 |
} |
|
101 |
|
|
93 | 102 |
return true; |
94 | 103 |
} |
95 | 104 |
|
Also available in: Unified diff
fix jenkins