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
;
20 import org
.argeo
.security
.UserAdminService
;
21 import org
.eclipse
.core
.commands
.AbstractHandler
;
22 import org
.eclipse
.core
.commands
.ExecutionEvent
;
23 import org
.eclipse
.core
.commands
.ExecutionException
;
26 * Refreshes the main user list, removing nodes which are not referenced by user
29 public class RefreshUsersList
extends AbstractHandler
{
30 private UserAdminService userAdminService
;
31 private Repository repository
;
33 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
34 // Set<String> users = userAdminService.listUsers();
35 // Session session = null;
37 // session = repository.login();
38 // Query query = session
42 // "select * from [" + ArgeoTypes.ARGEO_USER_HOME
43 // + "]", Query.JCR_SQL2);
44 // NodeIterator nit = query.execute().getNodes();
45 // while (nit.hasNext()) {
46 // Node node = nit.nextNode();
47 // String username = node.getProperty(ArgeoNames.ARGEO_USER_ID)
49 // if (!users.contains(username))
53 // } catch (RepositoryException e) {
54 // JcrUtils.discardQuietly(session);
55 // throw new ArgeoException("Cannot list users", e);
57 // JcrUtils.logoutQuietly(session);
59 // userAdminService.synchronize();
61 // // FIXME try to refresh views that extend the JcrUsersView and have
64 // IWorkbenchPart part = HandlerUtil.getActiveWorkbenchWindow(event)
65 // .getActivePage().getActivePart();
66 // if (part instanceof JcrUsersView)
67 // ((JcrUsersView) part).refresh();
69 // // Try to refresh JcrUsersView if opened
70 // JcrUsersView view = (JcrUsersView) HandlerUtil
71 // .getActiveWorkbenchWindow(event).getActivePage()
72 // .findView(JcrUsersView.ID);
79 public void setUserAdminService(UserAdminService userAdminService
) {
80 this.userAdminService
= userAdminService
;
83 public void setRepository(Repository repository
) {
84 this.repository
= repository
;