1 Package Body pqh_cpd_del as
2 /* $Header: pqcpdrhi.pkb 120.0 2005/05/29 01:44:39 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_cpd_del.'; -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------------< delete_dml >------------------------------|
13 -- ----------------------------------------------------------------------------
14 -- {Start Of Comments}
15 --
16 -- Description:
17 -- This procedure controls the actual dml delete logic. The functions of
18 -- this procedure are as follows:
19 -- 1) To set and unset the g_api_dml status as required (as we are about to
20 -- perform dml).
21 -- 2) To delete the specified row from the schema using the primary key in
22 -- the predicates.
23 -- 3) To trap any constraint violations that may have occurred.
24 -- 4) To raise any other errors.
25 --
26 -- Prerequisites:
27 -- This is an internal private procedure which must be called from the del
28 -- procedure.
29 --
30 -- In Parameters:
31 -- A Pl/Sql record structre.
32 --
33 -- Post Success:
34 -- The specified row will be delete from the schema.
35 --
36 -- Post Failure:
37 -- On the delete dml failure it is important to note that we always reset the
38 -- g_api_dml status to false.
39 -- If a child integrity constraint violation is raised the
40 -- constraint_error procedure will be called.
41 -- If any other error is reported, the error will be raised after the
42 -- g_api_dml status is reset.
43 --
44 -- Developer Implementation Notes:
45 -- None.
46 --
47 -- Access Status:
48 -- Internal Row Handler Use Only.
49 --
50 -- {End Of Comments}
51 -- ----------------------------------------------------------------------------
52 Procedure delete_dml
53 (p_rec in pqh_cpd_shd.g_rec_type
54 ) is
55 --
56 l_proc varchar2(72);
57 --
58 Begin
59 if g_debug then
60 l_proc := g_package||'delete_dml';
61 hr_utility.set_location('Entering:'||l_proc, 5);
62 end if;
63 --
64 pqh_cpd_shd.g_api_dml := true; -- Set the api dml status
65 --
66 -- Delete the pqh_corps_definitions row.
67 --
68 delete from pqh_corps_definitions
69 where corps_definition_id = p_rec.corps_definition_id;
70 --
71 pqh_cpd_shd.g_api_dml := false; -- Unset the api dml status
72 --
73 if g_debug then
74 hr_utility.set_location(' Leaving:'||l_proc, 10);
75 end if;
76 --
77 Exception
78 When hr_api.child_integrity_violated then
79 -- Child integrity has been violated
80 pqh_cpd_shd.g_api_dml := false; -- Unset the api dml status
81 pqh_cpd_shd.constraint_error
82 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
83 When Others Then
84 pqh_cpd_shd.g_api_dml := false; -- Unset the api dml status
85 Raise;
86 End delete_dml;
87 --
88 -- ----------------------------------------------------------------------------
89 -- |------------------------------< pre_delete >------------------------------|
90 -- ----------------------------------------------------------------------------
91 -- {Start Of Comments}
92 --
93 -- Description:
94 -- This private procedure contains any processing which is required before
95 -- the delete dml.
96 --
97 -- Prerequisites:
98 -- This is an internal procedure which is called from the del procedure.
99 --
100 -- In Parameters:
101 -- A Pl/Sql record structre.
102 --
103 -- Post Success:
104 -- Processing continues.
105 --
106 -- Post Failure:
107 -- If an error has occurred, an error message and exception will be raised
108 -- but not handled.
109 --
110 -- Developer Implementation Notes:
111 -- Any pre-processing required before the delete dml is issued should be
112 -- coded within this procedure. It is important to note that any 3rd party
113 -- maintenance should be reviewed before placing in this procedure.
114 --
115 -- Access Status:
116 -- Internal Row Handler Use Only.
117 --
118 -- {End Of Comments}
119 -- ----------------------------------------------------------------------------
120 Procedure pre_delete(p_rec in pqh_cpd_shd.g_rec_type) is
121 --
122 l_proc varchar2(72);
123 --
124 Begin
125 if g_debug then
126 l_proc := g_package||'pre_delete';
127 hr_utility.set_location('Entering:'||l_proc, 5);
128 end if;
129 --
130 if g_debug then
131 hr_utility.set_location(' Leaving:'||l_proc, 10);
132 end if;
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
142 -- the delete dml.
143 --
144 -- Prerequistes:
145 -- This is an internal procedure which is called from the del procedure.
146 --
147 -- In Parameters:
148 -- A Pl/Sql record structure.
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 Row Handler Use Only.
164 --
165 -- {End Of Comments}
166 -- -----------------------------------------------------------------------------
167 Procedure post_delete(p_rec in pqh_cpd_shd.g_rec_type) is
168 --
169 l_proc varchar2(72) := g_package||'post_delete';
170 --
171 Begin
172 if g_debug then
173 l_proc := g_package||'post_delete';
174 hr_utility.set_location('Entering:'||l_proc, 5);
175 end if;
176 begin
177 --
178 pqh_cpd_rkd.after_delete
179 (p_corps_definition_id
180 => p_rec.corps_definition_id
181 ,p_business_group_id_o
182 => pqh_cpd_shd.g_old_rec.business_group_id
183 ,p_name_o
184 => pqh_cpd_shd.g_old_rec.name
185 ,p_status_cd_o
186 => pqh_cpd_shd.g_old_rec.status_cd
187 ,p_retirement_age_o
188 => pqh_cpd_shd.g_old_rec.retirement_age
189 ,p_category_cd_o
190 => pqh_cpd_shd.g_old_rec.category_cd
191 ,p_recruitment_end_date_o
192 => pqh_cpd_shd.g_old_rec.recruitment_end_date
193 ,p_corps_type_cd_o
194 => pqh_cpd_shd.g_old_rec.corps_type_cd
195 ,p_starting_grade_step_id_o
196 => pqh_cpd_shd.g_old_rec.starting_grade_step_id
197 ,p_task_desc_o
198 => pqh_cpd_shd.g_old_rec.task_desc
199 ,p_secondment_threshold_o
200 => pqh_cpd_shd.g_old_rec.secondment_threshold
201 ,p_normal_hours_o
202 => pqh_cpd_shd.g_old_rec.normal_hours
203 ,p_normal_hours_frequency_o
204 => pqh_cpd_shd.g_old_rec.normal_hours_frequency
205 ,p_minimum_hours_o
206 => pqh_cpd_shd.g_old_rec.minimum_hours
207 ,p_minimum_hours_frequency_o
208 => pqh_cpd_shd.g_old_rec.minimum_hours_frequency
209 ,p_attribute1_o
210 => pqh_cpd_shd.g_old_rec.attribute1
211 ,p_attribute2_o
212 => pqh_cpd_shd.g_old_rec.attribute2
213 ,p_attribute3_o
214 => pqh_cpd_shd.g_old_rec.attribute3
215 ,p_attribute4_o
216 => pqh_cpd_shd.g_old_rec.attribute4
217 ,p_attribute5_o
218 => pqh_cpd_shd.g_old_rec.attribute5
219 ,p_attribute6_o
220 => pqh_cpd_shd.g_old_rec.attribute6
221 ,p_attribute7_o
222 => pqh_cpd_shd.g_old_rec.attribute7
223 ,p_attribute8_o
224 => pqh_cpd_shd.g_old_rec.attribute8
225 ,p_attribute9_o
226 => pqh_cpd_shd.g_old_rec.attribute9
227 ,p_attribute10_o
228 => pqh_cpd_shd.g_old_rec.attribute10
229 ,p_attribute11_o
230 => pqh_cpd_shd.g_old_rec.attribute11
231 ,p_attribute12_o
232 => pqh_cpd_shd.g_old_rec.attribute12
233 ,p_attribute13_o
234 => pqh_cpd_shd.g_old_rec.attribute13
235 ,p_attribute14_o
236 => pqh_cpd_shd.g_old_rec.attribute14
237 ,p_attribute15_o
238 => pqh_cpd_shd.g_old_rec.attribute15
239 ,p_attribute16_o
240 => pqh_cpd_shd.g_old_rec.attribute16
241 ,p_attribute17_o
242 => pqh_cpd_shd.g_old_rec.attribute17
243 ,p_attribute18_o
244 => pqh_cpd_shd.g_old_rec.attribute18
245 ,p_attribute19_o
246 => pqh_cpd_shd.g_old_rec.attribute19
247 ,p_attribute20_o
248 => pqh_cpd_shd.g_old_rec.attribute20
249 ,p_attribute21_o
250 => pqh_cpd_shd.g_old_rec.attribute21
251 ,p_attribute22_o
252 => pqh_cpd_shd.g_old_rec.attribute22
253 ,p_attribute23_o
254 => pqh_cpd_shd.g_old_rec.attribute23
255 ,p_attribute24_o
256 => pqh_cpd_shd.g_old_rec.attribute24
257 ,p_attribute25_o
258 => pqh_cpd_shd.g_old_rec.attribute25
259 ,p_attribute26_o
260 => pqh_cpd_shd.g_old_rec.attribute26
261 ,p_attribute27_o
262 => pqh_cpd_shd.g_old_rec.attribute27
263 ,p_attribute28_o
264 => pqh_cpd_shd.g_old_rec.attribute28
265 ,p_attribute29_o
266 => pqh_cpd_shd.g_old_rec.attribute29
267 ,p_attribute30_o
268 => pqh_cpd_shd.g_old_rec.attribute30
269 ,p_attribute_category_o
270 => pqh_cpd_shd.g_old_rec.attribute_category
271 ,p_object_version_number_o
272 => pqh_cpd_shd.g_old_rec.object_version_number
273 ,p_type_of_ps_o
274 => pqh_cpd_shd.g_old_rec.type_of_ps
275 ,p_date_from_o
276 => pqh_cpd_shd.g_old_rec.date_from
277 ,p_date_to_o
278 => pqh_cpd_shd.g_old_rec.date_to
279 ,p_primary_prof_field_id_o
280 => pqh_cpd_shd.g_old_rec.primary_prof_field_id
281 ,p_starting_grade_id_o
282 => pqh_cpd_shd.g_old_rec.starting_grade_id
283 ,p_ben_pgm_id_o
284 => pqh_cpd_shd.g_old_rec.ben_pgm_id
285 ,p_probation_period_o
286 => pqh_cpd_shd.g_old_rec.probation_period
287 ,p_probation_units_o
288 => pqh_cpd_shd.g_old_rec.probation_units
289 );
290 --
291 exception
292 --
293 when hr_api.cannot_find_prog_unit then
294 --
295 hr_api.cannot_find_prog_unit_error
296 (p_module_name => 'PQH_CORPS_DEFINITIONS'
297 ,p_hook_type => 'AD');
298 --
299 end;
300 --
301 if g_debug then
302 hr_utility.set_location(' Leaving:'||l_proc, 10);
303 end if;
304 End post_delete;
305 --
306 -- ----------------------------------------------------------------------------
307 -- |---------------------------------< del >----------------------------------|
308 -- ----------------------------------------------------------------------------
309 Procedure del
310 (p_rec in pqh_cpd_shd.g_rec_type
311 ) is
312 --
313 l_proc varchar2(72) := g_package||'del';
314 --
315 Begin
316 if g_debug then
317 l_proc := g_package||'del';
318 hr_utility.set_location('Entering:'||l_proc, 5);
319 end if;
320 --
321 -- We must lock the row which we need to delete.
322 --
323 pqh_cpd_shd.lck
324 (p_rec.corps_definition_id
325 ,p_rec.object_version_number
326 );
327 --
328 -- Call the supporting delete validate operation
329 --
330 pqh_cpd_bus.delete_validate(p_rec);
331 --
332 -- Call to raise any errors on multi-message list
333 hr_multi_message.end_validation_set;
334 --
335 -- Call the supporting pre-delete operation
336 --
337 pqh_cpd_del.pre_delete(p_rec);
338 --
339 -- Delete the row.
340 --
341 pqh_cpd_del.delete_dml(p_rec);
342 --
343 -- Call the supporting post-delete operation
344 --
345 pqh_cpd_del.post_delete(p_rec);
346 --
347 -- Call to raise any errors on multi-message list
348 hr_multi_message.end_validation_set;
349 --
350 End del;
351 --
352 -- ----------------------------------------------------------------------------
353 -- |---------------------------------< del >----------------------------------|
354 -- ----------------------------------------------------------------------------
355 Procedure del
356 (p_corps_definition_id in number
357 ,p_object_version_number in number
358 ) is
359 --
360 l_rec pqh_cpd_shd.g_rec_type;
361 l_proc varchar2(72) := g_package||'del';
362 --
363 Begin
364 g_debug := hr_utility.debug_enabled;
365 if g_debug then
366 l_proc := g_package||'del';
367 hr_utility.set_location('Entering:'||l_proc, 5);
368 end if;
369 --
370 -- As the delete procedure accepts a plsql record structure we do need to
371 -- convert the arguments into the record structure.
372 -- We don't need to call the supplied conversion argument routine as we
373 -- only need a few attributes.
374 --
375 l_rec.corps_definition_id := p_corps_definition_id;
376 l_rec.object_version_number := p_object_version_number;
377 --
378 -- Having converted the arguments into the pqh_cpd_rec
379 -- plsql record structure we must call the corresponding entity
380 -- business process
381 --
382 pqh_cpd_del.del(l_rec);
383 --
384 if g_debug then
385 hr_utility.set_location(' Leaving:'||l_proc, 10);
386 end if;
387 End del;
388 --
389 end pqh_cpd_del;