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