Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
RemoveRoleCommand |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright (c) 2009, Swiss Federal Department of Defence Civil Protection and Sport | |
3 | * (http://www.vbs.admin.ch) | |
4 | * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch) | |
5 | * All rights reserved. | |
6 | * | |
7 | * Licensed under the Open Permis License which accompanies this distribution, | |
8 | * and is available at http://www.openpermis.org/BSDlicenceKent.txt | |
9 | */ | |
10 | package org.openpermis.editor.policy.command; | |
11 | ||
12 | import org.openpermis.policy.bean.PolicyBean; | |
13 | import org.openpermis.policy.bean.RoleHierarchyBean; | |
14 | ||
15 | ||
16 | /** | |
17 | * Removes a role from the hierarchy. | |
18 | * @since 0.3.0 | |
19 | */ | |
20 | public class RemoveRoleCommand extends AbstractRoleCommand { | |
21 | ||
22 | //---- Constructors | |
23 | ||
24 | /** | |
25 | * Creates a {@link RemoveRoleCommand}. | |
26 | * @since 0.3.0 | |
27 | */ | |
28 | public RemoveRoleCommand ( | |
29 | String name, | |
30 | String roleName, | |
31 | RoleHierarchyBean roleHierarchyBean | |
32 | ) { | |
33 | 0 | super(name, roleName, roleHierarchyBean); |
34 | 0 | } |
35 | ||
36 | //---- AbstractHierarchyCommand | |
37 | ||
38 | /** | |
39 | * @since 0.3.0 | |
40 | */ | |
41 | @Override | |
42 | public void execute (PolicyBean policy) throws Exception { | |
43 | 0 | getRoleHierarchyBean().removeRole(getRoleName()); |
44 | 0 | } |
45 | ||
46 | /** | |
47 | * @since 0.3.0 | |
48 | */ | |
49 | @Override | |
50 | public void undo (PolicyBean policy) throws Exception { | |
51 | 0 | getRoleHierarchyBean().addRole(getRoleName()); |
52 | 0 | } |
53 | ||
54 | } |