2b0e0d2e58e0ecc5a6dc26cbeff119f57c6aa63b
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / io / wizard / specimenSearch / SpecimenSearchWizard.java
1 // $Id$
2 /**
3 * Copyright (C) 2013 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.io.wizard.specimenSearch;
11
12 import java.io.IOException;
13 import java.net.URISyntaxException;
14 import java.util.ArrayList;
15 import java.util.List;
16
17 import org.apache.http.client.ClientProtocolException;
18 import org.eclipse.jface.viewers.IStructuredSelection;
19 import org.eclipse.jface.wizard.Wizard;
20 import org.eclipse.ui.IImportWizard;
21 import org.eclipse.ui.IWorkbench;
22
23 import eu.etaxonomy.cdm.ext.biocase.BioCaseQuery;
24 import eu.etaxonomy.cdm.ext.biocase.BioCaseQueryServiceWrapper;
25 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
26
27 /**
28 * @author pplitzner
29 * @date 11.09.2013
30 *
31 */
32 public class SpecimenSearchWizard extends Wizard implements IImportWizard {
33
34 private BioCaseQueryServiceWrapper bioCaseQueryServiceWrapper;
35 private BioCaseQuery query;
36 private List<SpecimenOrObservationBase> results;
37
38 /**
39 *
40 */
41 public SpecimenSearchWizard() {
42 query = new BioCaseQuery();
43 bioCaseQueryServiceWrapper = new BioCaseQueryServiceWrapper();
44 this.results = new ArrayList<SpecimenOrObservationBase>();
45 }
46
47
48 /* (non-Javadoc)
49 * @see org.eclipse.jface.wizard.Wizard#performFinish()
50 */
51 @Override
52 public boolean performFinish() {
53 return false;
54 }
55
56 /* (non-Javadoc)
57 * @see org.eclipse.jface.wizard.Wizard#addPages()
58 */
59 @Override
60 public void addPages() {
61 addPage(new SpecimenSearchWizardPage("Specimen Search", results));
62 addPage(new SpecimenSearchResultWizardPage("Search Results", results));
63 }
64
65 public List<SpecimenOrObservationBase> getResults(){
66 try {
67 return bioCaseQueryServiceWrapper.query(query);
68 } catch (ClientProtocolException e) {
69 // TODO Auto-generated catch block
70 e.printStackTrace();
71 } catch (IOException e) {
72 // TODO Auto-generated catch block
73 e.printStackTrace();
74 } catch (URISyntaxException e) {
75 // TODO Auto-generated catch block
76 e.printStackTrace();
77 }
78 return null;
79 }
80
81 /* (non-Javadoc)
82 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
83 */
84 @Override
85 public void init(IWorkbench workbench, IStructuredSelection selection) {
86 }
87
88 /**
89 * @return the query
90 */
91 public BioCaseQuery getQuery() {
92 return query;
93 }
94
95 }