merge
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / newWizard / NewInstitutionWizard.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.IAgentService;
14 import eu.etaxonomy.cdm.model.agent.Institution;
15 import eu.etaxonomy.taxeditor.store.CdmStore;
16 import eu.etaxonomy.taxeditor.ui.section.agent.InstitutionWizardPage;
17
18 /**
19 * @author n.hoffmann
20 * @created Dec 15, 2010
21 * @version 1.0
22 */
23 public class NewInstitutionWizard extends AbstractNewEntityWizard<Institution> {
24
25 /* (non-Javadoc)
26 * @see org.eclipse.jface.wizard.Wizard#addPages()
27 */
28 @Override
29 public void addPages() {
30 addPage(new InstitutionWizardPage(formFactory, getConversationHolder(), getEntity()));
31 }
32
33 /* (non-Javadoc)
34 * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#saveEntity()
35 */
36 @Override
37 protected void saveEntity() {
38 if(CdmStore.getCurrentSessionManager().isRemoting()) {
39 CdmStore.getService(IAgentService.class).merge(getEntity(), true);
40 } else {
41 CdmStore.getService(IAgentService.class).save(getEntity());
42 }
43 }
44
45 /* (non-Javadoc)
46 * @see eu.etaxonomy.taxeditor.editor.newWizard.AbstractNewEntityWizard#createNewEntity()
47 */
48 @Override
49 protected Institution createNewEntity() {
50 return Institution.NewInstance();
51 }
52
53 @Override
54 protected String getEntityName() {
55 return "Institution";
56 }
57
58 }