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
> {
32 public GbifImportEditorInput(OccurenceQuery query
) {
39 String errorMessage
= "Could not execute query " + query
;
41 Collection
<GbifResponse
> results
= new GbifQueryServiceWrapper().query(query
);
43 } catch (ClientProtocolException e
) {
44 logger
.error(errorMessage
, e
);
45 } catch (IOException e
) {
46 logger
.error(errorMessage
, e
);
47 } catch (URISyntaxException e
) {
48 logger
.error(errorMessage
, e
);
54 * @see org.eclipse.ui.IEditorInput#getName()
57 public String
getName() {
58 return "[GBIF] " + query
.toString();
62 * @see org.eclipse.ui.IEditorInput#getToolTipText()
65 public String
getToolTipText() {
66 return "[GBIF] " + query
.toString();
70 * @see java.lang.Object#hashCode()
73 public int hashCode() {
76 result
= prime
* result
+ ((query
== null) ?
0 : query
.hashCode());
81 * @see java.lang.Object#equals(java.lang.Object)
84 public boolean equals(Object obj
) {
91 if (getClass() != obj
.getClass()) {
94 DataImportEditorInput
<GbifResponse
> other
= (DataImportEditorInput
<GbifResponse
>) obj
;
96 if (other
.query
!= null) {
99 } else if (!query
.equals(other
.query
)) {