1
2
3
4
5 package gboat2.base.core.model;
6
7 import gboat2.base.core.util.ActionUtil;
8
9 import java.util.Arrays;
10
11 import org.apache.commons.lang3.StringUtils;
12
13
14
15
16
17
18
19
20
21 public class PreferenceDefinition {
22
23
24 private String fullname;
25
26
27 private String bundle;
28
29
30 private String actionClass;
31
32
33 private String method;
34
35
36
37
38 public String getShortName() {
39 String[] nodes = fullname.split("/");
40 return nodes[nodes.length - 1];
41 }
42
43
44
45
46 public String[] getAncestors() {
47 String[] nodes = fullname.split("/");
48 if (nodes.length > 1) {
49 return Arrays.copyOfRange(nodes, 0, nodes.length - 1);
50 }
51 return null;
52 }
53
54
55
56
57 public String getUri() {
58 if (StringUtils.isEmpty(method)) {
59 return ActionUtil.getUri(actionClass);
60 }
61 return ActionUtil.getUri(actionClass, method);
62 }
63
64 public String getFullname() {
65 return fullname;
66 }
67
68 public void setFullname(String fullname) {
69 this.fullname = StringUtils.strip(fullname, "/");
70 }
71
72 public String getBundle() {
73 return bundle;
74 }
75
76 public void setBundle(String bundle) {
77 this.bundle = bundle;
78 }
79
80 public String getActionClass() {
81 return actionClass;
82 }
83
84 public void setActionClass(String actionClass) {
85 this.actionClass = actionClass;
86 }
87
88 public String getMethod() {
89 return method;
90 }
91
92 public void setMethod(String method) {
93 this.method = method;
94 }
95 }