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 org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
19 | |
import org.kuali.rice.kew.api.document.DocumentWithContent; |
20 | |
import org.kuali.rice.kew.api.document.attribute.DocumentAttribute; |
21 | |
import org.kuali.rice.kew.api.extension.ExtensionDefinition; |
22 | |
import org.kuali.rice.kew.docsearch.SearchableAttributeValue; |
23 | |
import org.kuali.rice.kew.doctype.service.impl.DocumentTypeServiceImpl; |
24 | |
import org.kuali.rice.krad.workflow.attribute.KualiXmlSearchableAttributeImpl; |
25 | |
import org.kuali.student.common.exceptions.*; |
26 | |
import org.kuali.student.core.organization.dto.OrgInfo; |
27 | |
import org.kuali.student.core.organization.service.OrganizationService; |
28 | |
|
29 | |
import javax.xml.namespace.QName; |
30 | |
import java.util.List; |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | 0 | public class OrgSearchAttribute extends KualiXmlSearchableAttributeImpl { |
38 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(DocumentTypeServiceImpl.class); |
39 | |
|
40 | |
private static final long serialVersionUID = 1L; |
41 | |
|
42 | |
|
43 | |
@SuppressWarnings("unchecked") |
44 | |
@Override |
45 | |
public List<DocumentAttribute> extractDocumentAttributes(ExtensionDefinition extensionDefinition, DocumentWithContent documentSearchContext) { |
46 | 0 | OrganizationService orgService = null; |
47 | 0 | List<DocumentAttribute> attributeValues = super.extractDocumentAttributes(extensionDefinition, documentSearchContext); |
48 | 0 | for (DocumentAttribute value : attributeValues) { |
49 | 0 | String orgId = (String)value.getValue(); |
50 | 0 | if (orgId != null) { |
51 | |
try { |
52 | 0 | if (orgService == null) { |
53 | 0 | orgService = (OrganizationService) GlobalResourceLoader.getService(new QName("http://student.kuali.org/wsdl/organization","OrganizationService")); |
54 | |
} |
55 | 0 | OrgInfo orgInfo = orgService.getOrganization(orgId); |
56 | |
|
57 | 0 | ((SearchableAttributeValue)value).setupAttributeValue(orgInfo.getShortName()); |
58 | 0 | } catch (DoesNotExistException e) { |
59 | 0 | LOG.error(e); |
60 | 0 | throw new RuntimeException(e); |
61 | 0 | } catch (InvalidParameterException e) { |
62 | 0 | LOG.error(e); |
63 | 0 | throw new RuntimeException(e); |
64 | 0 | } catch (MissingParameterException e) { |
65 | 0 | LOG.error(e); |
66 | 0 | throw new RuntimeException(e); |
67 | 0 | } catch (OperationFailedException e) { |
68 | 0 | LOG.error(e); |
69 | 0 | throw new RuntimeException(e); |
70 | 0 | } catch (PermissionDeniedException e) { |
71 | 0 | LOG.error(e); |
72 | 0 | throw new RuntimeException(e); |
73 | 0 | } |
74 | |
} |
75 | 0 | } |
76 | 0 | return attributeValues; |
77 | |
} |
78 | |
} |