DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PDS_DEL

Source


1 Package Body per_pds_del as
2 /* $Header: pepdsrhi.pkb 120.7 2006/05/18 16:47:13 lsilveir ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_pds_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 Table Handler Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml(p_rec in per_pds_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   per_pds_shd.g_api_dml := true;  -- Set the api dml status
59   --
60   -- Delete the per_periods_of_service row.
61   --
62   delete from per_periods_of_service
63   where  period_of_service_id  = p_rec.period_of_service_id
64   and    object_version_number = p_rec.object_version_number;
65   --
66   per_pds_shd.g_api_dml := false;   -- Unset the api dml status
67   --
68   hr_utility.set_location(' Leaving:'||l_proc, 10);
69 --
70 Exception
71   When hr_api.child_integrity_violated then
72     -- Child integrity has been violated
73     per_pds_shd.g_api_dml := false;   -- Unset the api dml status
74     per_pds_shd.constraint_error
75       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
76   When Others Then
77     per_pds_shd.g_api_dml := false;   -- Unset the api dml status
78     Raise;
79 End delete_dml;
80 --
81 -- ----------------------------------------------------------------------------
82 -- |------------------------------< pre_delete >------------------------------|
83 -- ----------------------------------------------------------------------------
84 -- {Start Of Comments}
85 --
86 -- Description:
87 --   This private procedure contains any processing which is required before
88 --   the delete dml.
89 --
90 -- Pre Conditions:
91 --   This is an internal procedure which is called from the del procedure.
92 --
93 -- In Arguments:
94 --   A Pl/Sql record structre.
95 --
96 -- Post Success:
97 --   Processing continues.
98 --
99 -- Post Failure:
100 --   If an error has occurred, an error message and exception will be raised
101 --   but not handled.
102 --
103 -- Developer Implementation Notes:
104 --   Any pre-processing required before the delete dml is issued should be
105 --   coded within this procedure. It is important to note that any 3rd party
106 --   maintenance should be reviewed before placing in this procedure.
107 --
108 -- Access Status:
109 --   Internal Table Handler Use Only.
110 --
111 -- {End Of Comments}
112 -- ----------------------------------------------------------------------------
113 Procedure pre_delete(p_rec in per_pds_shd.g_rec_type) is
114 --
115   l_proc  varchar2(72) := g_package||'pre_delete';
116 --
117 Begin
118   hr_utility.set_location('Entering:'||l_proc, 5);
119   --
120   hr_utility.set_location(' Leaving:'||l_proc, 10);
121 End pre_delete;
122 --
123 -- ----------------------------------------------------------------------------
124 -- |-----------------------------< post_delete >------------------------------|
125 -- ----------------------------------------------------------------------------
126 -- {Start Of Comments}
127 --
128 -- Description:
129 --   This private procedure contains any processing which is required after the
130 --   delete dml.
131 --
132 -- Pre Conditions:
133 --   This is an internal procedure which is called from the del procedure.
134 --
135 -- In Arguments:
136 --   A Pl/Sql record structre.
137 --
138 -- Post Success:
139 --   Processing continues.
140 --
141 -- Post Failure:
142 --   If an error has occurred, an error message and exception will be raised
143 --   but not handled.
144 --
145 -- Developer Implementation Notes:
146 --   Any post-processing required after the delete dml is issued should be
147 --   coded within this procedure. It is important to note that any 3rd party
148 --   maintenance should be reviewed before placing in this procedure.
149 --
150 -- Access Status:
151 --   Internal Table Handler Use Only.
152 --
153 -- {End Of Comments}
154 -- ----------------------------------------------------------------------------
155 Procedure post_delete(p_rec in per_pds_shd.g_rec_type) is
156 --
157   l_proc  varchar2(72) := g_package||'post_delete';
158 --
159 Begin
160   hr_utility.set_location('Entering:'||l_proc, 5);
161   --
162 -- Start of API User Hook for post_delete.
163   begin
164     per_pds_rkd.after_delete
165     (
166      p_period_of_service_id         =>p_rec.period_of_service_id
167     ,p_business_group_id_o          =>per_pds_shd.g_old_rec.business_group_id
168     ,p_person_id_o                  =>per_pds_shd.g_old_rec.person_id
169     ,p_terminat_accepted_person_o   =>per_pds_shd.g_old_rec.termination_accepted_person_id
170     ,p_date_start_o                 =>per_pds_shd.g_old_rec.date_start
171     ,p_accepted_termination_date_o  =>per_pds_shd.g_old_rec.accepted_termination_date
172     ,p_actual_termination_date_o    =>per_pds_shd.g_old_rec.actual_termination_date
173     ,p_comments_o                   =>per_pds_shd.g_old_rec.comments
174     ,p_adjusted_svc_date_o          =>per_pds_shd.g_old_rec.adjusted_svc_date
175     ,p_final_process_date_o         =>per_pds_shd.g_old_rec.final_process_date
176     ,p_last_standard_process_date_o =>per_pds_shd.g_old_rec.last_standard_process_date
177     ,p_leaving_reason_o             =>per_pds_shd.g_old_rec.leaving_reason
178     ,p_notified_termination_date_o  =>per_pds_shd.g_old_rec.notified_termination_date
179     ,p_projected_termination_date_o =>per_pds_shd.g_old_rec.projected_termination_date
180     ,p_request_id_o                 =>per_pds_shd.g_old_rec.request_id
181     ,p_program_application_id_o     =>per_pds_shd.g_old_rec.program_application_id
182     ,p_program_id_o                 =>per_pds_shd.g_old_rec.program_id
183     ,p_program_update_date_o        =>per_pds_shd.g_old_rec.program_update_date
184     ,p_attribute_category_o         =>per_pds_shd.g_old_rec.attribute_category
185     ,p_attribute1_o                 =>per_pds_shd.g_old_rec.attribute1
186     ,p_attribute2_o                 =>per_pds_shd.g_old_rec.attribute2
187     ,p_attribute3_o                 =>per_pds_shd.g_old_rec.attribute3
188     ,p_attribute4_o                 =>per_pds_shd.g_old_rec.attribute4
189     ,p_attribute5_o                 =>per_pds_shd.g_old_rec.attribute5
190     ,p_attribute6_o                 =>per_pds_shd.g_old_rec.attribute6
191     ,p_attribute7_o                 =>per_pds_shd.g_old_rec.attribute7
192     ,p_attribute8_o                 =>per_pds_shd.g_old_rec.attribute8
193     ,p_attribute9_o                 =>per_pds_shd.g_old_rec.attribute9
194     ,p_attribute10_o                =>per_pds_shd.g_old_rec.attribute10
195     ,p_attribute11_o                =>per_pds_shd.g_old_rec.attribute11
196     ,p_attribute12_o                =>per_pds_shd.g_old_rec.attribute12
197     ,p_attribute13_o                =>per_pds_shd.g_old_rec.attribute13
198     ,p_attribute14_o                =>per_pds_shd.g_old_rec.attribute14
199     ,p_attribute15_o                =>per_pds_shd.g_old_rec.attribute15
200     ,p_attribute16_o                =>per_pds_shd.g_old_rec.attribute16
201     ,p_attribute17_o                =>per_pds_shd.g_old_rec.attribute17
202     ,p_attribute18_o                =>per_pds_shd.g_old_rec.attribute18
203     ,p_attribute19_o                =>per_pds_shd.g_old_rec.attribute19
204     ,p_attribute20_o                =>per_pds_shd.g_old_rec.attribute20
205     ,p_object_version_number_o      =>per_pds_shd.g_old_rec.object_version_number
206     ,p_prior_employment_ssp_weeks_o =>per_pds_shd.g_old_rec.prior_employment_ssp_weeks
207     ,p_prior_employmt_ssp_paid_to_o =>per_pds_shd.g_old_rec.prior_employment_ssp_paid_to
208     ,p_pds_information_category_o    =>per_pds_shd.g_old_rec.pds_information_category
209     ,p_pds_information1_o            =>per_pds_shd.g_old_rec.pds_information1
210     ,p_pds_information2_o            =>per_pds_shd.g_old_rec.pds_information2
211     ,p_pds_information3_o            =>per_pds_shd.g_old_rec.pds_information3
212     ,p_pds_information4_o            =>per_pds_shd.g_old_rec.pds_information4
213     ,p_pds_information5_o            =>per_pds_shd.g_old_rec.pds_information5
214     ,p_pds_information6_o            =>per_pds_shd.g_old_rec.pds_information6
215     ,p_pds_information7_o            =>per_pds_shd.g_old_rec.pds_information7
216     ,p_pds_information8_o            =>per_pds_shd.g_old_rec.pds_information8
217     ,p_pds_information9_o            =>per_pds_shd.g_old_rec.pds_information9
218     ,p_pds_information10_o           =>per_pds_shd.g_old_rec.pds_information10
219     ,p_pds_information11_o           =>per_pds_shd.g_old_rec.pds_information11
220     ,p_pds_information12_o           =>per_pds_shd.g_old_rec.pds_information12
221     ,p_pds_information13_o           =>per_pds_shd.g_old_rec.pds_information13
222     ,p_pds_information14_o           =>per_pds_shd.g_old_rec.pds_information14
223     ,p_pds_information15_o           =>per_pds_shd.g_old_rec.pds_information15
224     ,p_pds_information16_o           =>per_pds_shd.g_old_rec.pds_information16
225     ,p_pds_information17_o           =>per_pds_shd.g_old_rec.pds_information17
226     ,p_pds_information18_o           =>per_pds_shd.g_old_rec.pds_information18
227     ,p_pds_information19_o           =>per_pds_shd.g_old_rec.pds_information19
228     ,p_pds_information20_o           =>per_pds_shd.g_old_rec.pds_information20
229     ,p_pds_information21_o           =>per_pds_shd.g_old_rec.pds_information21
230     ,p_pds_information22_o           =>per_pds_shd.g_old_rec.pds_information22
231     ,p_pds_information23_o           =>per_pds_shd.g_old_rec.pds_information23
232     ,p_pds_information24_o           =>per_pds_shd.g_old_rec.pds_information24
233     ,p_pds_information25_o           =>per_pds_shd.g_old_rec.pds_information25
234     ,p_pds_information26_o           =>per_pds_shd.g_old_rec.pds_information26
235     ,p_pds_information27_o           =>per_pds_shd.g_old_rec.pds_information27
236     ,p_pds_information28_o           =>per_pds_shd.g_old_rec.pds_information28
237     ,p_pds_information29_o           =>per_pds_shd.g_old_rec.pds_information29
238     ,p_pds_information30_o           =>per_pds_shd.g_old_rec.pds_information30
239      );
240     exception
241     when hr_api.cannot_find_prog_unit then
242       hr_api.cannot_find_prog_unit_error
243         (p_module_name => 'PER_PERIOD_OF_SERVICE'
244         ,p_hook_type   => 'AD'
245         );
246   end;
247   -- End of API User Hook for post_delete.
248   hr_utility.set_location(' Leaving:'||l_proc, 10);
249 End post_delete;
250 --
251 -- ----------------------------------------------------------------------------
252 -- |---------------------------------< del >----------------------------------|
253 -- ----------------------------------------------------------------------------
254 Procedure del
255   (
256   p_rec	      in per_pds_shd.g_rec_type,
257   p_validate  in boolean default false
258   ) is
259 --
260   l_proc  varchar2(72) := g_package||'del';
261 --
262 Begin
263   hr_utility.set_location('Entering:'||l_proc, 5);
264   --
265   -- Determine if the business process is to be validated.
266   --
267   If p_validate then
268     --
269     -- Issue the savepoint.
270     --
271     SAVEPOINT del_per_pds;
272   End If;
273   --
274   -- We must lock the row which we need to delete.
275   --
276   per_pds_shd.lck
277 	(
278 	p_rec.period_of_service_id,
279 	p_rec.object_version_number
280 	);
281   --
282   -- Call the supporting delete validate operation
283   --
284   per_pds_bus.delete_validate(p_rec);
285   --
286   -- Call the supporting pre-delete operation
287   --
288   pre_delete(p_rec);
289   --
290   -- Delete the row.
291   --
292   delete_dml(p_rec);
293   --
294   -- Call the supporting post-delete operation
295   --
296   post_delete(p_rec);
297   --
298   -- If we are validating then raise the Validate_Enabled exception
299   --
300   If p_validate then
301     Raise HR_Api.Validate_Enabled;
302   End If;
303   --
304   hr_utility.set_location(' Leaving:'||l_proc, 10);
305 Exception
306   When HR_Api.Validate_Enabled Then
307     --
308     -- As the Validate_Enabled exception has been raised
309     -- we must rollback to the savepoint
310     --
311     ROLLBACK TO del_per_pds;
312 End del;
313 --
314 -- ----------------------------------------------------------------------------
315 -- |---------------------------------< del >----------------------------------|
316 -- ----------------------------------------------------------------------------
317 Procedure del
318   (
319   p_period_of_service_id               in number,
320   p_object_version_number              in number,
321   p_validate                           in boolean default false
322   ) is
323 --
324   l_rec	  per_pds_shd.g_rec_type;
325   l_proc  varchar2(72) := g_package||'del';
326 --
327 Begin
328   hr_utility.set_location('Entering:'||l_proc, 5);
329   --
330   -- As the delete procedure accepts a plsql record structure we do need to
331   -- convert the  arguments into the record structure.
332   -- We don't need to call the supplied conversion argument routine as we
333   -- only need a few attributes.
334   --
335   l_rec.period_of_service_id:= p_period_of_service_id;
336   l_rec.object_version_number := p_object_version_number;
337   --
338   -- Having converted the arguments into the per_pds_rec
339   -- plsql record structure we must call the corresponding entity
340   -- business process
341   --
342   del(l_rec, p_validate);
343   --
344   hr_utility.set_location(' Leaving:'||l_proc, 10);
345 End del;
346 --
347 end per_pds_del;