1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2014 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.taxeditor.view.dataimport;
|
11
|
|
12
|
import java.io.IOException;
|
13
|
import java.io.InputStream;
|
14
|
import java.net.URISyntaxException;
|
15
|
import java.util.ArrayList;
|
16
|
import java.util.Collection;
|
17
|
import java.util.Comparator;
|
18
|
import java.util.HashSet;
|
19
|
import java.util.Set;
|
20
|
|
21
|
import org.apache.http.client.ClientProtocolException;
|
22
|
import org.eclipse.core.runtime.jobs.Job;
|
23
|
|
24
|
import eu.etaxonomy.cdm.ext.occurrence.bioCase.BioCaseQueryServiceWrapper;
|
25
|
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifDataSetProtocol;
|
26
|
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifQueryServiceWrapper;
|
27
|
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
|
28
|
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
|
29
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
|
30
|
import eu.etaxonomy.cdm.io.dwca.in.DwcaImportConfigurator;
|
31
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
32
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
33
|
|
34
|
/**
|
35
|
* @author pplitzner
|
36
|
* @date Sep 5, 2014
|
37
|
*
|
38
|
*/
|
39
|
public class GbifResponseImportView extends DataImportView<GbifResponse> {
|
40
|
|
41
|
|
42
|
public static final String ID = "eu.etaxonomy.taxeditor.view.dataimport.GbifResponseImportView";
|
43
|
|
44
|
/* (non-Javadoc)
|
45
|
* @see eu.etaxonomy.taxeditor.view.dataimport.DataImportView#getTextForTableItem(java.lang.Object)
|
46
|
*/
|
47
|
@Override
|
48
|
protected String getTextForTableItem(GbifResponse item) {
|
49
|
String text = "";
|
50
|
if(item.getDataSetProtocol()!=null){
|
51
|
text += "["+item.getDataSetProtocol()+"] ";
|
52
|
}
|
53
|
text += item.getDerivedUnitFacade().innerDerivedUnit().generateTitle();
|
54
|
return text;
|
55
|
}
|
56
|
|
57
|
/* (non-Javadoc)
|
58
|
* @see eu.etaxonomy.taxeditor.view.dataimport.DataImportView#query()
|
59
|
*/
|
60
|
@Override
|
61
|
public void query() {
|
62
|
String errorMessage = "Could not execute query " + query;
|
63
|
try{
|
64
|
//Collection<GbifResponse> results = new GbifQueryServiceWrapper().query(query);
|
65
|
//setResults(results);
|
66
|
|
67
|
// String errorMessage = "Could not execute query " + query;
|
68
|
|
69
|
// Collection<SpecimenOrObservationBase<?>> results = new ArrayList<SpecimenOrObservationBase<?>>();
|
70
|
Collection<GbifResponse> results = new GbifQueryServiceWrapper().query(query);
|
71
|
|
72
|
setResults(results);
|
73
|
|
74
|
|
75
|
//
|
76
|
// results = repo.getUnits();
|
77
|
|
78
|
} catch (ClientProtocolException e) {
|
79
|
logger.error(errorMessage, e);
|
80
|
} catch (IOException e) {
|
81
|
logger.error(errorMessage, e);
|
82
|
} catch (URISyntaxException e) {
|
83
|
// TODO Auto-generated catch block
|
84
|
e.printStackTrace();
|
85
|
}
|
86
|
}
|
87
|
|
88
|
// setResults(results);
|
89
|
//
|
90
|
// }
|
91
|
// } catch (ClientProtocolException e) {
|
92
|
// logger.error(errorMessage, e);
|
93
|
// } catch (IOException e) {
|
94
|
// logger.error(errorMessage, e);
|
95
|
// } catch (URISyntaxException e) {
|
96
|
// logger.error(errorMessage, e);
|
97
|
// }
|
98
|
|
99
|
// }
|
100
|
|
101
|
|
102
|
|
103
|
|
104
|
|
105
|
|
106
|
}
|