1 PACKAGE BODY OTA_EVT_DEL as
2 /* $Header: otevt01t.pkb 120.13.12010000.2 2008/09/17 08:05:36 srgnanas ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_evt_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 this
17 -- 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 -- Pre Conditions:
26 -- This is an internal private procedure which must be called from the del
27 -- procedure.
28 --
29 -- In Arguments:
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 Development Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml(p_rec in ota_evt_shd.g_rec_type) is
52 --
53 l_proc varchar2(72) := g_package||'delete_dml';
54 --
55 Begin
56 hr_utility.set_location('Entering:'||l_proc, 5);
57 --
58 ota_evt_shd.g_api_dml := true; -- Set the api dml status
59 --
60 /* -- Removed until a Delete Function is implemented
61 --
62 -- Delete delegate bookings
63 --
64 delete from ota_delegate_bookings
65 where event_id = p_rec.event_id;
66 --
67 -- Delete the event association row
68 --
69 delete from ota_event_associations
70 where event_id = p_rec.event_id;
71 --
72 */
73 -- Delete the ota_events row.
74 --
75 delete from ota_events
76 where event_id = p_rec.event_id;
77 --
78 ota_evt_shd.g_api_dml := false; -- Unset the api dml status
79 --
80 hr_utility.set_location(' Leaving:'||l_proc, 10);
81 --
82 Exception
83 When hr_api.child_integrity_violated then
84 -- Child integrity has been violated
85 ota_evt_shd.g_api_dml := false; -- Unset the api dml status
86 ota_evt_shd.constraint_error
87 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
88 When Others Then
89 ota_evt_shd.g_api_dml := false; -- Unset the api dml status
90 Raise;
91 End delete_dml;
92 --
93 -- ----------------------------------------------------------------------------
94 -- |------------------------------< pre_delete >------------------------------|
95 -- ----------------------------------------------------------------------------
96 -- {Start Of Comments}
97 --
98 -- Description:
99 -- This private procedure contains any processing which is required before
100 -- the delete dml.
101 --
102 -- Pre Conditions:
103 -- This is an internal procedure which is called from the del procedure.
104 --
105 -- In Arguments:
106 -- A Pl/Sql record structre.
107 --
108 -- Post Success:
109 -- Processing continues.
110 --
111 -- Post Failure:
112 -- If an error has occurred, an error message and exception will be raised
113 -- but not handled.
114 --
115 -- Developer Implementation Notes:
116 -- Any pre-processing required before the delete dml is issued should be
117 -- coded within this procedure. It is important to note that any 3rd party
118 -- maintenance should be reviewed before placing in this procedure.
119 --
120 -- Access Status:
121 -- Internal Development Use Only.
122 --
123 -- {End Of Comments}
124 -- ----------------------------------------------------------------------------
125 Procedure pre_delete(p_rec in ota_evt_shd.g_rec_type) is
126 --
127 l_proc varchar2(72) := g_package||'pre_delete';
128 --
129 Begin
130 hr_utility.set_location('Entering:'||l_proc, 5);
131 --
132 hr_utility.set_location(' Leaving:'||l_proc, 10);
133 End pre_delete;
134 --
135 -- ----------------------------------------------------------------------------
136 -- |-----------------------------< post_delete >------------------------------|
137 -- ----------------------------------------------------------------------------
138 -- {Start Of Comments}
139 --
140 -- Description:
141 -- This private procedure contains any processing which is required after the
142 -- delete dml.
143 --
144 -- Pre Conditions:
145 -- This is an internal procedure which is called from the del procedure.
146 --
147 -- In Arguments:
148 -- A Pl/Sql record structre.
149 --
150 -- Post Success:
151 -- Processing continues.
152 --
153 -- Post Failure:
154 -- If an error has occurred, an error message and exception will be raised
155 -- but not handled.
156 --
157 -- Developer Implementation Notes:
158 -- Any post-processing required after the delete dml is issued should be
159 -- coded within this procedure. It is important to note that any 3rd party
160 -- maintenance should be reviewed before placing in this procedure.
161 --
162 -- Access Status:
163 -- Internal Development Use Only.
164 --
165 -- {End Of Comments}
166 -- ----------------------------------------------------------------------------
167 Procedure post_delete(p_rec in ota_evt_shd.g_rec_type) is
168 --
169 l_proc varchar2(72) := g_package||'post_delete';
170 --
171 Begin
172 hr_utility.set_location('Entering:'||l_proc, 5);
173 --
174 hr_utility.set_location(' Leaving:'||l_proc, 10);
175 End post_delete;
176 --
177 -- ----------------------------------------------------------------------------
178 -- |---------------------------------< del >----------------------------------|
179 -- ----------------------------------------------------------------------------
180 Procedure del
181 (
182 p_rec in ota_evt_shd.g_rec_type,
183 p_validate in boolean default false
184 ) is
185 --
186 l_proc varchar2(72) := g_package||'del';
187 --
188 Begin
189 hr_utility.set_location('Entering:'||l_proc, 5);
190 --
191 -- Determine if the business process is to be validated.
192 --
193 If p_validate then
194 --
195 -- Issue the savepoint.
196 --
197 SAVEPOINT del_ota_evt;
198 End If;
199 --
200 -- We must lock the row which we need to delete.
201 --
202 ota_evt_shd.lck
203 (
204 p_rec.event_id,
205 p_rec.object_version_number
206 );
207 --
208 -- Call the supporting delete validate operation
209 --
210 ota_evt_bus.delete_validate(p_rec);
211 --
212 -- added for eBS by asud
213 hr_multi_message.end_validation_set;
214 -- added for eBS by asud
215 --
216 -- Call the supporting pre-delete operation
217 --
218 pre_delete(p_rec);
219 --
220 -- Delete the row.
221 --
222 delete_dml(p_rec);
223 --
224 -- Call the supporting post-delete operation
225 --
226 post_delete(p_rec);
227 --
228 -- added for eBS by asud
229 hr_multi_message.end_validation_set;
230 -- added for eBS by asud
231 --
232 -- If we are validating then raise the Validate_Enabled exception
233 --
234 If p_validate then
235 Raise HR_Api.Validate_Enabled;
236 End If;
237 --
238 hr_utility.set_location(' Leaving:'||l_proc, 10);
239 Exception
240 When HR_Api.Validate_Enabled Then
241 --
242 -- As the Validate_Enabled exception has been raised
243 -- we must rollback to the savepoint
244 --
245 ROLLBACK TO del_ota_evt;
246 End del;
247 --
248 -- ----------------------------------------------------------------------------
249 -- |---------------------------------< del >----------------------------------|
250 -- ----------------------------------------------------------------------------
251 Procedure del
252 (
253 p_event_id in number,
254 p_object_version_number in number,
255 p_validate in boolean default false
256 ) is
257 --
258 l_rec ota_evt_shd.g_rec_type;
259 l_proc varchar2(72) := g_package||'del';
260 --
261 Begin
262 hr_utility.set_location('Entering:'||l_proc, 5);
263 --
264 -- As the delete procedure accepts a plsql record structure we do need to
265 -- convert the arguments into the record structure.
266 -- We don't need to call the supplied conversion argument routine as we
267 -- only need a few attributes.
268 --
269 l_rec.event_id:= p_event_id;
270 l_rec.object_version_number := p_object_version_number;
271 --
272 -- Having converted the arguments into the ota_evt_rec
273 -- plsql record structure we must call the corresponding entity
274 -- business process
275 --
276 del(l_rec, p_validate);
277 --
278 hr_utility.set_location(' Leaving:'||l_proc, 10);
279 End del;
280 --
281 end ota_evt_del;