DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TRB_DEL

Source


1 Package Body ota_trb_del as
2 /* $Header: ottrbrhi.pkb 120.6.12000000.3 2007/07/05 09:22:53 aabalakr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ota_trb_del.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< delete_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml delete logic. The functions of
17 --   this procedure are as follows:
18 --   1) To set and unset the g_api_dml status as required (as we are about to
19 --      perform dml).
20 --   2) To delete the specified row from the schema using the primary key in
21 --      the predicates.
22 --   3) To trap any constraint violations that may have occurred.
23 --   4) To raise any other errors.
24 --
25 -- Prerequisites:
26 --   This is an internal private procedure which must be called from the del
27 --   procedure.
28 --
29 -- In Parameters:
30 --   A Pl/Sql record structre.
31 --
32 -- Post Success:
33 --   The specified row will be delete from the schema.
34 --
35 -- Post Failure:
36 --   On the delete dml failure it is important to note that we always reset the
37 --   g_api_dml status to false.
38 --   If a child integrity constraint violation is raised the
39 --   constraint_error procedure will be called.
40 --   If any other error is reported, the error will be raised after the
41 --   g_api_dml status is reset.
42 --
43 -- Developer Implementation Notes:
44 --   None.
45 --
46 -- Access Status:
47 --   Internal Row Handler Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml
52   (p_rec in ota_trb_shd.g_rec_type
53   ) is
54 --
55   l_proc  varchar2(72) := g_package||'delete_dml';
56 --
57 Begin
58   hr_utility.set_location('Entering:'||l_proc, 5);
59   --
60   ota_trb_shd.g_api_dml := true;  -- Set the api dml status
61   --
62   -- Delete the ota_resource_bookings row.
63   --
64   delete from ota_resource_bookings
65   where resource_booking_id = p_rec.resource_booking_id;
66   --
67   ota_trb_shd.g_api_dml := false;   -- Unset the api dml status
68   --
69   hr_utility.set_location(' Leaving:'||l_proc, 10);
70 --
71 Exception
72   When hr_api.child_integrity_violated then
73     -- Child integrity has been violated
74     ota_trb_shd.g_api_dml := false;   -- Unset the api dml status
75     ota_trb_shd.constraint_error
76       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
77   When Others Then
78     ota_trb_shd.g_api_dml := false;   -- Unset the api dml status
79     Raise;
80 End delete_dml;
81 --
82 -- ----------------------------------------------------------------------------
83 -- |------------------------------< pre_delete >------------------------------|
84 -- ----------------------------------------------------------------------------
85 -- {Start Of Comments}
86 --
87 -- Description:
88 --   This private procedure contains any processing which is required before
89 --   the delete dml.
90 --
91 -- Prerequisites:
92 --   This is an internal procedure which is called from the del procedure.
93 --
94 -- In Parameters:
95 --   A Pl/Sql record structre.
96 --
97 -- Post Success:
98 --   Processing continues.
99 --
100 -- Post Failure:
101 --   If an error has occurred, an error message and exception will be raised
102 --   but not handled.
103 --
104 -- Developer Implementation Notes:
105 --   Any pre-processing required before the delete dml is issued should be
106 --   coded within this procedure. It is important to note that any 3rd party
107 --   maintenance should be reviewed before placing in this procedure.
108 --
109 -- Access Status:
110 --   Internal Row Handler Use Only.
111 --
112 -- {End Of Comments}
113 -- ----------------------------------------------------------------------------
114 Procedure pre_delete(p_rec in ota_trb_shd.g_rec_type) is
115 --
116   l_proc  varchar2(72) := g_package||'pre_delete';
117 --
118 Begin
119   hr_utility.set_location('Entering:'||l_proc, 5);
120   --
121   -- Check if resource exists in allocations
122   --
123   ota_trb_api_procedures.check_tra_resource_exists(p_rec.resource_booking_id);
124   --
125   -- Check if trainer exists in allocations
126   --
127   ota_trb_api_procedures.check_tra_trainer_exists(p_rec.resource_booking_id);
128   --
129   -- check if finance lines exist.
130   --
131   ota_trb_api_procedures.check_if_tfl_exists(p_rec.resource_booking_id);
132   --
133   --
134   hr_utility.set_location(' Leaving:'||l_proc, 10);
135 End pre_delete;
136 --
137 -- ----------------------------------------------------------------------------
138 -- |-----------------------------< post_delete >------------------------------|
139 -- ----------------------------------------------------------------------------
140 -- {Start Of Comments}
141 --
142 -- Description:
143 --   This private procedure contains any processing which is required after
144 --   the delete dml.
145 --
146 -- Prerequistes:
147 --   This is an internal procedure which is called from the del procedure.
148 --
149 -- In Parameters:
150 --   A Pl/Sql record structure.
151 --
152 -- Post Success:
153 --   Processing continues.
154 --
155 -- Post Failure:
156 --   If an error has occurred, an error message and exception will be raised
157 --   but not handled.
158 --
159 -- Developer Implementation Notes:
160 --   Any post-processing required after the delete dml is issued should be
161 --   coded within this procedure. It is important to note that any 3rd party
162 --   maintenance should be reviewed before placing in this procedure.
163 --
164 -- Access Status:
165 --   Internal Row Handler Use Only.
166 --
167 -- {End Of Comments}
168 -- -----------------------------------------------------------------------------
169 Procedure post_delete(p_rec in ota_trb_shd.g_rec_type) is
170 --
171   l_proc  varchar2(72) := g_package||'post_delete';
172 --
173 Begin
174   hr_utility.set_location('Entering:'||l_proc, 5);
175   begin
176     --
177     ota_trb_rkd.after_delete
178       (p_resource_booking_id
179       => p_rec.resource_booking_id
180       ,p_supplied_resource_id_o
181       => ota_trb_shd.g_old_rec.supplied_resource_id
182       ,p_event_id_o
183       => ota_trb_shd.g_old_rec.event_id
184       ,p_date_booking_placed_o
185       => ota_trb_shd.g_old_rec.date_booking_placed
186       ,p_object_version_number_o
187       => ota_trb_shd.g_old_rec.object_version_number
188       ,p_status_o
189       => ota_trb_shd.g_old_rec.status
190       ,p_absolute_price_o
191       => ota_trb_shd.g_old_rec.absolute_price
192       ,p_booking_person_id_o
193       => ota_trb_shd.g_old_rec.booking_person_id
194       ,p_comments_o
195       => ota_trb_shd.g_old_rec.comments
196       ,p_contact_name_o
197       => ota_trb_shd.g_old_rec.contact_name
198       ,p_contact_phone_number_o
199       => ota_trb_shd.g_old_rec.contact_phone_number
200       ,p_delegates_per_unit_o
201       => ota_trb_shd.g_old_rec.delegates_per_unit
202       ,p_quantity_o
203       => ota_trb_shd.g_old_rec.quantity
204       ,p_required_date_from_o
205       => ota_trb_shd.g_old_rec.required_date_from
206       ,p_required_date_to_o
207       => ota_trb_shd.g_old_rec.required_date_to
208       ,p_required_end_time_o
209       => ota_trb_shd.g_old_rec.required_end_time
210       ,p_required_start_time_o
211       => ota_trb_shd.g_old_rec.required_start_time
212       ,p_deliver_to_o
213       => ota_trb_shd.g_old_rec.deliver_to
214       ,p_primary_venue_flag_o
215       => ota_trb_shd.g_old_rec.primary_venue_flag
216       ,p_role_to_play_o
217       => ota_trb_shd.g_old_rec.role_to_play
218       ,p_trb_information_category_o
219       => ota_trb_shd.g_old_rec.trb_information_category
220       ,p_trb_information1_o
221       => ota_trb_shd.g_old_rec.trb_information1
222       ,p_trb_information2_o
223       => ota_trb_shd.g_old_rec.trb_information2
224       ,p_trb_information3_o
225       => ota_trb_shd.g_old_rec.trb_information3
226       ,p_trb_information4_o
227       => ota_trb_shd.g_old_rec.trb_information4
228       ,p_trb_information5_o
229       => ota_trb_shd.g_old_rec.trb_information5
230       ,p_trb_information6_o
231       => ota_trb_shd.g_old_rec.trb_information6
232       ,p_trb_information7_o
233       => ota_trb_shd.g_old_rec.trb_information7
234       ,p_trb_information8_o
235       => ota_trb_shd.g_old_rec.trb_information8
236       ,p_trb_information9_o
237       => ota_trb_shd.g_old_rec.trb_information9
238       ,p_trb_information10_o
239       => ota_trb_shd.g_old_rec.trb_information10
240       ,p_trb_information11_o
241       => ota_trb_shd.g_old_rec.trb_information11
242       ,p_trb_information12_o
243       => ota_trb_shd.g_old_rec.trb_information12
244       ,p_trb_information13_o
245       => ota_trb_shd.g_old_rec.trb_information13
246       ,p_trb_information14_o
247       => ota_trb_shd.g_old_rec.trb_information14
248       ,p_trb_information15_o
249       => ota_trb_shd.g_old_rec.trb_information15
250       ,p_trb_information16_o
251       => ota_trb_shd.g_old_rec.trb_information16
252       ,p_trb_information17_o
253       => ota_trb_shd.g_old_rec.trb_information17
254       ,p_trb_information18_o
255       => ota_trb_shd.g_old_rec.trb_information18
256       ,p_trb_information19_o
257       => ota_trb_shd.g_old_rec.trb_information19
258       ,p_trb_information20_o
259       => ota_trb_shd.g_old_rec.trb_information20
260       ,p_display_to_learner_flag_o
261       => ota_trb_shd.g_old_rec.display_to_learner_flag
262       ,p_book_entire_period_flag_o
263       => ota_trb_shd.g_old_rec.book_entire_period_flag
264     /*  ,p_unbook_request_flag_o
265       => ota_trb_shd.g_old_rec.unbook_request_flag */
266       ,p_chat_id_o
267       => ota_trb_shd.g_old_rec.chat_id
268       ,p_forum_id_o
269       => ota_trb_shd.g_old_rec.forum_id
270       ,p_timezone_code_o
271       => ota_trb_shd.g_old_rec.timezone_code
272       );
273     --
274   exception
275     --
276     when hr_api.cannot_find_prog_unit then
277       --
278       hr_api.cannot_find_prog_unit_error
279         (p_module_name => 'OTA_RESOURCE_BOOKINGS'
280         ,p_hook_type   => 'AD');
281       --
282   end;
283   --
284   hr_utility.set_location(' Leaving:'||l_proc, 10);
285 End post_delete;
286 --
287 -- ----------------------------------------------------------------------------
288 -- |---------------------------------< del >----------------------------------|
289 -- ----------------------------------------------------------------------------
290 Procedure del
291   (p_rec              in ota_trb_shd.g_rec_type
292   ) is
293 --
294   l_proc  varchar2(72) := g_package||'del';
295 --
296 Begin
297   hr_utility.set_location('Entering:'||l_proc, 5);
298   --
299   -- We must lock the row which we need to delete.
300   --
301   ota_trb_shd.lck
302     (p_rec.resource_booking_id
303     ,p_rec.object_version_number
304     );
305   --
306   -- Call the supporting delete validate operation
307   --
308   ota_trb_bus.delete_validate(p_rec);
309   --
310   -- Call to raise any errors on multi-message list
311   hr_multi_message.end_validation_set;
312   --
313   -- Call the supporting pre-delete operation
314   --
315   ota_trb_del.pre_delete(p_rec);
316   --
317   -- Delete the row.
318   --
319   ota_trb_del.delete_dml(p_rec);
320   --
321   -- Call the supporting post-delete operation
322   --
323   ota_trb_del.post_delete(p_rec);
324   --
325   -- Call to raise any errors on multi-message list
326   hr_multi_message.end_validation_set;
327   --
328 End del;
329 --
330 -- ----------------------------------------------------------------------------
331 -- |---------------------------------< del >----------------------------------|
332 -- ----------------------------------------------------------------------------
333 Procedure del
334   (p_resource_booking_id                  in     number
335   ,p_object_version_number                in     number
336   ) is
337 --
338   l_rec   ota_trb_shd.g_rec_type;
339   l_proc  varchar2(72) := g_package||'del';
340 --
341 Begin
342   hr_utility.set_location('Entering:'||l_proc, 5);
343   --
344   -- As the delete procedure accepts a plsql record structure we do need to
345   -- convert the  arguments into the record structure.
346   -- We don't need to call the supplied conversion argument routine as we
347   -- only need a few attributes.
348   --
349   l_rec.resource_booking_id := p_resource_booking_id;
350   l_rec.object_version_number := p_object_version_number;
351   --
352   -- Having converted the arguments into the ota_trb_rec
353   -- plsql record structure we must call the corresponding entity
354   -- business process
355   --
356   ota_trb_del.del(l_rec);
357   --
358   hr_utility.set_location(' Leaving:'||l_proc, 10);
359 End del;
360 --
361 end ota_trb_del;