1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.rule;
17
18
19
20
21
22
23 public class QualifiedRoleName {
24 private final String baseRoleName;
25 private final String qualifier;
26
27 public QualifiedRoleName(String baseRoleName) {
28 this(baseRoleName, null);
29 }
30 public QualifiedRoleName(String baseRoleName, String qualifier) {
31 this.baseRoleName = baseRoleName;
32 this.qualifier = qualifier;
33 }
34 public String getBaseRoleName() {
35 return baseRoleName;
36 }
37 public String getQualifier() {
38 return qualifier;
39 }
40 public String encode() {
41 if (qualifier == null) {
42 return baseRoleName;
43 } else {
44 return baseRoleName + '\0' + qualifier;
45 }
46 }
47
48 public static QualifiedRoleName parse(String qualifiedRoleName) {
49 String[] parts = qualifiedRoleName.split("\0", 2);
50 return new QualifiedRoleName(parts[0], parts.length > 1 ? parts[1] : null);
51 }
52
53 public String toString() {
54 return "[QualifiedRoleName: baseRoleName=" + baseRoleName +
55 ", qualifier=" + qualifier + "]";
56 }
57 }