Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
AbstractCommand |
|
| 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 | ||
14 | /** | |
15 | * Abstract command implementation. | |
16 | * @since 0.1.0 | |
17 | */ | |
18 | public abstract class AbstractCommand | |
19 | implements Command | |
20 | { | |
21 | ||
22 | //---- State | |
23 | ||
24 | /** | |
25 | * The name of this command. | |
26 | * @since 0.1.0 | |
27 | */ | |
28 | private final String name; | |
29 | ||
30 | //---- Constructors | |
31 | ||
32 | /** | |
33 | * Creates an abstract command with the specified name. | |
34 | * @param name the name of this command. | |
35 | * @since 0.1.0 | |
36 | */ | |
37 | 72 | protected AbstractCommand (String name) { |
38 | 72 | this.name = name; |
39 | 72 | } |
40 | ||
41 | //---- Command | |
42 | ||
43 | /** | |
44 | * @since 0.1.0 | |
45 | */ | |
46 | public final String getName () { | |
47 | 30 | return this.name; |
48 | } | |
49 | ||
50 | /** | |
51 | * @since 0.1.0 | |
52 | */ | |
53 | public abstract void execute (PolicyBean policy) throws Exception; | |
54 | ||
55 | /** | |
56 | * @since 0.1.0 | |
57 | */ | |
58 | public abstract void undo (PolicyBean policy) throws Exception; | |
59 | ||
60 | } |