Merged refactoring from development branch.
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / newWizard / NewReferenceWizard.java
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.IReferenceService;
14 import eu.etaxonomy.cdm.model.reference.Reference;
15 import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
16 import eu.etaxonomy.taxeditor.store.CdmStore;
17 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceWizardPage;
18
19 /**
20 * <p>NewReferenceWizard class.</p>
21 *
22 * @author n.hoffmann
23 * @created Jun 1, 2010
24 * @version 1.0
25 */
26 public class NewReferenceWizard extends AbstractNewEntityWizard<Reference> {
27
28 private ReferenceWizardPage referencePage;
29
30 /** {@inheritDoc} */
31 @Override
32 public void addPages() {
33 // TODO disabling external service wizard page for now
34 // addPage(new ExternalReferenceServiceWizardPage(formFactory, getConversationHolder(), entity));
35 referencePage = new ReferenceWizardPage(formFactory, getConversationHolder(), getEntity());
36 addPage(referencePage);
37 }
38
39 /** {@inheritDoc} */
40 @Override
41 protected Reference createNewEntity() {
42 return ReferenceFactory.newGeneric();
43 }
44
45 /** {@inheritDoc} */
46 @Override
47 protected void saveEntity() {
48 CdmStore.getService(IReferenceService.class).saveOrUpdate(getEntity());
49 }
50
51 /** {@inheritDoc} */
52 @Override
53 public void setEntity(Reference entity) {
54 super.setEntity(entity);
55 referencePage.getDetailElement().setEntity(entity);
56 }
57 }