]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.security.ui.admin/src/org/argeo/security/ui/admin/commands/UserBatchUpdate.java
Remove JcrSecurityModel from supported APIs
[lgpl/argeo-commons.git] / org.argeo.security.ui.admin / src / org / argeo / security / ui / admin / commands / UserBatchUpdate.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16 package org.argeo.security.ui.admin.commands;
17
18 import javax.jcr.Repository;
19 import javax.jcr.Session;
20
21 import org.argeo.jcr.JcrUtils;
22 import org.argeo.security.UserAdminService;
23 import org.argeo.security.ui.admin.wizards.UserBatchUpdateWizard;
24 import org.eclipse.core.commands.AbstractHandler;
25 import org.eclipse.core.commands.ExecutionEvent;
26 import org.eclipse.core.commands.ExecutionException;
27 import org.eclipse.jface.wizard.WizardDialog;
28 import org.eclipse.ui.handlers.HandlerUtil;
29
30 /** Launch a wizard to update various properties about users in JCR. */
31 public class UserBatchUpdate extends AbstractHandler {
32 private Repository repository;
33 private UserAdminService userAdminService;
34
35 public Object execute(ExecutionEvent event) throws ExecutionException {
36 Session session = null;
37 try {
38 session = repository.login();
39 UserBatchUpdateWizard userBatchUpdateWizard = new UserBatchUpdateWizard(
40 session, userAdminService);
41 WizardDialog dialog = new WizardDialog(
42 HandlerUtil.getActiveShell(event), userBatchUpdateWizard);
43 dialog.open();
44 } catch (Exception e) {
45 throw new ExecutionException("Cannot open wizard", e);
46 } finally {
47 JcrUtils.logoutQuietly(session);
48 }
49 return null;
50 }
51
52 public void setRepository(Repository repository) {
53 this.repository = repository;
54 }
55
56 public void setUserAdminService(UserAdminService userAdminService) {
57 this.userAdminService = userAdminService;
58 }
59
60 // public void setJcrSecurityModel(JcrSecurityModel jcrSecurityModel) {
61 // this.jcrSecurityModel = jcrSecurityModel;
62 // }
63
64 }