1 /**
2 * Copyright 2005-2016 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.kew.rule;
17
18 import org.kuali.rice.kew.api.rule.RoleName;
19 import org.kuali.rice.kew.api.rule.RuleTemplateAttribute;
20 import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo;
21
22 import java.util.List;
23 import java.util.Map;
24
25 /**
26 * Handles communication between {@link org.kuali.rice.kew.framework.rule.attribute.WorkflowRuleAttributeHandlerService}
27 * endpoints in order to invoke {@link WorkflowRuleAttribute} code which might be hosted from various applications.
28 *
29 * @author Kuali Rice Team (rice.collab@kuali.org)
30 */
31 public interface WorkflowRuleAttributeMediator {
32
33 /**
34 * Returns rule row configuration for the workflow rule attribute defined on the given RuleTemplateAttribute. These
35 * are the rows which show up on the rule and rule delegation maintenance screen when creating or editing a rule
36 * or rule delegation which uses the given attribute, as well as on the inquiry for the rule.
37 *
38 * <p>Will use the supplied parameters to populate the WorkflowRuleAttribute by running the validateRuleData method
39 * on that attribute. The result of this call contains any validation errors, the Row objects as constructed by the
40 * attribute, and the final values for the rule extensions after validation and processing has been executed.</p>
41 *
42 * @param parameters a map of parameters to pass to the backend WorkflowRuleAttribute for validation, may be null or
43 * an empty map
44 * @param ruleTemplateAttribute the RuleTemplateAttribute which defines the ExtensionDefinition for the
45 * WorkflowRuleAttribute against which to validate and retrieve the rows, as well as
46 * the required flag which should be passed to the attribute
47 *
48 * @return the result of validating and retrieving rule rows, will never return null
49 */
50 WorkflowRuleAttributeRows getRuleRows(Map<String, String> parameters, RuleTemplateAttribute ruleTemplateAttribute);
51
52 /**
53 * Equivalent to {@link #getRuleRows(java.util.Map, org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo)} but takes
54 * a {@link RuleTemplateAttributeBo} instead of a {@link RuleTemplateAttribute}. Exists primarily for convenience of
55 * the calling code.
56 */
57 WorkflowRuleAttributeRows getRuleRows(Map<String, String> parameters, RuleTemplateAttributeBo ruleTemplateAttribute);
58
59 /**
60 * Returns rule attribute row configuration for the workflow rule attribute defined on the given RuleTemplateAttribute.
61 * These are the rows which show up on the Routing Report screen when using a RuleTemplate which includes the
62 * given RuleTemplateAttribute.
63 *
64 * <p>Will use the supplied parameters to populate the WorkflowRuleAttribute by running the validateRoutingData method
65 * on that attribute. The result of this call contains any validation errors, the Row objects as constructed by the
66 * attribute, and the final values for the rule extensions after validation and processing has been executed.</p>
67 *
68 * @param parameters a map of parameters to pass to the backend WorkflowRuleAttribute for validation, may be null or
69 * an empty map
70 * @param ruleTemplateAttribute the RuleTemplateAttribute which defines the ExtensionDefinition for the
71 * WorkflowRuleAttribute against which to validate and retrieve the search rows, as
72 * well as the required flag which should be passed to the attribute
73 *
74 * @return the result of validating and retrieving rule search rows, will never return null
75 */
76 WorkflowRuleAttributeRows getRoutingDataRows(Map<String, String> parameters, RuleTemplateAttribute ruleTemplateAttribute);
77
78 /**
79 * Equivalent to {@link #getRoutingDataRows(java.util.Map, org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo)} but takes
80 * a {@link RuleTemplateAttributeBo} instead of a {@link RuleTemplateAttribute}. Exists primarily for convenience of
81 * the calling code.
82 */
83 WorkflowRuleAttributeRows getRoutingDataRows(Map<String, String> parameters, RuleTemplateAttributeBo ruleTemplateAttribute);
84
85 /**
86 * Returns rule search row configuration for the workflow rule attribute defined on the given RuleTemplateAttribute.
87 * These are the rows which show up on the rule and rule delegation lookup screen when searching for rules
88 * or rule delegations using a RuleTemplate which includes the given RuleTemplateAttribute.
89 *
90 * <p>Will use the supplied parameters to populate the WorkflowRuleAttribute by running the validateRuleData method
91 * on that attribute (or if the attribute implements WorkflowRuleSearchAttribute, will execute validateSearchData).
92 * The result of this call contains any validation errors, the Row objects as constructed by the attribute, and the
93 * final values for the rule extensions after validation and processing has been executed.</p>
94 *
95 * @param parameters a map of parameters to pass to the backend WorkflowRuleAttribute for validation, may be null or
96 * an empty map
97 * @param ruleTemplateAttribute the RuleTemplateAttribute which defines the ExtensionDefinition for the
98 * WorkflowRuleAttribute against which to validate and retrieve the search rows, as
99 * well as the required flag which should be passed to the attribute
100 *
101 * @return the result of validating and retrieving rule search rows, will never return null
102 */
103 WorkflowRuleAttributeRows getSearchRows(Map<String, String> parameters, RuleTemplateAttribute ruleTemplateAttribute);
104
105 /**
106 * Equivalent to call {@link #getSearchRows(java.util.Map, org.kuali.rice.kew.api.rule.RuleTemplateAttribute)} but
107 * passes a custom value for the required flag that is passed to the attribute instead of using the one defined by
108 * the given {@link org.kuali.rice.kew.api.rule.RuleTemplateAttribute#isRequired()}. The main use case for this
109 * is in the case of a lookup where it's desirable to disable required validation for search fields that have not
110 * been filled in (in that case a value of "false" would be passed as the last argument to this method).
111 */
112 WorkflowRuleAttributeRows getSearchRows(Map<String, String> parameters, RuleTemplateAttribute ruleTemplateAttribute, boolean required);
113
114 /**
115 * Returns the list of role names as defined on the {@link RoleAttribute} defined by the given rule template
116 * attribute. In this case that the defined rule template attribute does not represent a role attribute or does
117 * not return any role names, this method will return an empty list.
118 *
119 * @param ruleTemplateAttribute the RuleTemplateAttribute which defines the ExtensionDefinition for the
120 * RoleAttribute from which to fetch the role names
121 *
122 * @retun the list of role names from the attribute, or an empty list if none are defined, will never return null
123 */
124 List<RoleName> getRoleNames(RuleTemplateAttributeBo ruleTemplateAttribute);
125
126 }
127
128