1947c452fc8605984f61a867df5e05cdc26d2c1e
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / newWizard / NewTaxonWizard.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 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
11 package eu.etaxonomy.taxeditor.newWizard;
12
13 import eu.etaxonomy.cdm.api.service.ITaxonService;
14 import eu.etaxonomy.cdm.model.name.NonViralName;
15 import eu.etaxonomy.cdm.model.taxon.Taxon;
16 import eu.etaxonomy.taxeditor.store.CdmStore;
17 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameWizardPage;
18 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonWizardPage;
19
20 /**
21 *
22 * @author pplitzner
23 * @date Jan 18, 2016
24 *
25 */
26 public class NewTaxonWizard extends AbstractNewEntityWizard<Taxon> {
27
28 private TaxonWizardPage taxonWizardPage;
29
30 /** {@inheritDoc} */
31 @Override
32 public void addPages() {
33 addPage(new NonViralNameWizardPage(formFactory, getConversationHolder(), (NonViralName) getEntity().getName()));
34 taxonWizardPage = new TaxonWizardPage(formFactory, getConversationHolder(), getEntity());
35 addPage(taxonWizardPage);
36 }
37
38 /** {@inheritDoc} */
39 @Override
40 protected Taxon createNewEntity() {
41 return Taxon.NewInstance(NonViralName.NewInstance(null), null);
42 }
43
44 /** {@inheritDoc} */
45 @Override
46 protected void saveEntity() {
47 CdmStore.getService(ITaxonService.class).save(getEntity());
48 }
49
50 /** {@inheritDoc} */
51 @Override
52 public void setEntity(Taxon entity) {
53 super.setEntity(entity);
54 }
55
56 @Override
57 protected String getEntityName() {
58 return "Taxon";
59 }
60 }