[Home] [Help]
PACKAGE BODY: APPS.PAY_AU_MODULES_API
Source
1 Package Body pay_au_modules_api as
2 /* $Header: pyamoapi.pkb 120.0 2005/05/29 02:54 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33);
7 --
8 -- ------------------------------------------------------------------------
9 -- |--------------------------< create_au_module >------------------------|
10 -- ------------------------------------------------------------------------
11 --
12 procedure create_au_module
13 (p_validate in boolean default false,
14 p_name in varchar2,
15 p_enabled_flag in varchar2,
16 p_module_type_id in number,
17 p_business_group_id in number,
18 p_legislation_code in varchar2,
19 p_description in varchar2,
20 p_package_name in varchar2,
21 p_procedure_function_name in varchar2,
22 p_formula_name in varchar2,
23 p_module_id out nocopy number,
24 p_object_version_number out nocopy number) is
25 --
26 -- Declare cursors and local variables
27 --
28 --
29 -- Out variables
30 --
31 l_module_id pay_au_modules.module_id%TYPE;
32 l_object_version_number pay_au_modules.object_version_number%TYPE;
33 --
34 l_proc varchar2(72);
35 l_dummy_number number(1);
36 --
37 -- Declare a cursor that will check whether the passed
38 -- in process_id and internal_name for a unique combination
39 --
40 cursor csr_valid_combo is
41 select module_id
42 from pay_au_modules pam
43 where pam.name = p_name
44 and (pam.business_group_id is null
45 or pam.business_group_id = p_business_group_id)
46 and pam.legislation_code = p_legislation_code;
47 --
48 begin
49 l_proc := g_package||'create_au_module';
50 --
51 hr_utility.set_location('Entering:'|| l_proc, 5);
52 --
53 -- Issue a savepoint if operating in validation only mode.
54 --
55 if p_validate then
56 savepoint create_au_module;
57 end if;
58 --
59 hr_utility.set_location(l_proc, 10);
60 --
61 --
62 -- Process Logic
63 --
64 --------------------------------------------------------
65 -- Check for unique short name,business_group_id and
66 -- legislation_code combo --
67 --------------------------------------------------------
68 open csr_valid_combo;
69 fetch csr_valid_combo into l_module_id;
70
71 -- If the process parameter does not exist then create it.
72 -- Do not error if the process does exist, simply return.
73 --
74 if csr_valid_combo%notfound then
75 --
76 -- Insert the process parameter.
77 --
78 pay_amo_ins.ins
79 (
80 p_name => p_name,
81 p_enabled_flag => p_enabled_flag,
82 p_module_type_id => p_module_type_id,
83 p_business_group_id => p_business_group_id,
84 p_legislation_code => p_legislation_code,
85 p_description => p_description,
86 p_package_name => p_package_name,
87 p_procedure_function_name => p_procedure_function_name,
88 p_formula_name => p_formula_name,
89 p_module_id => l_module_id,
90 p_object_version_number => l_object_version_number
91 );
92 end if;
93 close csr_valid_combo;
94 --
95 hr_utility.set_location(l_proc, 20);
96 --
97 -- When in validation only mode raise the Validate_Enabled exception
98 --
99 if p_validate then
100 raise hr_api.validate_enabled;
101 end if;
102 --
103 -- Set all output arguments
104 --
105 p_module_id := l_module_id;
106 p_object_version_number := l_object_version_number;
107 --
108 hr_utility.set_location(' Leaving:'||l_proc, 100);
109 exception
110 when hr_api.validate_enabled then
111 --
112 -- Only set output warning arguments
113 -- (Any key or derived arguments must be set to null
114 -- when validation only mode is being used.)
115 --
116 p_module_id := null;
117 --
118 -- As the Validate_Enabled exception has been raised
119 -- we must rollback to the savepoint
120 --
121 ROLLBACK TO create_au_module;
122 --
123 end create_au_module;
124 --
125 -- ------------------------------------------------------------------------
126 -- |--------------------------< delete_au_module >------------------------|
127 -- ------------------------------------------------------------------------
128 --
129 procedure delete_au_module
130 (p_validate in boolean default false,
131 p_module_id in number,
132 p_object_version_number in number) is
133 --
134 l_proc varchar2(72);
135 --
136 begin
137 l_proc := g_package||'delete_au_module';
138 --
139 hr_utility.set_location('Entering:'|| l_proc, 5);
140 --
141 -- Issue a savepoint if operating in validation only mode.
142 --
143 if p_validate then
144 savepoint delete_au_module;
145 end if;
146 --
147 hr_utility.set_location(l_proc, 10);
148 --
149 -- Validation in addition to Table Handlers
150 --
151 -- None required.
152 --
153 -- Process Logic
154 --
155 pay_amo_del.del
156 (p_module_id => p_module_id,
157 p_object_version_number => p_object_version_number);
158 --
159 hr_utility.set_location(l_proc, 20);
160 --
161 -- When in validation only mode raise the Validate_Enabled exception
162 --
163 if p_validate then
164 raise hr_api.validate_enabled;
165 end if;
166 --
167 hr_utility.set_location(' Leaving:'||l_proc, 100);
168 exception
169 when hr_api.validate_enabled then
170 --
171 -- As the Validate_Enabled exception has been raised
172 -- we must rollback to the savepoint
173 --
174 ROLLBACK TO delete_au_module;
175 end delete_au_module;
176 --
177 --
178 -- ------------------------------------------------------------------------
179 -- |--------------------------< update_au_module >------------------------|
180 -- ------------------------------------------------------------------------
181 --
182 procedure update_au_module
183 (p_validate in boolean default false,
184 p_module_id in number,
185 p_name in varchar2,
186 p_enabled_flag in varchar2,
187 p_module_type_id in number,
188 p_business_group_id in number,
189 p_legislation_code in varchar2,
190 p_description in varchar2,
191 p_package_name in varchar2,
192 p_procedure_function_name in varchar2,
193 p_formula_name in varchar2,
194 p_object_version_number in out nocopy number
195 ) is
196 --
197 l_proc varchar2(72);
198 --
199 begin
200 l_proc := g_package||'update_au_module';
201 --
202 hr_utility.set_location('Entering:'|| l_proc, 5);
203 --
204 -- Issue a savepoint if operating in validation only mode.
205 --
206 if p_validate then
207 savepoint update_au_module;
208 end if;
209 --
210 hr_utility.set_location(l_proc, 10);
211 --
212 -- Validation in addition to Table Handlers
213 --
214 -- None required.
215 --
216 -- Process Logic
217 --
218 pay_amo_upd.upd
219 (p_module_id => p_module_id,
220 p_object_version_number => p_object_version_number,
221 p_name => p_name,
222 p_enabled_flag => p_enabled_flag,
223 p_module_type_id => p_module_type_id,
224 p_business_group_id => p_business_group_id,
225 p_legislation_code => p_legislation_code,
226 p_description => p_description,
227 p_package_name => p_package_name,
228 p_procedure_function_name => p_procedure_function_name,
229 p_formula_name => p_formula_name
230 );
231 --
232 hr_utility.set_location(l_proc, 20);
233 --
234 -- When in validation only mode raise the Validate_Enabled exception
235 --
236 if p_validate then
237 raise hr_api.validate_enabled;
238 end if;
239 --
240 hr_utility.set_location(' Leaving:'||l_proc, 100);
241 exception
242 when hr_api.validate_enabled then
243 --
244 -- As the Validate_Enabled exception has been raised
245 -- we must rollback to the savepoint
246 --
247 ROLLBACK TO update_au_module;
248 end update_au_module;
249 --
250 --
251 begin
252 g_package := ' pay_au_modules_api.';
253 end pay_au_modules_api;