1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.kuali.student.lum.workflow.qualifierresolver;
20
21 import java.util.ArrayList;
22 import java.util.List;
23
24 import org.kuali.rice.kew.engine.RouteContext;
25 import org.kuali.rice.kim.bo.types.dto.AttributeSet;
26 import org.kuali.rice.student.bo.KualiStudentKimAttributes;
27 import org.kuali.student.core.organization.dto.OrgInfo;
28
29
30
31
32
33
34
35 public class AdminOrganizationQualifierResolver extends AbstractCocOrgQualifierResolver {
36 protected static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(AdminOrganizationQualifierResolver.class);
37
38 @Override
39 public List<AttributeSet> resolve(RouteContext routeContext) {
40 List<AttributeSet> attributeSets = super.resolve(routeContext);
41 String orgId = null;
42 if (attributeSets.size() > 0 && attributeSets.get(0).size() > 0) {
43 orgId = getAttribute(attributeSets, KualiStudentKimAttributes.QUALIFICATION_ORG_ID);
44 }
45 List<AttributeSet> returnList = new ArrayList<AttributeSet>();
46 if ( (orgId != null) && (!"".equals(orgId.trim())) ) {
47 try {
48 OrgInfo orgInfo = getOrganizationService().getOrganization(orgId);
49 if (orgInfo == null) {
50 LOG.error("Cannot find valid Org with id: " + orgId);
51 }
52 else {
53 AttributeSet attributeSet = new AttributeSet();
54 attributeSet.put(KualiStudentKimAttributes.QUALIFICATION_ORG, orgInfo.getShortName());
55 attributeSet.put(KualiStudentKimAttributes.QUALIFICATION_ORG_ID, orgInfo.getId());
56 returnList.add(attributeSet);
57 }
58 } catch (Exception e) {
59 LOG.error("Error calling org service to retrieve org id: " + orgId);
60 throw new RuntimeException(e);
61 }
62 }
63 return returnList;
64 }
65
66 }