2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.security
.ui
.admin
.commands
;
18 import javax
.jcr
.Repository
;
19 import javax
.jcr
.Session
;
21 import org
.argeo
.jcr
.JcrUtils
;
22 import org
.argeo
.security
.UserAdminService
;
23 import org
.argeo
.security
.jcr
.JcrSecurityModel
;
24 import org
.argeo
.security
.ui
.admin
.wizards
.UserBatchUpdateWizard
;
25 import org
.eclipse
.core
.commands
.AbstractHandler
;
26 import org
.eclipse
.core
.commands
.ExecutionEvent
;
27 import org
.eclipse
.core
.commands
.ExecutionException
;
28 import org
.eclipse
.jface
.wizard
.WizardDialog
;
29 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
31 /** Launch a wizard to update various properties about users in JCR. */
32 public class UserBatchUpdate
extends AbstractHandler
{
33 private Repository repository
;
34 private UserAdminService userAdminService
;
35 private JcrSecurityModel jcrSecurityModel
;
37 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
38 Session session
= null;
40 session
= repository
.login();
41 UserBatchUpdateWizard userBatchUpdateWizard
= new UserBatchUpdateWizard(session
,
42 userAdminService
, jcrSecurityModel
);
43 WizardDialog dialog
= new WizardDialog(
44 HandlerUtil
.getActiveShell(event
), userBatchUpdateWizard
);
46 } catch (Exception e
) {
47 throw new ExecutionException("Cannot open wizard", e
);
49 JcrUtils
.logoutQuietly(session
);
54 public void setRepository(Repository repository
) {
55 this.repository
= repository
;
58 public void setUserAdminService(UserAdminService userAdminService
) {
59 this.userAdminService
= userAdminService
;
62 public void setJcrSecurityModel(JcrSecurityModel jcrSecurityModel
) {
63 this.jcrSecurityModel
= jcrSecurityModel
;