DBA Data[Home] [Help]

PACKAGE: APPS.FUN_RULE_PUB

Source


1 PACKAGE FUN_RULE_PUB AUTHID CURRENT_USER AS
2 /*$Header: FUNXTMRULENGINS.pls 120.8 2006/04/22 11:14:35 ammishra noship $ */
3 /*#
4 * Evaluate rules.
5 * The following is an example of how procedures and functions in this package
6 * should be used...<br>
7 * <code>FUN_RULE_PKG.init_parameter_list;
8 * FUN_RULE_PKG.add_parameter('EXPENSE_DATE', sysdate);
9 * FUN_RULE_PKG.add_parameter('EMPLOYEE_NUM', 'JP1234');
10 * FUN_RULE_PKG.add_parameter(... for all your parameters ...);
11 * result := FUN_RULE_PKG.apply_rule('SQLAP','MY_CUSTOMIZED_OBJECT_NAME');</code>
12 * @rep:scope internal
13 * @rep:product fun
14 * @rep:displayname Rule Engine
15 * @rep:category BUSINESS_ENTITY FUN_RULE
16 */
17 
18 
19 m_ruleDetailId		NUMBER(15) ;
20 m_resultApplicationId	NUMBER(15)  ;
21 m_ruleName		VARCHAR2(80);
22 m_resultValue           VARCHAR2(4000);
23 m_resultValueDataType   VARCHAR2(30);
24 m_attributeCategory     VARCHAR2(150);
25 m_multiRuleResultFlag   VARCHAR2(1);
26 m_useDefaultValueFlag   VARCHAR2(1);
27 m_noRulesSatisfied      BOOLEAN;
28 m_attribute1		VARCHAR2(150);
29 m_attribute2            VARCHAR2(150);
30 m_attribute3            VARCHAR2(150);
31 m_attribute4            VARCHAR2(150);
32 m_attribute5            VARCHAR2(150);
33 m_attribute6            VARCHAR2(150);
34 m_attribute7            VARCHAR2(150);
35 m_attribute8            VARCHAR2(150);
36 m_attribute9            VARCHAR2(150);
37 m_attribute10           VARCHAR2(150);
38 m_attribute11           VARCHAR2(150);
39 m_attribute12           VARCHAR2(150);
40 m_attribute13           VARCHAR2(150);
41 m_attribute14           VARCHAR2(150);
42 m_attribute15           VARCHAR2(150);
43 
44 m_ruleObjectType        VARCHAR2(15);
45 m_ruleObjectId          NUMBER;
46 m_flexFieldName         VARCHAR2(80);
47 m_flexFieldAppShortName VARCHAR2(10);
48 
49 --------------------------------------
50 -- public procedures and functions
51 --------------------------------------
52 
53   /**
54    * Initialize the parameter list that is used for rule evaluation.
55    *
56    * @rep:displayname Initialize Parameter List
57    */
58   PROCEDURE init_parameter_list;
59 
60   /**
61    * This procedure sets the instance context for the Rule Object Instance.
62    * Once set, the rule object id will be derived from the Rule Object Instance
63    * and will be used throughout.
64    *
65    * @param p_application_short_name Application Short Name
66    * @param p_rule_object_name Name of rule object
67    * @param p_instance_label   Instance label of rule object
68    * @rep:displayname Rule Evaluation
69    * @rep:displayname sets the rule object instance context.
70    */
71   PROCEDURE set_instance_context(p_rule_object_name IN VARCHAR2, p_application_short_name IN VARCHAR2,
72                p_instance_label  IN VARCHAR2 , p_org_id  IN NUMBER);
73 
74   /**
75    * Add a string parameter value used for rule evaluation.
76    *
77    * @param name Name of the parameter
78    * @param value String value for the parameter
79    * @rep:displayname Add parameter
80    * @rep:primaryinstance
81    */
82   PROCEDURE add_parameter(name VARCHAR2, value VARCHAR2);
83 
84   /**
85    * Add a date parameter value used for rule evaluation.
86    *
87    * @param name Name of the parameter
88    * @param value Date value for the parameter
89    * @rep:displayname Add parameter
90    */
91   PROCEDURE add_parameter(name VARCHAR2, value DATE);
92 
93   /**
94    * Add a number parameter value used for rule evaluation.
95    *
96    * @param name Name of the parameter
97    * @param value Number value for the parameter
98    * @rep:displayname Add parameter
99    */
100   PROCEDURE add_parameter(name VARCHAR2, value NUMBER);
101 
102   /**
103    * Evaluate rules based on the input parameters,
104    *
105    * @param p_application_short_name Application Short Name
106    * @param p_rule_object_name Name of rule object
107    * @rep:displayname Rule Evaluation
108    */
109    PROCEDURE apply_rule(p_application_short_name IN VARCHAR2, p_rule_object_name IN VARCHAR2);
110 
111   /**
112    * Evaluate rules based on the input parameters,
113    * and return true or false.
114    *
115    * @param p_application_short_name Application Short Name
116    * @param p_rule_object_name Name of rule object
117    * @return Boolean value
118    * @rep:displayname Rule Evaluation
119    */
120 
121    FUNCTION apply_rule(p_application_short_name IN VARCHAR2, p_rule_object_name IN VARCHAR2)
122    RETURN BOOLEAN;
123 
124   /**
125    * Evaluate rules based on the input parameters,
126    * and return a numeric value 1 or 0 based on returning value of TRUE or FALSE.
127    * This version is used to call This Rule Engine from Java Layer.
128    *
129    * @param p_application_short_name Application Short Name
130    * @param p_rule_object_name Name of rule object
131    * @return Boolean value
132    * @rep:displayname Rule Evaluation
133    */
134 
135    FUNCTION apply_rule_wrapper(p_application_short_name IN VARCHAR2, p_rule_object_name IN VARCHAR2)
136    RETURN NUMBER;
137 
138   /**
139    * Evaluate rules based on the PARAM TABLE or View for Bulk Evaluation,
140    * and populates the result value in a Global temporary table
141    * called FUN_RULE_BULK_RESULTS_GT.
142    *
143    * @param p_application_short_name Application Short Name
144    * @param p_rule_object_name Name of rule object
145    * @return String value of result
146    * @rep:displayname Rule Evaluation
147    */
148    PROCEDURE apply_rule_bulk(p_application_short_name  IN VARCHAR2,
149                              p_rule_object_name        IN VARCHAR2,
150                              p_param_view_name         IN VARCHAR2,
151 			     p_additional_where_clause IN VARCHAR2,
152  		             p_primary_key_column_name IN VARCHAR2 DEFAULT 'ID');
153 
154 
155 
156   /**
157    * Evaluate rules based on the input parameters,
158    * and return true or false based on any rule is satisfied or not.
159    * If any Rule is matched successfully it returns TRUE else returns FALSE.
160    *
161    * @param p_application_short_name Application Short Name
162    * @param p_rule_object_name Name of rule object
163    * @return Bollean value true or false.
164    * @rep:displayname Rule Evaluation
165    */
166 
167    FUNCTION get_string RETURN VARCHAR2;
168 
169   /**
170    * Evaluate rules based on the input parameters,
171    * and return the number result value.
172    *
173    * @param p_application_short_name Application Short Name
174    * @param p_rule_object_name Name of rule object
175    * @return Number value of result
176    * @rep:displayname Rule Evaluation
177    */
178 
179 
180    FUNCTION get_number RETURN VARCHAR2;
181 
182   /**
183    * Evaluate rules based on the input parameters,
184    * and return the date result value.
185    *
186    * @param p_application_short_name Application Short Name
187    * @param p_rule_object_name Name of rule object
188    * @return Date value of result
189    * @rep:displayname Rule Evaluation
190    */
191 
192    FUNCTION get_date RETURN VARCHAR2;
193 
194   /**
195    * Evaluate rules based on the input parameters,
196    * and return the number result value.
197    *
198    * @param p_application_short_name Application Short Name
199    * @param p_rule_object_name Name of rule object
200    * @return Number value of result
201    * @rep:displayname Rule Evaluation
202    */
203 
204 
205   FUNCTION get_rule_detail_id RETURN NUMBER;
206 
207   /**
208   * Returns the Result Application Id
209   * <P>
210   * Note: applyRule() must have been called already.
211   * <P>
212   * @param
213   * @return Result Application Id
214   */
215 
216   FUNCTION get_result_application_id RETURN NUMBER;
217 
218   /**
219   * Returns the Rule Name
220   * <P>
221   * Note: apply_rule() must have been called already.
222   * <P>
223   * @param
224   * @return Rule Name that matches all conditions first.
225   */
226 
227 
228   FUNCTION get_rule_name RETURN VARCHAR2;
229 
230   /**
231   * Returns the Attribute Category
232   * <P>
233   * Note: apply_rule() must have been called already.
234   * <P>
235   * @param
236   * @return Attribute Category for DFF Rule Object Type
237   */
238 
239   FUNCTION get_attribute_category RETURN VARCHAR2;
240 
241 
242   /**
243   * Returns the Attribute1 Value
244   * <P>
245   * Note: apply_rule() must have been called already.
246   * <P>
247   * @param
248   * @return Attribute1 Value for DFF Rule Object Type
249   */
250 
251   FUNCTION get_attribute1  RETURN VARCHAR2;
252 
253 
254   /**
255   * Returns the Attribute2 Value
256   * <P>
257   * Note: applyRule() must have been called already.
258   * <P>
259   * @param
260   * @return Attribute2 Value for DFF Rule Object Type
261   */
262 
263   FUNCTION get_attribute2  RETURN VARCHAR2;
264 
265   /**
266   * Returns the Attribute3 Value
267   * <P>
268   * Note: applyRule() must have been called already.
269   * <P>
270   * @param
271   * @return Attribute3 Value for DFF Rule Object Type
272   */
273 
274   FUNCTION get_attribute3  RETURN VARCHAR2;
275 
276   /**
277   * Returns the Attribute4 Value
278   * <P>
279   * Note: applyRule() must have been called already.
280   * <P>
281   * @param
282   * @return Attribute4 Value for DFF Rule Object Type
283   */
284 
285   FUNCTION get_attribute4  RETURN VARCHAR2;
286 
287   /**
288   * Returns the Attribute5 Value
289   * <P>
290   * Note: applyRule() must have been called already.
291   * <P>
292   * @param
293   * @return Attribute5 Value for DFF Rule Object Type
294   */
295 
296   FUNCTION get_attribute5  RETURN VARCHAR2;
297 
298   /**
299   * Returns the Attribute6 Value
300   * <P>
301   * Note: applyRule() must have been called already.
302   * <P>
303   * @param
304   * @return Attribute6 Value for DFF Rule Object Type
305   */
306 
307   FUNCTION get_attribute6  RETURN VARCHAR2;
308 
309   /**
310   * Returns the Attribute7 Value
311   * <P>
312   * Note: applyRule() must have been called already.
313   * <P>
314   * @param
315   * @return Attribute7 Value for DFF Rule Object Type
316   */
317 
318   FUNCTION get_attribute7  RETURN VARCHAR2;
319 
320   /**
321   * Returns the Attribute8 Value
322   * <P>
323   * Note: applyRule() must have been called already.
324   * <P>
325   * @param
326   * @return Attribute8 Value for DFF Rule Object Type
327   */
328 
329   FUNCTION get_attribute8  RETURN VARCHAR2;
330 
331   /**
332   * Returns the Attribute9 Value
333   * <P>
334   * Note: applyRule() must have been called already.
335   * <P>
336   * @param
337   * @return Attribute9 Value for DFF Rule Object Type
338   */
339 
340   FUNCTION get_attribute9  RETURN VARCHAR2;
341 
342   /**
343   * Returns the Attribute10 Value
344   * <P>
345   * Note: applyRule() must have been called already.
346   * <P>
347   * @param
348   * @return Attribute10 Value for DFF Rule Object Type
349   */
350 
351   FUNCTION get_attribute10  RETURN VARCHAR2;
352 
353   /**
354   * Returns the Attribute11 Value
355   * <P>
356   * Note: applyRule() must have been called already.
357   * <P>
358   * @param
359   * @return Attribute11 Value for DFF Rule Object Type
360   */
361 
362   FUNCTION get_attribute11 RETURN VARCHAR2;
363 
364   /**
365   * Returns the Attribute12 Value
366   * <P>
367   * Note: applyRule() must have been called already.
368   * <P>
369   * @param
370   * @return Attribute12 Value for DFF Rule Object Type
371   */
372 
373   FUNCTION get_attribute12  RETURN VARCHAR2;
374 
375   /**
376   * Returns the Attribute13 Value
377   * <P>
378   * Note: applyRule() must have been called already.
379   * <P>
380   * @param
381   * @return Attribute13 Value for DFF Rule Object Type
382   */
383 
384   FUNCTION get_attribute13  RETURN VARCHAR2;
385 
386   /**
387   * Returns the Attribute14 Value
388   * <P>
389   * Note: applyRule() must have been called already.
390   * <P>
391   * @param
392   * @return Attribute14 Value for DFF Rule Object Type
393   */
394 
395   FUNCTION get_attribute14  RETURN VARCHAR2;
396 
397   /**
398   * Returns the Attribute15 Value
399   * <P>
400   * Note: applyRule() must have been called already.
401   * <P>
402   * @param
403   * @return Attribute15 Value for DFF Rule Object Type
404   */
405 
406   FUNCTION get_attribute15  RETURN VARCHAR2;
407 
408   /**
409   * Returns the Attribute Value for an index
410   * <P>
411   * Note: applyRule() must have been called already.
412   * <P>
413   * @param  p_Index NUMBER
414   * @return Attribute Value at any index between 1 to 15 for DFF Rule Object Type
415   */
416 
417  FUNCTION get_attribute_at_index(p_Index IN NUMBER) RETURN VARCHAR2;
418 
419  /**
420   * Returns the Application Short Name for the Message
421   * <P>
422   * Note: applyRule() must have been called already.
423   * <P>
424   * @param
425   * @return the Application Short Name for the Message
426   */
427 
428  FUNCTION get_message_app_name RETURN VARCHAR2;
429 
430  /**
431   * Returns the RuleResults Objects Array
432   * <P>
433   * Note: applyRule() must have been called already.
434   * Usage:
435   * <P>
436   * @since  12.0+
437   * @param
438   * @return RuleResults Objects Array
439   */
440 
441  FUNCTION GET_MULTI_RULE_RESULTS_TABLE RETURN fun_rule_results_table;
442 
443 
444  /**
445   * Returns the Concatenated All Rule Names returned by Rule Engine.
446   * <P>
447   * Note: applyRule() must have been called already.
448   * Usage:
449   * <P>
450   * @since  12.0+
451   * @param
452   * @return Concatenated Rule Names.
453   */
454 
455  FUNCTION GET_ALL_RULE_NAMES  RETURN VARCHAR2;
456 
457 
458 END FUN_RULE_PUB;