Fixes an issue with derived unit editing where the editor was using deprecated interf...
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / user / operation / CreateUserOperation.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.operation;
12
13 import org.eclipse.core.commands.ExecutionException;
14 import org.eclipse.core.commands.operations.IUndoContext;
15 import org.eclipse.core.runtime.IAdaptable;
16 import org.eclipse.core.runtime.IProgressMonitor;
17 import org.eclipse.core.runtime.IStatus;
18
19 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
20 import eu.etaxonomy.cdm.api.service.IUserService;
21 import eu.etaxonomy.cdm.model.common.User;
22 import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
23 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
24 import eu.etaxonomy.taxeditor.store.CdmStore;
25
26 /**
27 * <p>CreateUserOperation class.</p>
28 *
29 * @author n.hoffmann
30 * @created Jan 19, 2010
31 * @version 1.0
32 */
33 public class CreateUserOperation extends AbstractPersistentPostOperation {
34
35 private User user;
36
37 /**
38 * <p>Constructor for CreateUserOperation.</p>
39 *
40 * @param label a {@link java.lang.String} object.
41 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
42 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
43 * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
44 * @param user a {@link eu.etaxonomy.cdm.model.common.User} object.
45 */
46 public CreateUserOperation(String label, IUndoContext undoContext, User user,
47 IPostOperationEnabled postOperationEnabled,
48 IConversationEnabled conversationEnabled) {
49 super(label, undoContext, postOperationEnabled, conversationEnabled);
50 this.user = user;
51 }
52
53 /* (non-Javadoc)
54 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
55 */
56 /** {@inheritDoc} */
57 @Override
58 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
59 throws ExecutionException {
60 bind();
61 monitor.worked(20);
62 CdmStore.getService(IUserService.class).createUser(user);
63 monitor.worked(40);
64
65 return postExecute(null);
66 }
67
68 /* (non-Javadoc)
69 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
70 */
71 /** {@inheritDoc} */
72 @Override
73 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
74 throws ExecutionException {
75 // TODO Auto-generated method stub
76 return null;
77 }
78
79 /* (non-Javadoc)
80 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
81 */
82 /** {@inheritDoc} */
83 @Override
84 public IStatus undo(IProgressMonitor monitor, IAdaptable info)
85 throws ExecutionException {
86 // TODO Auto-generated method stub
87 return null;
88 }
89 }