Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
RoleHierarchyBeanOverview |
|
| 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.RoleHierarchyBean; | |
11 | ||
12 | ||
13 | /** | |
14 | * Describes a {@link RoleHierarchyBean} that has been adapted to a short overview string. | |
15 | * @since 0.4.0 | |
16 | */ | |
17 | 1 | public class RoleHierarchyBeanOverview implements Overview { |
18 | ||
19 | //---- Static | |
20 | ||
21 | //---- State | |
22 | ||
23 | private RoleHierarchyBean hierarchy; | |
24 | ||
25 | //---- Constructors | |
26 | ||
27 | /** | |
28 | * Creates a role hierarchy bean overview adaptee. | |
29 | * @param hierarchy the {@link RoleHierarchyBean}. | |
30 | * @since 0.4.0 | |
31 | */ | |
32 | 2 | public RoleHierarchyBeanOverview (RoleHierarchyBean hierarchy) { |
33 | 2 | if (hierarchy == null) { |
34 | 1 | throw new IllegalArgumentException("Hierarchy is null."); |
35 | } | |
36 | 1 | this.hierarchy = hierarchy; |
37 | 1 | } |
38 | ||
39 | //---- Methods | |
40 | ||
41 | //---- Overview | |
42 | ||
43 | /** | |
44 | * @since 0.4.0 | |
45 | */ | |
46 | public String get () { | |
47 | 1 | if (this.hierarchy.getIdentity() == null) { |
48 | 0 | return ""; |
49 | } | |
50 | 1 | return this.hierarchy.getIdentity().toString(); |
51 | } | |
52 | ||
53 | } |