1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krad.service.impl; |
17 | |
|
18 | |
import org.apache.commons.lang.StringUtils; |
19 | |
import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; |
20 | |
import org.kuali.rice.core.api.uif.RemotableAttributeField; |
21 | |
import org.kuali.rice.kim.api.KimConstants; |
22 | |
import org.kuali.rice.kim.api.type.KimAttributeField; |
23 | |
import org.kuali.rice.kns.kim.role.RoleTypeServiceBase; |
24 | |
|
25 | |
import java.util.ArrayList; |
26 | |
import java.util.Collections; |
27 | |
import java.util.List; |
28 | |
|
29 | 0 | public class CampusRoleTypeServiceImpl extends RoleTypeServiceBase { |
30 | |
|
31 | |
@Override |
32 | |
protected List<String> getRequiredAttributes() { |
33 | 0 | final List<String> attrs = new ArrayList<String>(super.getRequiredAttributes()); |
34 | 0 | attrs.add(KimConstants.AttributeConstants.CAMPUS_CODE); |
35 | 0 | return Collections.unmodifiableList(attrs); |
36 | |
} |
37 | |
|
38 | |
@Override |
39 | |
public List<String> getWorkflowRoutingAttributes(String routeLevel) { |
40 | 0 | if (StringUtils.isBlank(routeLevel)) { |
41 | 0 | throw new RiceIllegalArgumentException("routeLevel was blank or null"); |
42 | |
} |
43 | |
|
44 | 0 | final List<String> attrs = new ArrayList<String>(super.getWorkflowRoutingAttributes(routeLevel)); |
45 | 0 | attrs.add(KimConstants.AttributeConstants.CAMPUS_CODE); |
46 | 0 | return Collections.unmodifiableList(attrs); |
47 | |
} |
48 | |
|
49 | |
@Override |
50 | |
public List<KimAttributeField> getAttributeDefinitions(String kimTypeId) { |
51 | 0 | if (StringUtils.isBlank(kimTypeId)) { |
52 | 0 | throw new RiceIllegalArgumentException("kimTypeId was null or blank"); |
53 | |
} |
54 | |
|
55 | 0 | List<KimAttributeField> map = new ArrayList<KimAttributeField>(super.getAttributeDefinitions(kimTypeId)); |
56 | |
|
57 | 0 | for (int i = 0; i < map.size(); i++) { |
58 | 0 | final KimAttributeField definition = map.get(i); |
59 | 0 | if (KimConstants.AttributeConstants.CAMPUS_CODE.equals(definition.getAttributeField().getName())) { |
60 | 0 | KimAttributeField.Builder b = KimAttributeField.Builder.create(definition); |
61 | |
|
62 | 0 | RemotableAttributeField.Builder fb = b.getAttributeField(); |
63 | 0 | fb.setRequired(true); |
64 | |
|
65 | 0 | b.setAttributeField(fb); |
66 | 0 | map.set(i, b.build()); |
67 | |
} |
68 | |
} |
69 | 0 | return Collections.unmodifiableList(map); |
70 | |
} |
71 | |
} |