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 public class RuleBaseValuesInquirableImpl extends KualiInquirableImpl {
37
38 public static final String DOCUMENT_ID = "documentId";
39
40 @Override
41 public Object retrieveDataObject(Map fieldValues){
42 RuleBaseValues rule = (RuleBaseValues)super.retrieveDataObject(fieldValues);
43 WebRuleUtils.populateRuleMaintenanceFields(rule);
44 return rule;
45 }
46
47
48
49
50
51
52 public BusinessObject getBusinessObject(Map fieldValues) {
53 RuleBaseValues rule = (RuleBaseValues)super.getBusinessObject(fieldValues);
54 WebRuleUtils.populateRuleMaintenanceFields(rule);
55 return rule;
56 }
57
58
59
60
61
62
63 public List<Section> getSections(BusinessObject bo) {
64 List<Section> sections = super.getSections(bo);
65
66 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 if(DOCUMENT_ID.equals(attributeName)) {
75
76 HtmlData.AnchorHtmlData link = new HtmlData.AnchorHtmlData();
77 RuleBaseValues rule = (RuleBaseValues)businessObject;
78
79 String documentId = rule.getDocumentId();
80 link.setDisplayText(documentId+"");
81
82 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 link.setHref(href);
87
88 return link;
89 }
90 return super.getInquiryUrl(businessObject, attributeName, forceInquiry);
91 }
92
93 }