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