Coverage Report - org.kuali.student.lum.workflow.search.OrgSearchAttribute
 
Classes in this File Line Coverage Branch Coverage Complexity
OrgSearchAttribute
0%
0/29
0%
0/6
14
 
 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  
 package org.kuali.student.lum.workflow.search;
 17  
 
 18  
 import java.util.List;
 19  
 
 20  
 import javax.xml.namespace.QName;
 21  
 
 22  
 import org.kuali.rice.core.resourceloader.GlobalResourceLoader;
 23  
 import org.kuali.rice.kew.docsearch.DocumentSearchContext;
 24  
 import org.kuali.rice.kew.docsearch.SearchableAttributeValue;
 25  
 import org.kuali.rice.kew.doctype.service.impl.DocumentTypeServiceImpl;
 26  
 import org.kuali.rice.kns.workflow.attribute.KualiXmlSearchableAttributeImpl;
 27  
 import org.kuali.student.common.exceptions.DoesNotExistException;
 28  
 import org.kuali.student.common.exceptions.InvalidParameterException;
 29  
 import org.kuali.student.common.exceptions.MissingParameterException;
 30  
 import org.kuali.student.common.exceptions.OperationFailedException;
 31  
 import org.kuali.student.common.exceptions.PermissionDeniedException;
 32  
 import org.kuali.student.core.organization.dto.OrgInfo;
 33  
 import org.kuali.student.core.organization.service.OrganizationService;
 34  
 
 35  
 /**
 36  
  * Extension for CluCreditCourse documents searches that converts Organization ID to the Organization Long Name
 37  
  * @author lindholm
 38  
  *
 39  
  */
 40  0
 public class OrgSearchAttribute extends KualiXmlSearchableAttributeImpl {
 41  0
     private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DocumentTypeServiceImpl.class);
 42  
 
 43  
     private static final long serialVersionUID = 1L;
 44  
 
 45  
         @SuppressWarnings("unchecked")
 46  
         @Override
 47  
         public List<SearchableAttributeValue> getSearchStorageValues(DocumentSearchContext documentSearchContext) {
 48  0
                 OrganizationService orgService = null;
 49  0
                 List<SearchableAttributeValue> attributeValues = (List<SearchableAttributeValue>)super.getSearchStorageValues(documentSearchContext);
 50  0
                 for (SearchableAttributeValue value : attributeValues) {
 51  0
                         String orgId = (String)value.getSearchableAttributeValue();
 52  0
                         if (orgId != null) {
 53  
                                 try {
 54  0
                                         if (orgService == null) {
 55  0
                                                 orgService = (OrganizationService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/organization","OrganizationService"));
 56  
                                         }
 57  0
                                         OrgInfo orgInfo = orgService.getOrganization(orgId);
 58  0
                                         value.setupAttributeValue(orgInfo.getShortName());
 59  0
                                 } catch (DoesNotExistException e) {
 60  0
                                         LOG.error(e);
 61  0
                                         throw new RuntimeException(e);
 62  0
                                 } catch (InvalidParameterException e) {
 63  0
                                         LOG.error(e);
 64  0
                                         throw new RuntimeException(e);
 65  0
                                 } catch (MissingParameterException e) {
 66  0
                                         LOG.error(e);
 67  0
                                         throw new RuntimeException(e);
 68  0
                                 } catch (OperationFailedException e) {
 69  0
                                         LOG.error(e);
 70  0
                                         throw new RuntimeException(e);
 71  0
                                 } catch (PermissionDeniedException e) {
 72  0
                                         LOG.error(e);
 73  0
                                         throw new RuntimeException(e);
 74  0
                                 }
 75  
                         }
 76  0
                 }
 77  0
                 return attributeValues;
 78  
         }
 79  
 }