1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.newWizard;
|
11
|
|
12
|
import eu.etaxonomy.cdm.api.service.INameService;
|
13
|
import eu.etaxonomy.cdm.model.name.BotanicalName;
|
14
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
15
|
import eu.etaxonomy.cdm.model.name.NonViralName;
|
16
|
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
17
|
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
|
18
|
import eu.etaxonomy.cdm.model.name.ZoologicalName;
|
19
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
20
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
21
|
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameWizardPage;
|
22
|
|
23
|
/**
|
24
|
* <p>NewNonViralNameWizard class.</p>
|
25
|
*
|
26
|
* @author n.hoffmann
|
27
|
* @created Jun 1, 2010
|
28
|
* @version 1.0
|
29
|
*/
|
30
|
public class NewNonViralNameWizard extends AbstractNewEntityWizard<NonViralName> {
|
31
|
|
32
|
/** {@inheritDoc} */
|
33
|
@Override
|
34
|
public void addPages() {
|
35
|
addPage(new NonViralNameWizardPage(formFactory, getConversationHolder(), getEntity()));
|
36
|
}
|
37
|
|
38
|
/** {@inheritDoc} */
|
39
|
@Override
|
40
|
protected NonViralName createNewEntity() {
|
41
|
NomenclaturalCode code = PreferencesUtil.getPreferredNomenclaturalCode();
|
42
|
if(code.equals(NomenclaturalCode.ICNAFP )){
|
43
|
return TaxonNameFactory.NewBotanicalInstance(null);
|
44
|
}else if(code.equals(NomenclaturalCode.ICZN)){
|
45
|
return TaxonNameFactory.NewZoologicalInstance(null);
|
46
|
}
|
47
|
return null;
|
48
|
}
|
49
|
|
50
|
/** {@inheritDoc} */
|
51
|
@Override
|
52
|
protected void saveEntity() {
|
53
|
CdmStore.getService(INameService.class).merge(getEntity(), true);
|
54
|
}
|
55
|
|
56
|
@Override
|
57
|
protected String getEntityName() {
|
58
|
return "Scientific Name";
|
59
|
}
|
60
|
}
|