DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PHN_DEL

Source


1 Package Body per_phn_del as
2 /* $Header: pephnrhi.pkb 120.0 2005/05/31 14:21:07 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_phn_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 delete the specified row from the schema using the primary key in
19 --      the predicates.
20 --   2) To trap any constraint violations that may have occurred.
21 --   3) To raise any other errors.
22 --
23 -- Pre Conditions:
24 --   This is an internal private procedure which must be called from the del
25 --   procedure.
26 --
27 -- In Parameters:
28 --   A Pl/Sql record structre.
29 --
30 -- Post Success:
31 --   The specified row will be delete from the schema.
32 --
33 -- Post Failure:
34 --   On the delete dml failure it is important to note that we always reset the --   If a child integrity constraint violation is raised the
35 --   constraint_error procedure will be called.
36 --
37 -- Developer Implementation Notes:
38 --   None.
39 --
40 -- Access Status:
41 --   Internal Table Handler Use Only.
42 --
43 -- {End Of Comments}
44 -- ----------------------------------------------------------------------------
45 Procedure delete_dml(p_rec in per_phn_shd.g_rec_type) is
46 --
47   l_proc  varchar2(72) := g_package||'delete_dml';
48 --
49 Begin
50   hr_utility.set_location('Entering:'||l_proc, 5);
51   --
52   -- Delete the per_phones row.
53   --
54   delete from per_phones
55   where phone_id = p_rec.phone_id;
56   --
57   hr_utility.set_location(' Leaving:'||l_proc, 10);
58 --
59 Exception
60   When hr_api.child_integrity_violated then
61     -- Child integrity has been violated
62     per_phn_shd.constraint_error
63       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
64   When Others Then
65     Raise;
66 End delete_dml;
67 --
68 -- ----------------------------------------------------------------------------
69 -- |------------------------------< pre_delete >------------------------------|
70 -- ----------------------------------------------------------------------------
71 -- {Start Of Comments}
72 --
73 -- Description:
74 --   This private procedure contains any processing which is required before
75 --   the delete dml.
76 --
77 -- Pre Conditions:
78 --   This is an internal procedure which is called from the del procedure.
79 --
80 -- In Parameters:
81 --   A Pl/Sql record structre.
82 --
83 -- Post Success:
84 --   Processing continues.
85 --
86 -- Post Failure:
87 --   If an error has occurred, an error message and exception will be raised
88 --   but not handled.
89 --
90 -- Developer Implementation Notes:
91 --   Any pre-processing required before the delete dml is issued should be
92 --   coded within this procedure. It is important to note that any 3rd party
93 --   maintenance should be reviewed before placing in this procedure.
94 --
95 -- Access Status:
96 --   Internal Table Handler Use Only.
97 --
98 -- {End Of Comments}
99 -- ----------------------------------------------------------------------------
100 Procedure pre_delete(p_rec in per_phn_shd.g_rec_type) is
101 --
102   l_proc  varchar2(72) := g_package||'pre_delete';
103 --
104 Begin
105   hr_utility.set_location('Entering:'||l_proc, 5);
106   --
107   hr_utility.set_location(' Leaving:'||l_proc, 10);
108 End pre_delete;
109 --
110 -- ----------------------------------------------------------------------------
111 -- |-----------------------------< post_delete >------------------------------|
112 -- ----------------------------------------------------------------------------
113 -- {Start Of Comments}
114 --
115 -- Description:
116 --   This private procedure contains any processing which is required after the
117 --   delete dml.
118 --
119 -- Pre Conditions:
120 --   This is an internal procedure which is called from the del procedure.
121 --
122 -- In Parameters:
123 --   A Pl/Sql record structre.
124 --
125 -- Post Success:
126 --   Processing continues.
127 --
128 -- Post Failure:
129 --   If an error has occurred, an error message and exception will be raised
130 --   but not handled.
131 --
132 -- Developer Implementation Notes:
133 --   Any post-processing required after the delete dml is issued should be
134 --   coded within this procedure. It is important to note that any 3rd party
135 --   maintenance should be reviewed before placing in this procedure.
136 --
137 -- Access Status:
138 --   Internal table Handler Use Only.
139 --
140 -- {End Of Comments}
141 -- ----------------------------------------------------------------------------
142 Procedure post_delete(p_rec in per_phn_shd.g_rec_type) is
143 --
144   l_proc  varchar2(72) := g_package||'post_delete';
145 --
146 Begin
147   hr_utility.set_location('Entering:'||l_proc, 5);
148   --
149   --
150   -- Start of API User Hook for post_delete.
151   begin
152     per_phn_rkd.after_delete
153       (
154 	   p_phone_id	         => p_rec.phone_id
155 	  ,p_date_from_o           => per_phn_shd.g_old_rec.date_from
156 	  ,p_date_to_o             => per_phn_shd.g_old_rec.date_to
157 	  ,p_phone_type_o          => per_phn_shd.g_old_rec.phone_type
158 	  ,p_phone_number_o        => per_phn_shd.g_old_rec.phone_number
159 	  ,p_parent_id_o           => per_phn_shd.g_old_rec.parent_id
160 	  ,p_parent_table_o        => per_phn_shd.g_old_rec.parent_table
161 	  ,p_attribute_category_o  => per_phn_shd.g_old_rec.attribute_category
162 	  ,p_attribute1_o          => per_phn_shd.g_old_rec.attribute1
163 	  ,p_attribute2_o          => per_phn_shd.g_old_rec.attribute2
164 	  ,p_attribute3_o          => per_phn_shd.g_old_rec.attribute3
165 	  ,p_attribute4_o          => per_phn_shd.g_old_rec.attribute4
166 	  ,p_attribute5_o          => per_phn_shd.g_old_rec.attribute5
167 	  ,p_attribute6_o          => per_phn_shd.g_old_rec.attribute6
168 	  ,p_attribute7_o          => per_phn_shd.g_old_rec.attribute7
169 	  ,p_attribute8_o          => per_phn_shd.g_old_rec.attribute8
170 	  ,p_attribute9_o          => per_phn_shd.g_old_rec.attribute9
171 	  ,p_attribute10_o         => per_phn_shd.g_old_rec.attribute10
172 	  ,p_attribute11_o         => per_phn_shd.g_old_rec.attribute11
173 	  ,p_attribute12_o         => per_phn_shd.g_old_rec.attribute12
174 	  ,p_attribute13_o         => per_phn_shd.g_old_rec.attribute13
175 	  ,p_attribute14_o         => per_phn_shd.g_old_rec.attribute14
176 	  ,p_attribute15_o         => per_phn_shd.g_old_rec.attribute15
177 	  ,p_attribute16_o         => per_phn_shd.g_old_rec.attribute16
178 	  ,p_attribute17_o         => per_phn_shd.g_old_rec.attribute17
179 	  ,p_attribute18_o         => per_phn_shd.g_old_rec.attribute18
180 	  ,p_attribute19_o         => per_phn_shd.g_old_rec.attribute19
181 	  ,p_attribute20_o         => per_phn_shd.g_old_rec.attribute20
182 	  ,p_attribute21_o         => per_phn_shd.g_old_rec.attribute21
183 	  ,p_attribute22_o         => per_phn_shd.g_old_rec.attribute22
184 	  ,p_attribute23_o         => per_phn_shd.g_old_rec.attribute23
185 	  ,p_attribute24_o         => per_phn_shd.g_old_rec.attribute24
186 	  ,p_attribute25_o         => per_phn_shd.g_old_rec.attribute25
187 	  ,p_attribute26_o         => per_phn_shd.g_old_rec.attribute26
188 	  ,p_attribute27_o         => per_phn_shd.g_old_rec.attribute27
189 	  ,p_attribute28_o         => per_phn_shd.g_old_rec.attribute28
190 	  ,p_attribute29_o         => per_phn_shd.g_old_rec.attribute29
191 	  ,p_attribute30_o         => per_phn_shd.g_old_rec.attribute30
192 	  ,p_party_id_o            => per_phn_shd.g_old_rec.party_id  -- HR/TCA merge
193           ,p_validity_o            => per_phn_shd.g_old_rec.validity
194 	  ,p_object_version_number_o
195                    => per_phn_shd.g_old_rec.object_version_number
196       );
197   exception
198     when hr_api.cannot_find_prog_unit then
199       hr_api.cannot_find_prog_unit_error
200         (p_module_name => 'PER_PHONES'
201         ,p_hook_type   => 'AD'
202         );
203   end;
204   -- End of API User Hook for post_delete.
205   --
206   hr_utility.set_location(' Leaving:'||l_proc, 10);
207 End post_delete;
208 --
209 -- ----------------------------------------------------------------------------
210 -- |---------------------------------< del >----------------------------------|
211 -- ----------------------------------------------------------------------------
212 Procedure del
213   (
214   p_rec	      in per_phn_shd.g_rec_type,
215   p_validate  in boolean default false
216   ) is
217 --
218   l_proc  varchar2(72) := g_package||'del';
219 --
220 Begin
221   hr_utility.set_location('Entering:'||l_proc, 5);
222   --
223   -- Determine if the business process is to be validated.
224   --
225   If p_validate then
226     --
227     -- Issue the savepoint.
228     --
229     SAVEPOINT del_per_phn;
230   End If;
231   --
232   -- We must lock the row which we need to delete.
233   --
234   per_phn_shd.lck
235 	(
236 	p_rec.phone_id,
237 	p_rec.object_version_number
238 	);
239   --
240   -- Call the supporting delete validate operation
241   --
242   per_phn_bus.delete_validate(p_rec);
243   --
244   -- Call to raise any errors on multi-message list
245   --
246   hr_multi_message.end_validation_set;
247   --
248   -- Call the supporting pre-delete operation
249   --
250   pre_delete(p_rec);
251   --
252   -- Delete the row.
253   --
254   delete_dml(p_rec);
255   --
256   -- Call the supporting post-delete operation
257   --
258   post_delete(p_rec);
259   --
260   -- Call to raise any errors on multi-message list
261   --
262   hr_multi_message.end_validation_set;
263   --
264   -- If we are validating then raise the Validate_Enabled exception
265   --
266   If p_validate then
267     Raise HR_Api.Validate_Enabled;
268   End If;
269   --
270   hr_utility.set_location(' Leaving:'||l_proc, 10);
271 Exception
272   When HR_Api.Validate_Enabled Then
273     --
274     -- As the Validate_Enabled exception has been raised
275     -- we must rollback to the savepoint
276     --
277     ROLLBACK TO del_per_phn;
278 End del;
279 --
280 -- ----------------------------------------------------------------------------
281 -- |---------------------------------< del >----------------------------------|
282 -- ----------------------------------------------------------------------------
283 Procedure del
284   (
285   p_phone_id                           in number,
286   p_object_version_number              in number,
287   p_validate                           in boolean default false
288   ) is
289 --
290   l_rec	  per_phn_shd.g_rec_type;
291   l_proc  varchar2(72) := g_package||'del';
292 --
293 Begin
294   hr_utility.set_location('Entering:'||l_proc, 5);
295   --
296   -- As the delete procedure accepts a plsql record structure we do need to
297   -- convert the  arguments into the record structure.
298   -- We don't need to call the supplied conversion argument routine as we
299   -- only need a few attributes.
300   --
301   l_rec.phone_id:= p_phone_id;
302   l_rec.object_version_number := p_object_version_number;
303   --
304   -- Having converted the arguments into the per_phn_rec
305   -- plsql record structure we must call the corresponding entity
306   -- business process
307   --
308   del(l_rec, p_validate);
309   --
310   hr_utility.set_location(' Leaving:'||l_proc, 10);
311 End del;
312 --
313 end per_phn_del;