1
2
3
4
5
6
7
8
9
10
11
12
13
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
37
38
39
40 public class OrgSearchAttribute extends KualiXmlSearchableAttributeImpl {
41 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 OrganizationService orgService = null;
49 List<SearchableAttributeValue> attributeValues = (List<SearchableAttributeValue>)super.getSearchStorageValues(documentSearchContext);
50 for (SearchableAttributeValue value : attributeValues) {
51 String orgId = (String)value.getSearchableAttributeValue();
52 if (orgId != null) {
53 try {
54 if (orgService == null) {
55 orgService = (OrganizationService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/organization","OrganizationService"));
56 }
57 OrgInfo orgInfo = orgService.getOrganization(orgId);
58 value.setupAttributeValue(orgInfo.getShortName());
59 } catch (DoesNotExistException e) {
60 LOG.error(e);
61 throw new RuntimeException(e);
62 } catch (InvalidParameterException e) {
63 LOG.error(e);
64 throw new RuntimeException(e);
65 } catch (MissingParameterException e) {
66 LOG.error(e);
67 throw new RuntimeException(e);
68 } catch (OperationFailedException e) {
69 LOG.error(e);
70 throw new RuntimeException(e);
71 } catch (PermissionDeniedException e) {
72 LOG.error(e);
73 throw new RuntimeException(e);
74 }
75 }
76 }
77 return attributeValues;
78 }
79 }