| 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 | 0 | public class AdminOrganizationQualifierResolver extends AbstractCocOrgQualifierResolver { |
| 36 | 0 | 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 | 0 | List<AttributeSet> attributeSets = super.resolve(routeContext); |
| 41 | 0 | String orgId = null; |
| 42 | 0 | if (attributeSets.size() > 0 && attributeSets.get(0).size() > 0) { |
| 43 | 0 | orgId = getAttribute(attributeSets, KualiStudentKimAttributes.QUALIFICATION_ORG_ID); |
| 44 | |
} |
| 45 | 0 | List<AttributeSet> returnList = new ArrayList<AttributeSet>(); |
| 46 | 0 | if ( (orgId != null) && (!"".equals(orgId.trim())) ) { |
| 47 | |
try { |
| 48 | 0 | OrgInfo orgInfo = getOrganizationService().getOrganization(orgId); |
| 49 | 0 | if (orgInfo == null) { |
| 50 | 0 | LOG.error("Cannot find valid Org with id: " + orgId); |
| 51 | |
} |
| 52 | |
else { |
| 53 | 0 | AttributeSet attributeSet = new AttributeSet(); |
| 54 | 0 | attributeSet.put(KualiStudentKimAttributes.QUALIFICATION_ORG, orgInfo.getShortName()); |
| 55 | 0 | attributeSet.put(KualiStudentKimAttributes.QUALIFICATION_ORG_ID, orgInfo.getId()); |
| 56 | 0 | returnList.add(attributeSet); |
| 57 | |
} |
| 58 | 0 | } catch (Exception e) { |
| 59 | 0 | LOG.error("Error calling org service to retrieve org id: " + orgId); |
| 60 | 0 | throw new RuntimeException(e); |
| 61 | 0 | } |
| 62 | |
} |
| 63 | 0 | return returnList; |
| 64 | |
} |
| 65 | |
|
| 66 | |
} |