Clover Coverage Report - KS LUM 1.1.0-M10-SNAPSHOT (Aggregated)
Coverage timestamp: Fri Dec 17 2010 06:40:47 EST
../../../../../../img/srcFileCovDistChart0.png 54% of files have more coverage
17   66   7   17
6   37   0.41   1
1     7  
1    
 
  AdminOrganizationQualifierResolver       Line # 35 17 0% 7 24 0% 0.0
 
No Tests
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10    * software distributed under the License is distributed on an "AS IS"
11    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12    * or implied. See the License for the specific language governing
13    * permissions and limitations under the License.
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    * This class finds the admin organization on the KS document and returns the id
31    * and short name of that organization for routing directly to the org on the
32    * document
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  0 toggle @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  0 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    } catch (Exception e) {
59  0 LOG.error("Error calling org service to retrieve org id: " + orgId);
60  0 throw new RuntimeException(e);
61    }
62    }
63  0 return returnList;
64    }
65   
66    }