3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.editor
.newWizard
;
13 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacade
;
14 import eu
.etaxonomy
.cdm
.api
.facade
.DerivedUnitFacadeNotSupportedException
;
15 import eu
.etaxonomy
.cdm
.api
.service
.IOccurrenceService
;
16 import eu
.etaxonomy
.cdm
.model
.occurrence
.DerivedUnitBase
;
17 import eu
.etaxonomy
.cdm
.model
.occurrence
.Specimen
;
18 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
19 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.DerivedUnitBaseWizardPage
;
20 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.FieldObservationWizardPage
;
21 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.GatheringEventWizardPage
;
22 import eu
.etaxonomy
.taxeditor
.section
.occurrence
.GeneralWizardPage
;
23 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
26 * <p>NewDerivedUnitBaseWizard class.</p>
29 * @created Jun 16, 2010
32 public class NewDerivedUnitBaseWizard
extends AbstractNewEntityWizard
<DerivedUnitBase
> {
37 public NewDerivedUnitBaseWizard() {
38 setWindowTitle("New Specimen");
43 public void addPages() {
44 addPage(new GeneralWizardPage(formFactory
, getConversationHolder(), getFacade()));
45 addPage(new GatheringEventWizardPage(formFactory
, getConversationHolder(), getFacade()));
46 addPage(new FieldObservationWizardPage(formFactory
, getConversationHolder(), getFacade()));
47 addPage(new DerivedUnitBaseWizardPage(formFactory
, getConversationHolder(), getFacade()));
53 private DerivedUnitFacade
getFacade() {
55 return DerivedUnitFacade
.NewInstance(getEntity(), PreferencesUtil
.getDerivedUnitConfigurator());
56 } catch (DerivedUnitFacadeNotSupportedException e
) {
57 // w should never get here
58 throw new IllegalStateException();
63 * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#createNewEntity()
67 protected DerivedUnitBase
createNewEntity() {
68 // TODO we do want to create different derivates of DerivedUnitBase but go with specimen for testing
70 // FIXME add wizard page that handles the selection of derived unit type
71 return Specimen
.NewInstance();
75 * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
79 protected void saveEntity() {
80 CdmStore
.getService(IOccurrenceService
.class).saveOrUpdate(entity
);