1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
package org.kuali.student.lum.workflow.qualifierresolver; |
5 |
|
|
6 |
|
import java.util.ArrayList; |
7 |
|
import java.util.List; |
8 |
|
|
9 |
|
import org.apache.commons.lang.StringUtils; |
10 |
|
import org.kuali.rice.kew.engine.RouteContext; |
11 |
|
import org.kuali.rice.kew.engine.node.RouteNodeUtils; |
12 |
|
import org.kuali.rice.kim.bo.types.dto.AttributeSet; |
13 |
|
import org.kuali.student.common.search.dto.SearchResultRow; |
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 9 |
Complexity Density: 0.5 |
|
50 |
|
public class CocOrganizationQualifierResolver extends AbstractOrganizationServiceQualifierResolver { |
51 |
|
private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(CocOrganizationQualifierResolver.class); |
52 |
|
|
53 |
|
protected static final String ROUTE_NODE_XML_ORG_ID_QUALIFIER_KEY = "organizationIdQualifierKey"; |
54 |
|
protected static final String ROUTE_NODE_XML_USE_NON_DERIVED_ROLES = "useNonDerivedRoles"; |
55 |
|
|
56 |
|
public static final String KUALI_ORG_TYPE_CURRICULUM_PARENT = "kuali.org.CurriculumParent"; |
57 |
|
public static final String KUALI_ORG_HIERARCHY_CURRICULUM = "kuali.org.hierarchy.Curriculum"; |
58 |
|
public static final String KUALI_ORG_COC = "kuali.org.COC"; |
59 |
|
|
60 |
|
|
61 |
|
@see |
62 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
63 |
0
|
@Override... |
64 |
|
public List<AttributeSet> resolve(RouteContext context) { |
65 |
0
|
List<AttributeSet> attributeSets = new ArrayList<AttributeSet>(); |
66 |
0
|
String orgIdKey = getNodeSpecificOrganizationIdAttributeSetKey(context); |
67 |
0
|
for (String orgId : getOrganizationIdsFromDocumentContent(context)) { |
68 |
0
|
List<SearchResultRow> results = relatedOrgsFromOrgId(orgId, getOrganizationRelationTypeCode(), getRelatedOrganizationTypeCode()); |
69 |
0
|
attributeSets.addAll(attributeSetFromSearchResult(results, orgIdKey)); |
70 |
|
} |
71 |
0
|
return attributeSets; |
72 |
|
} |
73 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
74 |
0
|
public String getNodeSpecificOrganizationIdAttributeSetKey(RouteContext context) {... |
75 |
0
|
String organizationIdFieldKey = RouteNodeUtils.getValueOfCustomProperty(context.getNodeInstance().getRouteNode(), ROUTE_NODE_XML_ORG_ID_QUALIFIER_KEY); |
76 |
0
|
if (StringUtils.isBlank(organizationIdFieldKey)) { |
77 |
0
|
if (usesNonDerivedOrganizationRoles(context)) { |
78 |
0
|
throw new RuntimeException("Cannot find required XML element '" + ROUTE_NODE_XML_ORG_ID_QUALIFIER_KEY + "' on the Route Node XML configuration."); |
79 |
|
} |
80 |
|
} |
81 |
0
|
return organizationIdFieldKey; |
82 |
|
} |
83 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
84 |
0
|
public Boolean usesNonDerivedOrganizationRoles(RouteContext context) {... |
85 |
0
|
String useNonDerivedOrganizationRoles = RouteNodeUtils.getValueOfCustomProperty(context.getNodeInstance().getRouteNode(), ROUTE_NODE_XML_USE_NON_DERIVED_ROLES); |
86 |
0
|
if (StringUtils.isNotBlank(useNonDerivedOrganizationRoles)) { |
87 |
0
|
return Boolean.valueOf(useNonDerivedOrganizationRoles); |
88 |
|
} |
89 |
0
|
return true; |
90 |
|
} |
91 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
92 |
0
|
protected String getOrganizationHierarchyTypeCode() {... |
93 |
0
|
return KUALI_ORG_HIERARCHY_CURRICULUM; |
94 |
|
} |
95 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
96 |
0
|
protected String getOrganizationRelationTypeCode() {... |
97 |
0
|
return KUALI_ORG_TYPE_CURRICULUM_PARENT; |
98 |
|
} |
99 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
100 |
0
|
protected String getRelatedOrganizationTypeCode() {... |
101 |
0
|
return KUALI_ORG_COC; |
102 |
|
} |
103 |
|
|
104 |
|
} |