DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKL_ECC_PUB

Source


1 PACKAGE BODY okl_ecc_pub AS
2 /* $Header: OKLPECUB.pls 120.1 2005/08/23 05:41:52 asawanka noship $ */
3 
4   /**
5       THis function is a wrapper over okl_ec_evaluate_pvt.validate which
6       validates the eligibility criteria present on source object.
7       The fields in p_okl_ec_rec, corressponding to the eligibility criteria category
8       applicable to the source type, should be filled in p_okl_ec_rec.
9   **/
10 
11   PROCEDURE evaluate_eligibility_criteria(
12                                           p_api_version                  IN              number
13                                          ,p_init_msg_list                IN              varchar2 DEFAULT okl_api.g_false
14                                          ,x_return_status                     OUT nocopy varchar2
15                                          ,x_msg_count                         OUT nocopy number
16                                          ,x_msg_data                          OUT nocopy varchar2
17                                          ,p_okl_ec_rec                   IN   OUT nocopy okl_ec_rec_type
18                                          ,x_eligible                          OUT nocopy boolean
19                                          ) IS
20     l_module              CONSTANT fnd_log_messages.module%TYPE := 'okl.plsql.okl_ecc_pub.evaluate_eligibility_criteria';
21     l_debug_enabled                varchar2(10);
22     is_debug_procedure_on          boolean;
23     is_debug_statement_on          boolean;
24 
25   BEGIN
26     l_debug_enabled := okl_debug_pub.check_log_enabled;
27     is_debug_procedure_on := okl_debug_pub.check_log_on(l_module
28                                                        ,fnd_log.level_procedure);
29 
30     IF (l_debug_enabled = 'Y' AND is_debug_procedure_on) THEN
31       okl_debug_pub.log_debug(fnd_log.level_procedure
32                              ,l_module
33                              ,'begin debug OKLPECVB.pls call evaluate_eligibility_criteria');
34     END IF;
35 
36     -- check for logging on STATEMENT level
37 
38     is_debug_statement_on := okl_debug_pub.check_log_on(l_module
39                                                        ,fnd_log.level_statement);
40 
41     --Now call the validate procedure
42     okl_ec_evaluate_pvt.validate(
43                                  p_api_version   => p_api_version,
44                                  p_init_msg_list => p_init_msg_list,
45                                  x_return_status => x_return_status,
46                                  x_msg_count     => x_msg_count,
47                                  x_msg_data      => x_msg_data,
48                                  p_okl_ec_rec    => p_okl_ec_rec,
49                                  x_eligible      => x_eligible
50                                 );
51 
52     IF (x_return_status = okl_api.g_ret_sts_unexp_error) THEN
53         RAISE okl_api.g_exception_unexpected_error;
54     ELSIF (x_return_status = okl_api.g_ret_sts_error) THEN
55         RAISE okl_api.g_exception_error;
56     END IF;
57 
58     IF (l_debug_enabled = 'Y' AND is_debug_procedure_on) THEN
59       okl_debug_pub.log_debug(fnd_log.level_procedure
60                              ,l_module
61                              ,'end debug OKLPECVB.pls call evaluate_eligibility_criteria');
62     END IF;
63     x_return_status := okl_api.g_ret_sts_success;
64 
65     EXCEPTION
66       WHEN okl_api.g_exception_error THEN
67         x_return_status := okl_api.g_ret_sts_error;
68 
69       WHEN okl_api.g_exception_unexpected_error THEN
70         x_return_status := okl_api.g_ret_sts_unexp_error;
71 
72       WHEN OTHERS THEN
73         -- unexpected error
74         OKL_API.set_message(p_app_name      => g_app_name,
75                             p_msg_name      => g_unexpected_error,
76                             p_token1        => g_sqlcode_token,
77                             p_token1_value  => sqlcode,
78                             p_token2        => g_sqlerrm_token,
79                             p_token2_value  => sqlerrm);
80 
81   END evaluate_eligibility_criteria;
82 
83 /**
84     This function is a wrapper over okl_ec_evaluate_pvt.compare_eligibility_criteria
85     which checks the existenace of at lease one scenario wherein
86     common eligibility criteria defined on both the sources can be passed
87     successfully.If such scenario exists function returns true else false.
88     If there are no common eligibility criteria no comparison is done and
89     function returns true.
90 **/
91 
92   FUNCTION compare_eligibility_criteria(p_source_id1    IN  number
93                                        ,p_source_type1  IN  varchar2
94                                        ,p_source_id2    IN  number
95                                        ,p_source_type2  IN  varchar2) RETURN boolean IS
96     l_ret                          boolean;
97     l_module              CONSTANT fnd_log_messages.module%TYPE := 'okl.plsql.okl_ecc_pub.compare_eligibility_criteria';
98     l_debug_enabled                varchar2(10);
99     is_debug_procedure_on          boolean;
100     is_debug_statement_on          boolean;
101 
102   BEGIN
103     l_debug_enabled := okl_debug_pub.check_log_enabled;
104     is_debug_procedure_on := okl_debug_pub.check_log_on(l_module
105                                                        ,fnd_log.level_procedure);
106 
107     IF (l_debug_enabled = 'Y' AND is_debug_procedure_on) THEN
108       okl_debug_pub.log_debug(fnd_log.level_procedure
109                              ,l_module
110                              ,'begin debug OKLPECVB.pls call compare_eligibility_criteria');
111     END IF;
112 
113     -- check for logging on STATEMENT level
114 
115     is_debug_statement_on := okl_debug_pub.check_log_on(l_module
116                                                        ,fnd_log.level_statement);
117 
118     --Now call the compare_eligibility_criteria function
119 
120     l_ret := okl_ec_evaluate_pvt.compare_eligibility_criteria(p_source_id1
121                                                              ,p_source_type1
122                                                              ,p_source_id2
123                                                              ,p_source_type2);
124 
125     IF (l_debug_enabled = 'Y' AND is_debug_procedure_on) THEN
126       okl_debug_pub.log_debug(fnd_log.level_procedure
127                              ,l_module
128                              ,'end debug OKLPECVB.pls call compare_eligibility_criteria');
129     END IF;
130     RETURN l_ret;
131   END compare_eligibility_criteria;
132 
133 END okl_ecc_pub;