Merge branch 'release/4.1.0'
[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 /** {@inheritDoc} */
29 @Override
30 public void addPages() {
31 addPage(new TaxonWizardPage(formFactory, getConversationHolder(), getEntity()));
32 addPage(new NonViralNameWizardPage(formFactory, getConversationHolder(), (NonViralName) getEntity().getName()));
33 }
34
35 /** {@inheritDoc} */
36 @Override
37 protected Taxon createNewEntity() {
38 return Taxon.NewInstance(NonViralName.NewInstance(null), null);
39 }
40
41 /** {@inheritDoc} */
42 @Override
43 protected void saveEntity() {
44 CdmStore.getService(ITaxonService.class).save(getEntity());
45 }
46
47 /** {@inheritDoc} */
48 @Override
49 public void setEntity(Taxon entity) {
50 super.setEntity(entity);
51 }
52
53 @Override
54 protected String getEntityName() {
55 return "Taxon";
56 }
57 }