Project

General

Profile

Download (3.04 KB) Statistics
| Branch: | Tag: | Revision:
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.editor.view.dataimport;
11

    
12
import java.util.ArrayList;
13
import java.util.Collection;
14

    
15
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
16
import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
17
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
18
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
19

    
20
/**
21
 * @author pplitzner
22
 * @date 27.05.2014
23
 *
24
 */
25
public class GbifImportEditorInput extends DataImportEditorInput<GbifResponse> {
26

    
27
    private final OccurenceQuery query;
28

    
29
    /**
30
     * @param query
31
     */
32
    public GbifImportEditorInput(OccurenceQuery query) {
33
        super();
34
        this.query = query;
35
    }
36

    
37
    @Override
38
    public void query(){
39
        String errorMessage = "Could not execute query " + query;
40
//        try{
41
//            Collection<GbifResponse> results = new GbifQueryServiceWrapper().query(query);
42
            Collection<GbifResponse> results = new ArrayList<GbifResponse>();
43
            DerivedUnitFacade facade = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.PreservedSpecimen);
44
            facade.setLocality("outbanks of seashore");
45
            GbifResponse gbifResponse = new GbifResponse(facade, "endPointURL");
46
            results.add(gbifResponse);
47
            setResults(results);
48
//        } catch (ClientProtocolException e) {
49
//            logger.error(errorMessage, e);
50
//        } catch (IOException e) {
51
//            logger.error(errorMessage, e);
52
//        } catch (URISyntaxException e) {
53
//            logger.error(errorMessage, e);
54
//        }
55
    }
56

    
57

    
58
    /* (non-Javadoc)
59
     * @see org.eclipse.ui.IEditorInput#getName()
60
     */
61
    @Override
62
    public String getName() {
63
        return "[GBIF] " + query.toString();
64
    }
65

    
66
    /* (non-Javadoc)
67
     * @see org.eclipse.ui.IEditorInput#getToolTipText()
68
     */
69
    @Override
70
    public String getToolTipText() {
71
        return "[GBIF] " + query.toString();
72
    }
73

    
74
    /* (non-Javadoc)
75
     * @see java.lang.Object#hashCode()
76
     */
77
    @Override
78
    public int hashCode() {
79
        final int prime = 31;
80
        int result = 1;
81
        result = prime * result + ((query == null) ? 0 : query.hashCode());
82
        return result;
83
    }
84

    
85
    /* (non-Javadoc)
86
     * @see java.lang.Object#equals(java.lang.Object)
87
     */
88
    @Override
89
    public boolean equals(Object obj) {
90
        if (this == obj) {
91
            return true;
92
        }
93
        if (obj == null) {
94
            return false;
95
        }
96
        if (getClass() != obj.getClass()) {
97
            return false;
98
        }
99
        GbifImportEditorInput other = (GbifImportEditorInput) obj;
100
        if (query == null) {
101
            if (other.query != null) {
102
                return false;
103
            }
104
        } else if (!query.equals(other.query)) {
105
            return false;
106
        }
107
        return true;
108
    }
109

    
110
}
(5-5/12)