Project

General

Profile

Download (3.29 KB) Statistics
| Branch: | Tag: | Revision:
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.io.InputStream;
13
import java.net.URISyntaxException;
14
import java.util.ArrayList;
15
import java.util.Collection;
16
import java.util.Comparator;
17
import java.util.HashSet;
18
import java.util.Set;
19

    
20
import org.apache.http.client.ClientProtocolException;
21
import org.eclipse.core.runtime.jobs.Job;
22

    
23
import eu.etaxonomy.cdm.ext.occurrence.bioCase.BioCaseQueryServiceWrapper;
24
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifDataSetProtocol;
25
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifQueryServiceWrapper;
26
import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
27
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
28
import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
29
import eu.etaxonomy.cdm.io.dwca.in.DwcaImportConfigurator;
30
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
31
import eu.etaxonomy.taxeditor.store.CdmStore;
32

    
33
/**
34
 * @author pplitzner
35
 * @date Sep 5, 2014
36
 *
37
 */
38
public class GbifResponseImportView extends DataImportView<GbifResponse> {
39

    
40

    
41
    public static final String ID = "eu.etaxonomy.taxeditor.view.dataimport.GbifResponseImportView";
42

    
43
    /* (non-Javadoc)
44
     * @see eu.etaxonomy.taxeditor.view.dataimport.DataImportView#getTextForTableItem(java.lang.Object)
45
     */
46
    @Override
47
    protected String getTextForTableItem(GbifResponse item) {
48
        String text = "";
49
        if(item.getDataSetProtocol()!=null){
50
            text += "["+item.getDataSetProtocol()+"] ";
51
        }
52
        text += item.getDerivedUnitFacade().innerDerivedUnit().generateTitle();
53
        return text;
54
    }
55

    
56
    /* (non-Javadoc)
57
     * @see eu.etaxonomy.taxeditor.view.dataimport.DataImportView#query()
58
     */
59
    @Override
60
    public void query() {
61
        String errorMessage = "Could not execute query " + query;
62
        try{
63
            //Collection<GbifResponse> results = new GbifQueryServiceWrapper().query(query);
64
            //setResults(results);
65
            
66
           // String errorMessage = "Could not execute query " + query;
67

    
68
       //     Collection<SpecimenOrObservationBase<?>> results = new ArrayList<SpecimenOrObservationBase<?>>();
69
                Collection<GbifResponse> results = new GbifQueryServiceWrapper().query(query);
70
                               
71
                setResults(results);
72
               
73
               
74
//               
75
               // results = repo.getUnits();
76
                
77
            } catch (ClientProtocolException e) {
78
                logger.error(errorMessage, e);
79
            } catch (IOException e) {
80
                logger.error(errorMessage, e);
81
            } catch (URISyntaxException e) {
82
				// TODO Auto-generated catch block
83
				e.printStackTrace();
84
			}
85
        }
86

    
87
//            setResults(results);
88
//
89
//        }
90
//        } catch (ClientProtocolException e) {
91
//            logger.error(errorMessage, e);
92
//        } catch (IOException e) {
93
//            logger.error(errorMessage, e);
94
//        } catch (URISyntaxException e) {
95
//            logger.error(errorMessage, e);
96
//        }
97

    
98
  //  }
99
    
100
   
101
    
102

    
103
	
104

    
105
}
(9-9/16)