[Home] [Help]
PACKAGE BODY: APPS.OTA_BKNG_JUSTIFICATION_API
Source
1 Package Body OTA_BKNG_JUSTIFICATION_API as
2 /* $Header: otbjsapi.pkb 120.0 2005/05/29 07:02:38 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' OTA_BKNG_JUSTIFICATION_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-------------------------< CREATE_BOOKING_JUSTIFICATION >------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_booking_justification
13 (
14 p_effective_date in date,
15 p_validate in boolean,
16 p_business_group_id in number,
17 p_priority_level in varchar2,
18 p_justification_text in varchar2,
19 p_start_date_active in date,
20 p_end_date_active in date,
21 p_booking_justification_id out nocopy number,
22 p_object_version_number out nocopy number
23 ) is
24 --
25 -- Declare cursors and local variables
26 --
27 l_booking_justification_id ota_bkng_justifications_b.booking_justification_id%TYPE;
28 l_object_version_number ota_bkng_justifications_b.object_version_number%TYPE;
29 l_effective_date date;
30 l_proc varchar2(72) := g_package||' create_booking_justification';
31 begin
32 hr_utility.set_location('Entering:'|| l_proc, 10);
33 --
34 -- Issue a savepoint
35 --
36 savepoint CREATE_BOOKING_JUSTIFICATION;
37 l_effective_date := trunc(p_effective_date);
38
39
40 begin
41 ota_bkng_justification_bk1.create_booking_justification_b
42 ( p_effective_date => p_effective_date
43 ,p_validate => p_validate
44 ,p_priority_level => p_priority_level
45 ,p_start_date_active => p_start_date_active
46 ,p_end_date_active => p_end_date_active
47 ,p_business_group_id => p_business_group_id
48 ,p_justification_text => p_justification_text
49 );
50 exception
51 when hr_api.cannot_find_prog_unit then
52 hr_api.cannot_find_prog_unit_error
53 (p_module_name => 'CREATE_BKNG_JUSTIFICATION'
54 ,p_hook_type => 'BP'
55 );
56 end;
57
58 --
59 -- Process Logic
60 --
61 ota_bjs_ins.ins
62 (
63 p_effective_date => p_effective_date
64 ,p_business_group_id => p_business_group_id
65 ,p_start_date_active => p_start_date_active
66 ,p_end_date_active => p_end_date_active
67 ,p_priority_level => p_priority_level
68 ,p_booking_justification_id => l_booking_justification_id
69 ,p_object_version_number => l_object_version_number
70 );
71
72 --
73 -- Set all output arguments
74 --
75 p_booking_justification_id := l_booking_justification_id;
76 p_object_version_number := l_object_version_number;
77
78
79 ota_bjt_ins.ins_tl
80 ( p_language_code => USERENV('LANG')
81 ,p_booking_justification_id => p_booking_justification_id
82 ,p_justification_text => rtrim(p_justification_text)
83 );
84
85 begin
86
87
88 ota_bkng_justification_bk1.create_booking_justification_a
89 ( p_effective_date => p_effective_date
90 ,p_validate => p_validate
91 ,p_priority_level => p_priority_level
92 ,p_start_date_active => p_start_date_active
93 ,p_end_date_active => p_end_date_active
94 ,p_business_group_id => p_business_group_id
95 ,p_justification_text => p_justification_text
96 );
97 exception
98 when hr_api.cannot_find_prog_unit then
99 hr_api.cannot_find_prog_unit_error
100 (p_module_name => 'CREATE_BKNG_JUSTIFICATION'
101 ,p_hook_type => 'AP'
102 );
103 end;
104
105
106 --
107 -- When in validation only mode raise the Validate_Enabled exception
108 --
109 if p_validate then
110 raise hr_api.validate_enabled;
111 end if;
112
113 hr_utility.set_location(' Leaving:'||l_proc, 70);
114 exception
115 when hr_api.validate_enabled then
116 --
117 -- As the Validate_Enabled exception has been raised
118 -- we must rollback to the savepoint
119 --
120 rollback to CREATE_BOOKING_JUSTIFICATION;
121 --
122 -- Only set output warning arguments
123 -- (Any key or derived arguments must be set to null
124 -- when validation only mode is being used.)
125 --
126 p_booking_justification_id := null;
127 p_object_version_number := null;
128 hr_utility.set_location(' Leaving:'||l_proc, 80);
129 when others then
130 --
131 -- A validation or unexpected error has occured
132 --
133 rollback to CREATE_BOOKING_JUSTIFICATION;
134 p_booking_justification_id := null;
135 p_object_version_number := null;
136 hr_utility.set_location(' Leaving:'||l_proc, 90);
137 raise;
138 end create_booking_justification;
139 -- ----------------------------------------------------------------------------
140 -- |-------------------------< UPDATE_BOOKING_JUSTIFICATION >-------------------------|
141 -- ----------------------------------------------------------------------------
142 --
143 procedure update_booking_justification
144 (
145 p_effective_date in date,
146 p_booking_justification_id in number,
147 p_object_version_number in out nocopy number,
148 p_priority_level in varchar2,
149 p_justification_text in varchar2,
150 p_start_date_active in date,
151 p_end_date_active in date,
152 p_business_group_id in number,
153 p_validate in boolean
154 ) is
155 --
156 -- Declare cursors and local variables
157 --
158 l_proc varchar2(72) := g_package||' Update Booking Justification';
159 l_object_version_number number := p_object_version_number;
160 l_effective_date date;
161 begin
162 hr_utility.set_location('Entering:'|| l_proc, 10);
163 --
164 -- Issue a savepoint
165 --
166 savepoint UPDATE_BOOKING_JUSTIFICATION;
167 l_effective_date := trunc(p_effective_date);
168
169 begin
170 ota_bkng_justification_bk2.update_booking_justification_b
171 (p_effective_date => p_effective_date
172 ,p_booking_justification_id => p_booking_justification_id
173 ,p_object_version_number => p_object_version_number
174 ,p_priority_level => p_priority_level
175 ,p_start_date_active => p_start_date_active
176 ,p_end_date_active => p_end_date_active
177 ,p_business_group_id => p_business_group_id
178 ,p_justification_text => p_justification_text
179 ,p_validate => p_validate
180 );
181
182
183 exception
184 when hr_api.cannot_find_prog_unit then
185 hr_api.cannot_find_prog_unit_error
186 (p_module_name => 'UPDATE_BKNG_JUSTIFICATION'
187 ,p_hook_type => 'BP'
188 );
189 end;
190
191 --
192 --
193 -- Process Logic
194 --
195 ota_bjs_upd.upd
196 (
197 p_effective_date => p_effective_date
198 ,p_business_group_id => p_business_group_id
199 ,p_start_date_active => p_start_date_active
200 ,p_end_date_active => p_end_date_active
201 ,p_priority_level => p_priority_level
202 ,p_object_version_number => p_object_version_number
203 ,p_booking_justification_id => p_booking_justification_id
204 );
205
206 ota_bjt_upd.upd_tl
207 ( p_language_code => USERENV('LANG')
208 ,p_booking_justification_id => p_booking_justification_id
209 ,p_justification_text => rtrim(p_justification_text)
210 );
211
212
213 begin
214 ota_bkng_justification_bk2.update_booking_justification_a
215 (p_effective_date => p_effective_date
216 ,p_booking_justification_id => p_booking_justification_id
217 ,p_object_version_number => p_object_version_number
218 ,p_priority_level => p_priority_level
219 ,p_start_date_active => p_start_date_active
220 ,p_end_date_active => p_end_date_active
221 ,p_business_group_id => p_business_group_id
222 ,p_justification_text => p_justification_text
223 ,p_validate => p_validate
224 );
225
226
227 exception
228 when hr_api.cannot_find_prog_unit then
229 hr_api.cannot_find_prog_unit_error
230 (p_module_name => 'UPDATE_BKNG_JUSTIFICATION'
231 ,p_hook_type => 'AP'
232 );
233 end;
234
235 --
236 -- When in validation only mode raise the Validate_Enabled exception
237 --
238 if p_validate then
239 raise hr_api.validate_enabled;
240 end if;
241 --
242 -- Set all output arguments
243 --
244 hr_utility.set_location(' Leaving:'||l_proc, 70);
245 exception
246 when hr_api.validate_enabled then
247 --
248 -- As the Validate_Enabled exception has been raised
249 -- we must rollback to the savepoint
250 --
251 rollback to UPDATE_BOOKING_JUSTIFICATION;
252 --
253 -- Only set output warning arguments
254 -- (Any key or derived arguments must be set to null
255 -- when validation only mode is being used.)
256 --
257 p_object_version_number := null;
258 hr_utility.set_location(' Leaving:'||l_proc, 80);
259 when others then
260 --
261 -- A validation or unexpected error has occured
262 --
263 rollback to UPDATE_BOOKING_JUSTIFICATION;
264 p_object_version_number := l_object_version_number;
265 hr_utility.set_location(' Leaving:'||l_proc, 90);
266 raise;
267 end update_booking_justification;
268 --
269 -- ----------------------------------------------------------------------------
270 -- |-------------------------< DELETE_BOOKING_JUSTIFICATION >-------------------|
271 -- ----------------------------------------------------------------------------
272 --
273 procedure delete_booking_justification
274 (
275 p_booking_justification_id in number,
276 p_object_version_number in number,
277 p_validate in boolean
278 ) is
279 --
280 -- Declare cursors and local variables
281 --
282 l_proc varchar2(72) := g_package||' Delete Booking Justification';
283 --
284 --
285 begin
286 hr_utility.set_location('Entering:'|| l_proc, 10);
287 --
288 -- Issue a savepoint
289 --
290 savepoint DELETE_BOOKING_JUSTIFICATION;
291 --
292 -- Truncate the time portion from all IN date parameters
293 --
294 --
295
296 begin
297 ota_bkng_justification_bk3.delete_booking_justification_b
298 (p_booking_justification_id => p_booking_justification_id
299 ,p_object_version_number => p_object_version_number
300 );
301 exception
302 when hr_api.cannot_find_prog_unit then
303 hr_api.cannot_find_prog_unit_error
304 (p_module_name => 'DELETE_BKNG_JUSTIFICATION'
305 ,p_hook_type => 'BP'
306 );
307 end;
308
309 --
310 -- Process Logic
311 --
312 ota_bjt_del.del_tl
313 (p_booking_justification_id => p_booking_justification_id
314 );
315
316 ota_bjs_del.del
317 (
318 p_booking_justification_id => p_booking_justification_id ,
319 p_object_version_number => p_object_version_number
320 );
321
322
323 begin
324 ota_bkng_justification_bk3.delete_booking_justification_a
325 (p_booking_justification_id => p_booking_justification_id
326 ,p_object_version_number => p_object_version_number
327 );
328 exception
329 when hr_api.cannot_find_prog_unit then
330 hr_api.cannot_find_prog_unit_error
331 (p_module_name => 'DELETE_BKNG_JUSTIFICATION'
332 ,p_hook_type => 'AP'
333 );
334 end;
335
336 --
337 -- When in validation only mode raise the Validate_Enabled exception
338 --
339 if p_validate then
340 raise hr_api.validate_enabled;
341 end if;
342 --
343 -- Set all output arguments
344 --
345 --
346 hr_utility.set_location(' Leaving:'||l_proc, 170);
347 exception
348 when hr_api.validate_enabled then
349 --
350 -- As the Validate_Enabled exception has been raised
351 -- we must rollback to the savepoint
352 --
353 rollback to DELETE_BOOKING_JUSTIFICATION;
354 --
355 -- Only set output warning arguments
356 -- (Any key or derived arguments must be set to null
357 -- when validation only mode is being used.)
358 --
359 hr_utility.set_location(' Leaving:'||l_proc, 180);
360 when others then
361 --
362 -- A validation or unexpected error has occured
363 --
364 rollback to DELETE_BOOKING_JUSTIFICATION;
365 hr_utility.set_location(' Leaving:'||l_proc, 190);
366 raise;
367 end delete_booking_justification;
368 --
369 end ota_bkng_justification_api;