2 * Copyright (C) 2013 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.view
.dataimport
.e4
;
11 import java
.net
.MalformedURLException
;
13 import java
.net
.URISyntaxException
;
16 import javax
.inject
.Inject
;
18 import org
.eclipse
.jface
.wizard
.WizardPage
;
19 import org
.eclipse
.swt
.widgets
.Composite
;
21 import eu
.etaxonomy
.cdm
.ext
.common
.ServiceWrapperBase
;
22 import eu
.etaxonomy
.cdm
.ext
.occurrence
.bioCase
.BioCaseQueryServiceWrapper
;
23 import eu
.etaxonomy
.taxeditor
.view
.dataimport
.QueryType
;
24 import eu
.etaxonomy
.taxeditor
.view
.specimenSearch
.SpecimenProviderSelectionController
;
28 * Wizard page for selecting the specimen provider
33 public class SpecimenProviderSelectionWizardPageE4
extends WizardPage
{
35 private SpecimenProviderSelectionController specimenProviderSelectionController
;
37 private ServiceWrapperBase serviceWrapper
;
40 public SpecimenProviderSelectionWizardPageE4() {
41 super("Select specimen provider");
42 setTitle("Select Specimen Provider");
43 setDescription("Select the provider to query for specimens.\nTo query a BioCASE " +
44 "provider the access point URL must be entered.");
48 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
51 public void createControl(Composite parent
) {
52 specimenProviderSelectionController
= SpecimenProviderSelectionController
.getInstance(parent
, getWizard());
53 setControl(specimenProviderSelectionController
.getComposite());
54 //serviceWrapper = new BioCaseQueryServiceWrapper();
58 public QueryType
getQueryType(){
59 if(specimenProviderSelectionController
.getComposite().getBtnBioCaseProvider().getSelection()){
60 return QueryType
.BIOCASE
;
62 else {// if(specimenProviderSelectionController.getComposite().getBtnGbif().getSelection()){
63 return QueryType
.GBIF
;
69 * @throws URISyntaxException
71 public URI
getEndPoint() {
76 * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
79 public boolean isPageComplete() {
80 if(specimenProviderSelectionController
.getComposite().getBtnBioCaseProvider().getSelection()){
83 endPoint
= new URL(specimenProviderSelectionController
.getComposite().getTxtAccessPoint().getText()).toURI();
84 serviceWrapper
= new BioCaseQueryServiceWrapper();
85 serviceWrapper
.setBaseUrl(specimenProviderSelectionController
.getComposite().getTxtAccessPoint().getText());
86 this.setErrorMessage(null);
88 } catch (MalformedURLException e
) {
89 setErrorMessage("A valid URL has to be entered.");
91 } catch (URISyntaxException e
) {
92 setErrorMessage("A valid URL has to be entered.");
96 else if(specimenProviderSelectionController
.getComposite().getBtnGbif().getSelection()){
97 this.setErrorMessage(null);
104 * @return the bioCaseQueryServiceWrapper
106 public ServiceWrapperBase
getQueryServiceWrapper() {
107 return serviceWrapper
;
111 * @param bioCaseQueryServiceWrapper the bioCaseQueryServiceWrapper to set
113 public void setQueryServiceWrapper(ServiceWrapperBase queryServiceWrapper
) {
114 this.serviceWrapper
= queryServiceWrapper
;
120 public SpecimenProviderSelectionController
getController() {
121 return specimenProviderSelectionController
;