1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.rule.bo; |
17 | |
|
18 | |
import org.kuali.rice.core.api.config.property.ConfigContext; |
19 | |
import org.kuali.rice.kew.rule.RuleBaseValues; |
20 | |
import org.kuali.rice.kew.rule.web.WebRuleUtils; |
21 | |
import org.kuali.rice.kew.api.KewApiConstants; |
22 | |
import org.kuali.rice.kns.inquiry.KualiInquirableImpl; |
23 | |
import org.kuali.rice.kns.lookup.HtmlData; |
24 | |
import org.kuali.rice.kns.web.ui.Section; |
25 | |
import org.kuali.rice.krad.bo.BusinessObject; |
26 | |
|
27 | |
import java.util.List; |
28 | |
import java.util.Map; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | 0 | public class RuleBaseValuesInquirableImpl extends KualiInquirableImpl { |
37 | |
|
38 | |
public static final String DOCUMENT_ID = "documentId"; |
39 | |
|
40 | |
@Override |
41 | |
public Object retrieveDataObject(Map fieldValues){ |
42 | 0 | RuleBaseValues rule = (RuleBaseValues)super.retrieveDataObject(fieldValues); |
43 | 0 | WebRuleUtils.populateRuleMaintenanceFields(rule); |
44 | 0 | return rule; |
45 | |
} |
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
public BusinessObject getBusinessObject(Map fieldValues) { |
53 | 0 | RuleBaseValues rule = (RuleBaseValues)super.getBusinessObject(fieldValues); |
54 | 0 | WebRuleUtils.populateRuleMaintenanceFields(rule); |
55 | 0 | return rule; |
56 | |
} |
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
public List getSections(BusinessObject bo) { |
64 | 0 | List<Section> sections = super.getSections(bo); |
65 | |
|
66 | 0 | return WebRuleUtils.customizeSections((RuleBaseValues)bo, sections, false); |
67 | |
|
68 | |
} |
69 | |
|
70 | |
|
71 | |
@Override |
72 | |
public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) { |
73 | |
|
74 | 0 | if(DOCUMENT_ID.equals(attributeName)) { |
75 | |
|
76 | 0 | HtmlData.AnchorHtmlData link = new HtmlData.AnchorHtmlData(); |
77 | 0 | RuleBaseValues rule = (RuleBaseValues)businessObject; |
78 | |
|
79 | 0 | String documentId = rule.getDocumentId(); |
80 | 0 | link.setDisplayText(documentId+""); |
81 | |
|
82 | 0 | String href = ConfigContext.getCurrentContextConfig().getKEWBaseURL() + "/" + |
83 | |
KewApiConstants.DOC_HANDLER_REDIRECT_PAGE + "?" + KewApiConstants.COMMAND_PARAMETER + "=" + |
84 | |
KewApiConstants.DOCSEARCH_COMMAND + "&" + KewApiConstants.DOCUMENT_ID_PARAMETER + "=" + documentId; |
85 | |
|
86 | 0 | link.setHref(href); |
87 | |
|
88 | 0 | return link; |
89 | |
} |
90 | 0 | return super.getInquiryUrl(businessObject, attributeName, forceInquiry); |
91 | |
} |
92 | |
|
93 | |
} |