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.INameService;
|
14
|
import eu.etaxonomy.cdm.model.name.BotanicalName;
|
15
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
16
|
import eu.etaxonomy.cdm.model.name.NonViralName;
|
17
|
import eu.etaxonomy.cdm.model.name.ZoologicalName;
|
18
|
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
19
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
20
|
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameWizardPage;
|
21
|
|
22
|
/**
|
23
|
* <p>NewNonViralNameWizard class.</p>
|
24
|
*
|
25
|
* @author n.hoffmann
|
26
|
* @created Jun 1, 2010
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class NewNonViralNameWizard extends AbstractNewEntityWizard<NonViralName> {
|
30
|
|
31
|
/** {@inheritDoc} */
|
32
|
@Override
|
33
|
public void addPages() {
|
34
|
addPage(new NonViralNameWizardPage(formFactory, getConversationHolder(), getEntity()));
|
35
|
}
|
36
|
|
37
|
/** {@inheritDoc} */
|
38
|
@Override
|
39
|
protected NonViralName createNewEntity() {
|
40
|
NomenclaturalCode code = PreferencesUtil.getPreferredNomenclaturalCode();
|
41
|
if(code.equals(NomenclaturalCode.ICNAFP )){
|
42
|
return BotanicalName.NewInstance(null);
|
43
|
}else if(code.equals(NomenclaturalCode.ICZN)){
|
44
|
return ZoologicalName.NewInstance(null);
|
45
|
}
|
46
|
return null;
|
47
|
}
|
48
|
|
49
|
/** {@inheritDoc} */
|
50
|
@Override
|
51
|
protected void saveEntity() {
|
52
|
if(CdmStore.getCurrentSessionManager().isRemoting()) {
|
53
|
CdmStore.getService(INameService.class).merge(getEntity(), true);
|
54
|
} else {
|
55
|
CdmStore.getService(INameService.class).save(getEntity());
|
56
|
}
|
57
|
}
|
58
|
|
59
|
@Override
|
60
|
protected String getEntityName() {
|
61
|
return "Scientific Name";
|
62
|
}
|
63
|
}
|