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.editor.newWizard;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.name.BotanicalName;
|
16
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
17
|
import eu.etaxonomy.cdm.model.name.NonViralName;
|
18
|
import eu.etaxonomy.cdm.model.name.ZoologicalName;
|
19
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
20
|
import eu.etaxonomy.taxeditor.section.name.NonViralNameWizardPage;
|
21
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
22
|
|
23
|
/**
|
24
|
* @author n.hoffmann
|
25
|
* @created Jun 1, 2010
|
26
|
* @version 1.0
|
27
|
*/
|
28
|
public class NewNonViralNameWizard extends AbstractNewEntityWizard<NonViralName> {
|
29
|
private static final Logger logger = Logger
|
30
|
.getLogger(NewNonViralNameWizard.class);
|
31
|
|
32
|
@Override
|
33
|
public void addPages() {
|
34
|
addPage(new NonViralNameWizardPage(formFactory, getConversationHolder(), entity));
|
35
|
}
|
36
|
|
37
|
@Override
|
38
|
protected NonViralName createNewEntity() {
|
39
|
NomenclaturalCode code = PreferencesUtil.getPreferredNomenclaturalCode();
|
40
|
if(code.equals(NomenclaturalCode.ICBN)){
|
41
|
return BotanicalName.NewInstance(null);
|
42
|
}else if(code.equals(NomenclaturalCode.ICZN)){
|
43
|
return ZoologicalName.NewInstance(null);
|
44
|
}
|
45
|
return null;
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
protected void saveEntity() {
|
50
|
CdmStore.getNameService().saveOrUpdate(entity);
|
51
|
}
|
52
|
}
|