Project

General

Profile

Download (2.08 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.application.CdmApplicationState;
13
import eu.etaxonomy.cdm.api.application.CdmChangeEvent;
14
import eu.etaxonomy.cdm.api.application.CdmChangeEvent.Action;
15
import eu.etaxonomy.cdm.api.service.IClassificationService;
16
import eu.etaxonomy.cdm.model.taxon.Classification;
17
import eu.etaxonomy.taxeditor.store.CdmStore;
18
import eu.etaxonomy.taxeditor.ui.section.classification.ClassificationWizardPage;
19

    
20
/**
21
 * <p>ClassificationWizard class.</p>
22
 *
23
 * @author n.hoffmann
24
 * @created 23.06.2009
25
 * @version 1.0
26
 */
27

    
28
public class NewClassificationWizard extends AbstractNewEntityWizard<Classification> {
29

    
30
	private ClassificationWizardPage classificationWizardPage;
31

    
32
	/* (non-Javadoc)
33
	 * @see eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard#setEntity(java.lang.Object)
34
	 */
35
	@Override
36
	public void setEntity(Classification entity) {
37
		setWindowTitle(String.format("Edit %s", getEntityName()));
38
		entity = CdmStore.getService(IClassificationService.class).load(entity.getUuid());
39
		super.setEntity(entity);
40
	}
41

    
42
	@Override
43
	public void addPages() {
44
		classificationWizardPage = new ClassificationWizardPage(formFactory, getConversationHolder(), getEntity());
45
		addPage(classificationWizardPage);
46
	}
47

    
48
	@Override
49
	protected void saveEntity() {
50
		//CdmStore.getService(IClassificationService.class).saveOrUpdate(getEntity());
51
	    Classification classification = getEntity();
52
	   CdmStore.getService(IClassificationService.class).merge(getEntity(), true);
53
	   CdmApplicationState.getCurrentDataChangeService()
54
	        .fireChangeEvent(new CdmChangeEvent(Action.Create, classification, NewTaxonNodeWizard.class), true);
55

    
56

    
57
	}
58

    
59
	@Override
60
	protected Classification createNewEntity() {
61
		return Classification.NewInstance(null);
62
	}
63

    
64
	@Override
65
	protected String getEntityName() {
66
		return "Classification";
67
	}
68
}
(6-6/27)