Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PoolRemoveCommand |
|
| 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 org.openpermis.editor.policy.presenter.PolicyPartPool; | |
13 | import org.openpermis.policy.bean.PartBean; | |
14 | ||
15 | ||
16 | /** | |
17 | * Command to edit a part. | |
18 | * @param <P> the current beantype | |
19 | * @since 0.1.0 | |
20 | */ | |
21 | public class PoolRemoveCommand<P extends PartBean> extends PoolChangeCommand<P> | |
22 | { | |
23 | //---- Constructors | |
24 | ||
25 | /** | |
26 | * Creates a new command. * | |
27 | * @param pool pool to be changed | |
28 | * @param elementBean bean to operate on | |
29 | * @since 0.1.0 | |
30 | */ | |
31 | public PoolRemoveCommand (PolicyPartPool<P> pool, P elementBean) { | |
32 | 0 | super(pool, elementBean); |
33 | 0 | } |
34 | ||
35 | //---- Methods | |
36 | ||
37 | /** | |
38 | * @param doExec wether to "exec" or to "undo" | |
39 | * @since 0.1.0 | |
40 | */ | |
41 | public void operateElement (boolean doExec) { | |
42 | 0 | if (doExec) { |
43 | 0 | this.getPool().getPoolList().remove(this.getElementBean()); |
44 | } else { | |
45 | 0 | this.getPool().getPoolList().add(this.getElementBean()); |
46 | } | |
47 | 0 | } |
48 | ||
49 | } |