3 * Copyright (C) 2014 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.editor
.view
.dataimport
;
12 import java
.io
.IOException
;
13 import java
.net
.URISyntaxException
;
14 import java
.util
.Collection
;
16 import org
.apache
.http
.client
.ClientProtocolException
;
18 import eu
.etaxonomy
.cdm
.ext
.occurrence
.OccurenceQuery
;
19 import eu
.etaxonomy
.cdm
.ext
.occurrence
.gbif
.GbifQueryServiceWrapper
;
20 import eu
.etaxonomy
.cdm
.ext
.occurrence
.gbif
.GbifResponse
;
27 public class GbifImportEditorInput
extends DataImportEditorInput
<GbifResponse
> {
29 public GbifImportEditorInput(OccurenceQuery query
) {
36 String errorMessage
= "Could not execute query " + query
;
38 Collection
<GbifResponse
> results
= new GbifQueryServiceWrapper().query(query
);
40 } catch (ClientProtocolException e
) {
41 logger
.error(errorMessage
, e
);
42 } catch (IOException e
) {
43 logger
.error(errorMessage
, e
);
44 } catch (URISyntaxException e
) {
45 logger
.error(errorMessage
, e
);
51 public String
getName() {
52 return "[GBIF] " + query
.toString();
56 public String
getToolTipText() {
57 return "[GBIF] " + query
.toString();
61 public int hashCode() {
64 result
= prime
* result
+ ((query
== null) ?
0 : query
.hashCode());
69 public boolean equals(Object obj
) {
76 if (getClass() != obj
.getClass()) {
79 DataImportEditorInput
<GbifResponse
> other
= (DataImportEditorInput
<GbifResponse
>) obj
;
81 if (other
.query
!= null) {
84 } else if (!query
.equals(other
.query
)) {