DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SEU_DEL

Source


1 Package Body per_seu_del as
2 /* $Header: peseurhi.pkb 120.4 2005/11/09 13:59:48 vbanner noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := 'per_seu_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 per_seu_shd.g_rec_type
54   ) is
55 --
56   l_proc  varchar2(72) := g_package||'delete_dml';
57 --
58 Begin
59   hr_utility.set_location('Entering:'||l_proc, 5);
60   --
61   --
62   --
63   -- Delete the per_security_users row.
64   --
65   delete from per_security_users
66   where security_user_id = p_rec.security_user_id;
67   --
68   --
69   --
70   hr_utility.set_location(' Leaving:'||l_proc, 10);
71 --
72 Exception
73   When hr_api.child_integrity_violated then
74     -- Child integrity has been violated
75     --
76     per_seu_shd.constraint_error
77       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
78   When Others Then
79     --
80     Raise;
81 End delete_dml;
82 --
83 -- ----------------------------------------------------------------------------
84 -- |------------------------------< pre_delete >------------------------------|
85 -- ----------------------------------------------------------------------------
86 -- {Start Of Comments}
87 --
88 -- Description:
89 --   This private procedure contains any processing which is required before
90 --   the delete dml.
91 --
92 -- Prerequisites:
93 --   This is an internal procedure which is called from the del procedure.
94 --
95 -- In Parameters:
96 --   A Pl/Sql record structre.
97 --
98 -- Post Success:
99 --   Processing continues.
100 --
101 -- Post Failure:
102 --   If an error has occurred, an error message and exception will be raised
103 --   but not handled.
104 --
105 -- Developer Implementation Notes:
106 --   Any pre-processing required before the delete dml is issued should be
107 --   coded within this procedure. It is important to note that any 3rd party
108 --   maintenance should be reviewed before placing in this procedure.
109 --
110 -- Access Status:
111 --   Internal Row Handler Use Only.
112 --
113 -- {End Of Comments}
114 -- ----------------------------------------------------------------------------
115 Procedure pre_delete(p_rec in per_seu_shd.g_rec_type) is
116 --
117   l_proc  varchar2(72) := g_package||'pre_delete';
118 --
119 Begin
120   hr_utility.set_location('Entering:'||l_proc, 5);
121   --
122   hr_utility.set_location(' Leaving:'||l_proc, 10);
123 End pre_delete;
124 --
125 -- ----------------------------------------------------------------------------
126 -- |-----------------------------< post_delete >------------------------------|
127 -- ----------------------------------------------------------------------------
128 -- {Start Of Comments}
129 --
130 -- Description:
131 --   This private procedure contains any processing which is required after
132 --   the delete dml.
133 --
134 -- Prerequistes:
135 --   This is an internal procedure which is called from the del procedure.
136 --
137 -- In Parameters:
138 --   A Pl/Sql record structure.
139 --
140 -- Post Success:
141 --   Processing continues.
142 --
143 -- Post Failure:
144 --   If an error has occurred, an error message and exception will be raised
145 --   but not handled.
146 --
147 -- Developer Implementation Notes:
148 --   Any post-processing required after the delete dml is issued should be
149 --   coded within this procedure. It is important to note that any 3rd party
150 --   maintenance should be reviewed before placing in this procedure.
151 --
152 -- Access Status:
153 --   Internal Row Handler Use Only.
154 --
155 -- {End Of Comments}
156 -- -----------------------------------------------------------------------------
157 Procedure post_delete
158   (p_rec in per_seu_shd.g_rec_type
159   ,p_del_static_lists_warning out nocopy boolean) is
160 --
161   l_proc  varchar2(72) := g_package||'post_delete';
162 --
163 Begin
164 
165   IF g_debug THEN
166     hr_utility.set_location('Entering:'||l_proc, 5);
167   END IF;
168 
169   --
170   -- Set the warning flag to true if the user has static lists
171   -- and they will be deleted.
172   --
173   p_del_static_lists_warning :=
174     hr_security_internal.user_in_static_lists
175       (p_user_id             => per_seu_shd.g_old_rec.user_id
176       ,p_security_profile_id => per_seu_shd.g_old_rec.security_profile_id);
177 
178   IF p_del_static_lists_warning THEN
179     --
180     -- Delete the static lists for this user.
181     --
182     IF g_debug THEN
183       hr_utility.set_location(l_proc, 10);
184     END IF;
185 
186     hr_security_internal.delete_static_lists_for_user
187       (p_user_id             => per_seu_shd.g_old_rec.user_id
188       ,p_security_profile_id => per_seu_shd.g_old_rec.security_profile_id);
189 
190   END IF;
191 
192   IF g_debug THEN
193     hr_utility.set_location(l_proc, 15);
194   END IF;
195 
196   begin
197     --
198     per_seu_rkd.after_delete
199       (p_security_user_id
200       => p_rec.security_user_id
201       ,p_user_id_o
202       => per_seu_shd.g_old_rec.user_id
203       ,p_security_profile_id_o
204       => per_seu_shd.g_old_rec.security_profile_id
205       ,p_object_version_number_o
206       => per_seu_shd.g_old_rec.object_version_number
207       ,p_del_static_lists_warning
208       => p_del_static_lists_warning
209       );
210     --
211   exception
212     --
213     when hr_api.cannot_find_prog_unit then
214       --
215       hr_api.cannot_find_prog_unit_error
216         (p_module_name => 'PER_SECURITY_USERS'
217         ,p_hook_type   => 'AD');
218       --
219   end;
220   --
221   IF g_debug THEN
222     hr_utility.set_location('Leaving:'||l_proc, 999);
223   END IF;
224 
225 End post_delete;
226 --
227 -- ----------------------------------------------------------------------------
228 -- |---------------------------------< del >----------------------------------|
229 -- ----------------------------------------------------------------------------
230 Procedure del
231   (p_rec                      in  per_seu_shd.g_rec_type
232   ,p_del_static_lists_warning out nocopy boolean
233   ) is
234 --
235   l_proc  varchar2(72) := g_package||'del';
236   l_del_static_lists_warning boolean;
237 --
238 Begin
239   hr_utility.set_location('Entering:'||l_proc, 5);
240   --
241   -- We must lock the row which we need to delete.
242   --
243   per_seu_shd.lck
244     (p_rec.security_user_id
245     ,p_rec.object_version_number
246     );
247   --
248   -- Call the supporting delete validate operation
249   --
250   per_seu_bus.delete_validate(p_rec);
251   --
252   -- Call to raise any errors on multi-message list
253   hr_multi_message.end_validation_set;
254   --
255   -- Call the supporting pre-delete operation
256   --
257   per_seu_del.pre_delete(p_rec);
258   --
259   -- Delete the row.
260   --
261   per_seu_del.delete_dml(p_rec);
262   --
263   -- Call the supporting post-delete operation
264   --
265   per_seu_del.post_delete(p_rec, l_del_static_lists_warning);
266 
267   --
268   -- Set the out parameters.
269   --
270   p_del_static_lists_warning := l_del_static_lists_warning;
271 
272   --
273   -- Call to raise any errors on multi-message list
274   hr_multi_message.end_validation_set;
275   --
276 End del;
277 --
278 -- ----------------------------------------------------------------------------
279 -- |---------------------------------< del >----------------------------------|
280 -- ----------------------------------------------------------------------------
281 Procedure del
282   (p_security_user_id                     in         number
283   ,p_object_version_number                in         number
284   ,p_del_static_lists_warning             out nocopy boolean
285   ) is
286 --
287   l_rec   per_seu_shd.g_rec_type;
288   l_proc  varchar2(72) := g_package||'del';
289   l_del_static_lists_warning boolean;
290 --
291 Begin
292   hr_utility.set_location('Entering:'||l_proc, 5);
293   --
294   -- As the delete procedure accepts a plsql record structure we do need to
295   -- convert the  arguments into the record structure.
296   -- We don't need to call the supplied conversion argument routine as we
297   -- only need a few attributes.
298   --
299   l_rec.security_user_id := p_security_user_id;
300   l_rec.object_version_number := p_object_version_number;
301   --
302   -- Having converted the arguments into the per_seu_rec
303   -- plsql record structure we must call the corresponding entity
304   -- business process
305   --
306   per_seu_del.del(l_rec, l_del_static_lists_warning);
307 
308   --
309   -- Set the out parameters.
310   --
311   p_del_static_lists_warning := l_del_static_lists_warning;
312 
313   hr_utility.set_location(' Leaving:'||l_proc, 10);
314 
315 End del;
316 --
317 end per_seu_del;