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
.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
.DerivedUnit
;
17 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
18 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
19 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.DerivedUnitBaseWizardPage
;
20 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.FieldObservationWizardPage
;
21 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GatheringEventWizardPage
;
22 import eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.GeneralWizardPage
;
25 * <p>NewDerivedUnitBaseWizard class.</p>
28 * @created Jun 16, 2010
31 public class NewDerivedUnitBaseWizard
extends AbstractNewEntityWizard
<DerivedUnit
> {
35 public void addPages() {
36 addPage(new GeneralWizardPage(formFactory
, getConversationHolder(), getFacade()));
37 addPage(new GatheringEventWizardPage(formFactory
, getConversationHolder(), getFacade()));
38 addPage(new FieldObservationWizardPage(formFactory
, getConversationHolder(), getFacade()));
39 addPage(new DerivedUnitBaseWizardPage(formFactory
, getConversationHolder(), getFacade()));
45 private DerivedUnitFacade
getFacade() {
47 return DerivedUnitFacade
.NewInstance(getEntity(), PreferencesUtil
.getDerivedUnitConfigurator());
48 } catch (DerivedUnitFacadeNotSupportedException e
) {
49 // w should never get here
50 throw new IllegalStateException();
55 * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#createNewEntity()
59 protected DerivedUnit
createNewEntity() {
60 // TODO we do want to create different derivates of DerivedUnitBase but go with specimen for testing
62 // FIXME add wizard page that handles the selection of derived unit type
64 return DerivedUnit
.NewInstance();
68 * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
72 protected void saveEntity() {
73 CdmStore
.getService(IOccurrenceService
.class).saveOrUpdate(getEntity());
77 protected String
getEntityName() {