1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.bo;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.kim.api.group.Group;
20 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
21 import javax.persistence.Entity;
22 import javax.persistence.Table;
23 import javax.persistence.Transient;
24 import javax.persistence.UniqueConstraint;
25
26
27
28
29
30
31
32 @Entity
33 @Table(name="KRNS_ADHOC_RTE_ACTN_RECIP_T",uniqueConstraints= {
34 @UniqueConstraint(name="KRNS_ADHOC_RTE_ACTN_RECIP_TC0",columnNames="OBJ_ID")
35 })
36 public class AdHocRouteWorkgroup extends AdHocRouteRecipient {
37 private static final long serialVersionUID = 1L;
38
39 @Transient
40 private String recipientNamespaceCode;
41
42 @Transient
43 private String recipientName;
44
45 @Transient
46 private Group group;
47
48
49
50
51 public AdHocRouteWorkgroup() {
52 setType(WORKGROUP_TYPE);
53 }
54
55 @Override
56 public void setType(Integer type) {
57 if (!WORKGROUP_TYPE.equals(type)) {
58 throw new IllegalArgumentException("cannot change type to " + type);
59 }
60 super.setType(type);
61 }
62
63 @Override
64 public void setId(String id) {
65 super.setId(id);
66
67 if (StringUtils.isNotBlank(id)) {
68 group = KimApiServiceLocator.getGroupService().getGroup(id);
69 setGroup(group);
70 }
71 }
72
73 @Override
74 public String getName() {
75 return "";
76 }
77
78
79
80
81
82 public String getRecipientNamespaceCode() {
83 return this.recipientNamespaceCode;
84 }
85
86
87
88
89
90
91 public void setRecipientNamespaceCode(String recipientNamespaceCode) {
92 this.recipientNamespaceCode = recipientNamespaceCode;
93
94 if (StringUtils.isNotBlank(recipientNamespaceCode) && StringUtils.isNotBlank(recipientName)) {
95 group = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(recipientNamespaceCode, recipientName);
96 setGroup(group);
97 }
98 }
99
100
101
102
103
104
105 public String getRecipientName() {
106 return this.recipientName;
107 }
108
109
110
111
112
113
114 public void setRecipientName(String recipientName) {
115 this.recipientName = recipientName;
116
117 if (StringUtils.isNotBlank(recipientNamespaceCode) && StringUtils.isNotBlank(recipientName)) {
118 group = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(recipientNamespaceCode, recipientName);
119 setGroup(group);
120 }
121 }
122
123 public Group getGroup() {
124 return group;
125 }
126
127 public void setGroup(Group group) {
128 this.group = group;
129
130 if (group != null) {
131 this.id = group.getId();
132 this.recipientNamespaceCode = group.getNamespaceCode();
133 this.recipientName = group.getName();
134 }
135 }
136
137 }