Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ObligationBeanOverview |
|
| 3.0;3 |
1 | /* | |
2 | * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch) | |
3 | * All rights reserved. | |
4 | * | |
5 | * Licensed under the Open Permis License which accompanies this distribution, | |
6 | * and is available at http://www.openpermis.org/BSDlicenceKent.txt | |
7 | */ | |
8 | package org.openpermis.editor.policy.adapter.overview; | |
9 | ||
10 | import org.openpermis.policy.bean.ObligationBean; | |
11 | ||
12 | ||
13 | /** | |
14 | * Describes a {@link ObligationBean} that has been adapted to a short overview string. | |
15 | * @since 0.3.0 | |
16 | */ | |
17 | 1 | public class ObligationBeanOverview implements Overview { |
18 | ||
19 | //---- Static | |
20 | ||
21 | //---- State | |
22 | ||
23 | private ObligationBean obligation; | |
24 | ||
25 | //---- Constructors | |
26 | ||
27 | /** | |
28 | * Creates a obligation bean overview adaptee. | |
29 | * @param obligation the {@link ObligationBean}. | |
30 | * @since 0.3.0 | |
31 | */ | |
32 | 2 | public ObligationBeanOverview (ObligationBean obligation) { |
33 | 2 | if (obligation == null) { |
34 | 1 | throw new IllegalArgumentException("Obligation is null."); |
35 | } | |
36 | 1 | this.obligation = obligation; |
37 | 1 | } |
38 | ||
39 | //---- Methods | |
40 | ||
41 | //---- Overview | |
42 | ||
43 | /** | |
44 | * @since 0.3.0 | |
45 | */ | |
46 | public String get () { | |
47 | 1 | if (this.obligation.getText() == null) { |
48 | 0 | return ""; |
49 | } | |
50 | 1 | return this.obligation.getText(); |
51 | } | |
52 | ||
53 | ||
54 | } |