5e2e4974e029b82ca65d3f6d6752ef624a5e3db2
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / user / wizard / UserWizard.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.user.wizard;
12
13 import org.apache.log4j.Logger;
14 import org.eclipse.jface.wizard.Wizard;
15
16 import eu.etaxonomy.cdm.model.common.User;
17 import eu.etaxonomy.taxeditor.store.CdmStore;
18 import eu.etaxonomy.taxeditor.user.view.UserManagerView;
19
20 /**
21 * @author n.hoffmann
22 * @created 02.07.2009
23 * @version 1.0
24 */
25 public class UserWizard extends Wizard {
26 private static final Logger logger = Logger.getLogger(UserWizard.class);
27 private User user;
28 private UserWizardPage page;
29 private UserManagerView view;
30
31 public UserWizard(UserManagerView view){
32 this.view = view;
33 setWindowTitle("User Wizard");
34 }
35
36 public UserWizard(UserManagerView view, User user){
37 this(view);
38 this.user = user;
39 }
40
41 /* (non-Javadoc)
42 * @see org.eclipse.jface.wizard.Wizard#addPages()
43 */
44 @Override
45 public void addPages() {
46 super.addPages();
47
48 page = new UserWizardPage(user);
49
50 addPage(page);
51
52 }
53
54 /* (non-Javadoc)
55 * @see org.eclipse.jface.wizard.Wizard#performFinish()
56 */
57 @Override
58 public boolean performFinish() {
59
60 CdmStore.getUserService().saveOrUpdate(page.getUser());
61 view.getConversationHolder().commit(true);
62
63 return view.postOperation(user);
64 }
65
66 }