Project

General

Profile

Download (1.62 KB) Statistics
| Branch: | Tag: | Revision:
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.INonViralName;
14
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
15
import eu.etaxonomy.cdm.model.name.TaxonName;
16
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
17
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
18
import eu.etaxonomy.taxeditor.store.CdmStore;
19
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameWizardPage;
20

    
21
/**
22
 * <p>NewNonViralNameWizard class.</p>
23
 *
24
 * @author n.hoffmann
25
 * @created Jun 1, 2010
26
 */
27
public class NewNonViralNameWizard extends AbstractNewEntityWizard<TaxonName> {
28

    
29
	/** {@inheritDoc} */
30
	@Override
31
	public void addPages() {
32
		addPage(new NonViralNameWizardPage(formFactory, getConversationHolder(), getEntity()));
33
	}
34

    
35
	/** {@inheritDoc} */
36
	@Override
37
	protected TaxonName createNewEntity() {
38
		NomenclaturalCode code = PreferencesUtil.getPreferredNomenclaturalCode();
39
		if(code.equals(NomenclaturalCode.ICNAFP )){
40
			return TaxonNameFactory.NewBotanicalInstance(null);
41
		}else if(code.equals(NomenclaturalCode.ICZN)){
42
			return TaxonNameFactory.NewZoologicalInstance(null);
43
		}
44
		return null;
45
	}
46

    
47
	/** {@inheritDoc} */
48
	@Override
49
	protected void saveEntity() {
50
	   CdmStore.getService(INameService.class).merge(getEntity(), true);
51
	}
52

    
53
	@Override
54
	protected String getEntityName() {
55
		return "Scientific Name";
56
	}
57
}
(15-15/27)