Project

General

Profile

« Previous | Next » 

Revision 3ee20195

Added by Patrick Plitzner over 10 years ago

  • moved actual query execution from the wizard to the editor

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/dataimport/wizard/SpecimenSearchWizard.java
9 9
*/
10 10
package eu.etaxonomy.taxeditor.dataimport.wizard;
11 11

  
12
import java.io.IOException;
13
import java.net.URISyntaxException;
14
import java.util.List;
15

  
16
import org.apache.http.client.ClientProtocolException;
17 12
import org.apache.log4j.Logger;
18 13
import org.eclipse.jface.viewers.IStructuredSelection;
19 14
import org.eclipse.jface.wizard.Wizard;
......
24 19
import org.eclipse.ui.PlatformUI;
25 20

  
26 21
import eu.etaxonomy.cdm.ext.biocase.BioCaseQuery;
27
import eu.etaxonomy.cdm.ext.biocase.BioCaseQueryServiceWrapper;
28
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
29 22
import eu.etaxonomy.taxeditor.dataimport.DataImportEditor;
30
import eu.etaxonomy.taxeditor.dataimport.SpecimenEditorInput;
23
import eu.etaxonomy.taxeditor.dataimport.DataImportSpecimenEditorInput;
31 24

  
32 25
/**
33 26
 * @author pplitzner
......
35 28
 *
36 29
 */
37 30
public class SpecimenSearchWizard extends Wizard implements IImportWizard {
31
    @SuppressWarnings("unused")
38 32
    private static final Logger logger = Logger.getLogger(SpecimenSearchWizard.class);
39 33

  
40
    private BioCaseQueryServiceWrapper bioCaseQueryServiceWrapper;
41 34
    private BioCaseQuery query;
42
    private List<SpecimenOrObservationBase> results;
43 35

  
44 36
    /**
45
     *
37
     * Creates a new SpecimenSearchWizard
46 38
     */
47 39
    public SpecimenSearchWizard() {
48
        query = new BioCaseQuery();
49
        bioCaseQueryServiceWrapper = new BioCaseQueryServiceWrapper();
50
        this.results = getResults();
40
        //default constructor needed for RCP extension points
51 41
    }
52 42

  
53 43

  
......
59 49
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
60 50

  
61 51
        try {
62
            SpecimenEditorInput input = new SpecimenEditorInput(results);
52
            DataImportSpecimenEditorInput input = new DataImportSpecimenEditorInput(query);
63 53
            input.getToolTipText();
64 54
            page.openEditor(input, DataImportEditor.ID, true);
65 55
        } catch ( PartInitException e ) {
......
73 63
     */
74 64
    @Override
75 65
    public void addPages() {
76
        addPage(new SpecimenSearchWizardPage("Specimen Search", results));
77
    }
78

  
79
    public List<SpecimenOrObservationBase> getResults(){
80
        try {
81
            return bioCaseQueryServiceWrapper.query(query);
82
        } catch (ClientProtocolException e) {
83
            // TODO Auto-generated catch block
84
            e.printStackTrace();
85
        } catch (IOException e) {
86
            // TODO Auto-generated catch block
87
            e.printStackTrace();
88
        } catch (URISyntaxException e) {
89
            // TODO Auto-generated catch block
90
            e.printStackTrace();
91
        }
92
        return null;
66
        addPage(new SpecimenSearchWizardPage("Specimen Search"));
93 67
    }
94 68

  
95 69
    /* (non-Javadoc)
......
97 71
     */
98 72
    @Override
99 73
    public void init(IWorkbench workbench, IStructuredSelection selection) {
74
        query = new BioCaseQuery();
100 75
    }
101 76

  
102 77
    /**

Also available in: Unified diff