Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
TargetRemoveCommand |
|
| 1.5;1.5 |
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 java.util.List; | |
13 | ||
14 | import org.openpermis.policy.bean.PolicyBean; | |
15 | import org.openpermis.policy.bean.TargetAccessRuleBean; | |
16 | import org.openpermis.policy.bean.TargetBean; | |
17 | ||
18 | ||
19 | /** | |
20 | * Command that deletes a target allover the model. | |
21 | * @since 0.1.0 | |
22 | */ | |
23 | public class TargetRemoveCommand extends PartRemoveCommand<TargetBean> | |
24 | { | |
25 | //---- Constructors | |
26 | ||
27 | /** | |
28 | * Creates a command. | |
29 | * @param target the target to modify, must not be {@code null}. | |
30 | * @since 0.1.0 | |
31 | */ | |
32 | public TargetRemoveCommand (TargetBean target) { | |
33 | 0 | super(target); |
34 | 0 | } |
35 | ||
36 | //---- Methods | |
37 | ||
38 | /** | |
39 | * @since 0.1.0 | |
40 | */ | |
41 | public void removePart (PolicyBean policyBean, boolean doExec) { | |
42 | 0 | List<TargetAccessRuleBean> parents = policyBean.getParentTargetAccessRules(this.getPart()); |
43 | 0 | for (final TargetAccessRuleBean currRule : parents) { |
44 | 0 | currRule.removeTarget(this.getPart()); |
45 | } | |
46 | 0 | } |
47 | ||
48 | ||
49 | } |