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