1 Package Body ota_bkng_justification_swi As
2 /* $Header: otbjsswi.pkb 120.1 2005/06/06 03:35 rdola noship $ */
3 --
4 -- Package variables
5 --
6 g_package varchar2(33) := 'ota_bkng_justification_swi.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |---------------------< create_booking_justification >---------------------|
10 -- ----------------------------------------------------------------------------
11 PROCEDURE create_booking_justification
12 (p_effective_date in date
13 ,p_validate in number default hr_api.g_false_num
14 ,p_business_group_id in number
15 ,p_priority_level in varchar2
16 ,p_justification_text in varchar2
17 ,p_start_date_active in date
18 ,p_end_date_active in date default null
19 ,p_booking_justification_id in number
20 ,p_object_version_number out nocopy number
21 ,p_return_status out nocopy varchar2
22 ) is
23 --
24 -- Variables for API Boolean parameters
25 l_validate boolean;
26 --
27 -- Variables for IN/OUT parameters
28 --
29 -- Other variables
30 l_booking_justification_id number;
31 l_proc varchar2(72) := g_package ||'create_booking_justification';
32 Begin
33 hr_utility.set_location(' Entering:' || l_proc,10);
34 --
35 -- Issue a savepoint
36 --
37 savepoint create_bkng_justification_swi;
38 --
39 -- Initialise Multiple Message Detection
40 --
41 hr_multi_message.enable_message_list;
42 --
43 -- Remember IN OUT parameter IN values
44 --
45 --
46 -- Convert constant values to their corresponding boolean value
47 --
48 l_validate :=
49 hr_api.constant_to_boolean
50 (p_constant_value => p_validate);
51 --
52 -- Register Surrogate ID or user key values
53 --
54 ota_bjs_ins.set_base_key_value
55 (p_booking_justification_id => p_booking_justification_id
56 );
57 --
58 -- Call API
59 --
60 ota_bkng_justification_api.create_booking_justification
61 (p_effective_date => p_effective_date
62 ,p_validate => l_validate
63 ,p_business_group_id => p_business_group_id
64 ,p_priority_level => p_priority_level
65 ,p_justification_text => p_justification_text
66 ,p_start_date_active => p_start_date_active
67 ,p_end_date_active => p_end_date_active
68 ,p_booking_justification_id => l_booking_justification_id
69 ,p_object_version_number => p_object_version_number
70 );
71 --
72 -- Convert API warning boolean parameter values to specific
73 -- messages and add them to Multiple Message List
74 --
75 --
76 -- Convert API non-warning boolean parameter values
77 --
78 --
79 -- Derive the API return status value based on whether
80 -- messages of any type exist in the Multiple Message List.
81 -- Also disable Multiple Message Detection.
82 --
83 p_return_status := hr_multi_message.get_return_status_disable;
84 hr_utility.set_location(' Leaving:' || l_proc,20);
85 --
86 exception
87 when hr_multi_message.error_message_exist then
88 --
89 -- Catch the Multiple Message List exception which
90 -- indicates API processing has been aborted because
91 -- at least one message exists in the list.
92 --
93 rollback to create_bkng_justification_swi;
94 --
95 -- Reset IN OUT parameters and set OUT parameters
96 --
97 p_object_version_number := null;
98 p_return_status := hr_multi_message.get_return_status_disable;
99 hr_utility.set_location(' Leaving:' || l_proc, 30);
100 when others then
101 --
102 -- When Multiple Message Detection is enabled catch
103 -- any Application specific or other unexpected
104 -- exceptions. Adding appropriate details to the
105 -- Multiple Message List. Otherwise re-raise the
106 -- error.
107 --
108 rollback to create_bkng_justification_swi;
109 if hr_multi_message.unexpected_error_add(l_proc) then
110 hr_utility.set_location(' Leaving:' || l_proc,40);
111 raise;
112 end if;
113 --
114 -- Reset IN OUT and set OUT parameters
115 --
116 p_object_version_number := null;
117 p_return_status := hr_multi_message.get_return_status_disable;
118 hr_utility.set_location(' Leaving:' || l_proc,50);
119 end create_booking_justification;
120 -- ----------------------------------------------------------------------------
121 -- |---------------------< update_booking_justification >---------------------|
122 -- ----------------------------------------------------------------------------
123 PROCEDURE update_booking_justification
124 (p_effective_date in date
125 ,p_booking_justification_id in number
126 ,p_object_version_number in out nocopy number
127 ,p_priority_level in varchar2 default hr_api.g_varchar2
128 ,p_justification_text in varchar2 default hr_api.g_varchar2
129 ,p_start_date_active in date default hr_api.g_date
130 ,p_end_date_active in date default hr_api.g_date
131 ,p_business_group_id in number default hr_api.g_number
132 ,p_validate in number default hr_api.g_false_num
133 ,p_return_status out nocopy varchar2
134 ) is
135 --
136 -- Variables for API Boolean parameters
137 l_validate boolean;
138 --
139 -- Variables for IN/OUT parameters
140 l_object_version_number number;
141 --
142 -- Other variables
143 l_proc varchar2(72) := g_package ||'update_booking_justification';
144 Begin
145 hr_utility.set_location(' Entering:' || l_proc,10);
146 --
147 -- Issue a savepoint
148 --
149 savepoint update_bkng_justification_swi;
150 --
151 -- Initialise Multiple Message Detection
152 --
153 hr_multi_message.enable_message_list;
154 --
155 -- Remember IN OUT parameter IN values
156 --
157 l_object_version_number := p_object_version_number;
158 --
159 -- Convert constant values to their corresponding boolean value
160 --
161 l_validate :=
162 hr_api.constant_to_boolean
163 (p_constant_value => p_validate);
164 --
165 -- Register Surrogate ID or user key values
166 --
167 --
168 -- Call API
169 --
170 ota_bkng_justification_api.update_booking_justification
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_justification_text => p_justification_text
176 ,p_start_date_active => p_start_date_active
177 ,p_end_date_active => p_end_date_active
178 ,p_business_group_id => p_business_group_id
179 ,p_validate => l_validate
180 );
181 --
182 -- Convert API warning boolean parameter values to specific
183 -- messages and add them to Multiple Message List
184 --
185 --
186 -- Convert API non-warning boolean parameter values
187 --
188 --
189 -- Derive the API return status value based on whether
190 -- messages of any type exist in the Multiple Message List.
191 -- Also disable Multiple Message Detection.
192 --
193 p_return_status := hr_multi_message.get_return_status_disable;
194 hr_utility.set_location(' Leaving:' || l_proc,20);
195 --
196 exception
197 when hr_multi_message.error_message_exist then
198 --
199 -- Catch the Multiple Message List exception which
200 -- indicates API processing has been aborted because
201 -- at least one message exists in the list.
202 --
203 rollback to update_bkng_justification_swi;
204 --
205 -- Reset IN OUT parameters and set OUT parameters
206 --
207 p_object_version_number := l_object_version_number;
208 p_return_status := hr_multi_message.get_return_status_disable;
209 hr_utility.set_location(' Leaving:' || l_proc, 30);
210 when others then
211 --
212 -- When Multiple Message Detection is enabled catch
213 -- any Application specific or other unexpected
214 -- exceptions. Adding appropriate details to the
215 -- Multiple Message List. Otherwise re-raise the
216 -- error.
217 --
218 rollback to update_bkng_justification_swi;
219 if hr_multi_message.unexpected_error_add(l_proc) then
220 hr_utility.set_location(' Leaving:' || l_proc,40);
221 raise;
222 end if;
223 --
224 -- Reset IN OUT and set OUT parameters
225 --
226 p_object_version_number := l_object_version_number;
227 p_return_status := hr_multi_message.get_return_status_disable;
228 hr_utility.set_location(' Leaving:' || l_proc,50);
229 end update_booking_justification;
230 -- ----------------------------------------------------------------------------
231 -- |---------------------< delete_booking_justification >---------------------|
232 -- ----------------------------------------------------------------------------
233 PROCEDURE delete_booking_justification
234 (p_booking_justification_id in number
235 ,p_object_version_number in number
236 ,p_validate in number default hr_api.g_false_num
237 ,p_return_status out nocopy varchar2
238 ) is
239 --
240 -- Variables for API Boolean parameters
241 l_validate boolean;
242 --
243 -- Variables for IN/OUT parameters
244 --
245 -- Other variables
246 l_proc varchar2(72) := g_package ||'delete_booking_justification';
247 Begin
248 hr_utility.set_location(' Entering:' || l_proc,10);
249 --
250 -- Issue a savepoint
251 --
252 savepoint delete_bkng_justification_swi;
253 --
254 -- Initialise Multiple Message Detection
255 --
256 hr_multi_message.enable_message_list;
257 --
258 -- Remember IN OUT parameter IN values
259 --
260 --
261 -- Convert constant values to their corresponding boolean value
262 --
263 l_validate :=
264 hr_api.constant_to_boolean
265 (p_constant_value => p_validate);
266 --
267 -- Register Surrogate ID or user key values
268 --
269 --
270 -- Call API
271 --
272 ota_bkng_justification_api.delete_booking_justification
273 (p_booking_justification_id => p_booking_justification_id
274 ,p_object_version_number => p_object_version_number
275 ,p_validate => l_validate
276 );
277 --
278 -- Convert API warning boolean parameter values to specific
279 -- messages and add them to Multiple Message List
280 --
281 --
282 -- Convert API non-warning boolean parameter values
283 --
284 --
285 -- Derive the API return status value based on whether
286 -- messages of any type exist in the Multiple Message List.
287 -- Also disable Multiple Message Detection.
288 --
289 p_return_status := hr_multi_message.get_return_status_disable;
290 hr_utility.set_location(' Leaving:' || l_proc,20);
291 --
292 exception
293 when hr_multi_message.error_message_exist then
294 --
295 -- Catch the Multiple Message List exception which
296 -- indicates API processing has been aborted because
297 -- at least one message exists in the list.
298 --
299 rollback to delete_bkng_justification_swi;
300 --
301 -- Reset IN OUT parameters and set OUT parameters
302 --
303 p_return_status := hr_multi_message.get_return_status_disable;
304 hr_utility.set_location(' Leaving:' || l_proc, 30);
305 when others then
306 --
307 -- When Multiple Message Detection is enabled catch
308 -- any Application specific or other unexpected
309 -- exceptions. Adding appropriate details to the
310 -- Multiple Message List. Otherwise re-raise the
311 -- error.
312 --
313 rollback to delete_bkng_justification_swi;
314 if hr_multi_message.unexpected_error_add(l_proc) then
315 hr_utility.set_location(' Leaving:' || l_proc,40);
316 raise;
317 end if;
318 --
319 -- Reset IN OUT and set OUT parameters
320 --
321 p_return_status := hr_multi_message.get_return_status_disable;
322 hr_utility.set_location(' Leaving:' || l_proc,50);
323 end delete_booking_justification;
324 end ota_bkng_justification_swi;