1 Package Body hxc_han_del as
2 /* $Header: hxchanrhi.pkb 120.2 2006/07/10 10:09:56 gsirigin noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_han_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 hxc_han_shd.g_rec_type
54 ) is
55 --
56 l_proc varchar2(72) := g_package||'delete_dml';
57 --
58 Begin
59 if g_debug then
60 hr_utility.set_location('Entering:'||l_proc, 5);
61 end if;
62 --
63 --
64 --
65 -- Delete the hxc_app_comp_notifications row.
66 --
67 delete from hxc_app_comp_notifications
68 where comp_notification_id = p_rec.comp_notification_id
69 and object_version_number = p_rec.object_version_number
70 and created_by <>2;
71 --
72 --
73 --
74 if g_debug then
75 hr_utility.set_location(' Leaving:'||l_proc, 10);
76 end if;
77 --
78 Exception
79 When hr_api.child_integrity_violated then
80 -- Child integrity has been violated
81 --
82 hxc_han_shd.constraint_error
83 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
84 When Others Then
85 --
86 Raise;
87 End delete_dml;
88 --
89 -- ----------------------------------------------------------------------------
90 -- |------------------------------< pre_delete >------------------------------|
91 -- ----------------------------------------------------------------------------
92 -- {Start Of Comments}
93 --
94 -- Description:
95 -- This private procedure contains any processing which is required before
96 -- the delete dml.
97 --
98 -- Prerequisites:
99 -- This is an internal procedure which is called from the del procedure.
100 --
101 -- In Parameters:
102 -- A Pl/Sql record structre.
103 --
104 -- Post Success:
105 -- Processing continues.
106 --
107 -- Post Failure:
108 -- If an error has occurred, an error message and exception will be raised
109 -- but not handled.
110 --
111 -- Developer Implementation Notes:
112 -- Any pre-processing required before the delete dml is issued should be
113 -- coded within this procedure. It is important to note that any 3rd party
114 -- maintenance should be reviewed before placing in this procedure.
115 --
116 -- Access Status:
117 -- Internal Row Handler Use Only.
118 --
119 -- {End Of Comments}
120 -- ----------------------------------------------------------------------------
121 Procedure pre_delete(p_rec in hxc_han_shd.g_rec_type) is
122 --
123 l_proc varchar2(72) := g_package||'pre_delete';
124 --
125 Begin
126 if g_debug then
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 hxc_han_shd.g_rec_type) is
168 --
169 l_proc varchar2(72) := g_package||'post_delete';
170 --
171 Begin
172 if g_debug then
173 hr_utility.set_location('Entering:'||l_proc, 5);
174 end if;
175 begin
176 --
177 hxc_han_rkd.after_delete
178 (p_comp_notification_id
179 => p_rec.comp_notification_id
180 ,p_object_version_number
181 => p_rec.object_version_number
182 ,p_notification_num_retries_o
183 => hxc_han_shd.g_old_rec.notification_number_retries
184 ,p_notification_timeout_value_o
185 => hxc_han_shd.g_old_rec.notification_timeout_value
186 ,p_notification_action_code_o
187 => hxc_han_shd.g_old_rec.notification_action_code
188 ,p_notification_recip_code_o
189 => hxc_han_shd.g_old_rec.notification_recipient_code
190 );
191 --
192 exception
193 --
194 when hr_api.cannot_find_prog_unit then
195 --
196 hr_api.cannot_find_prog_unit_error
197 (p_module_name => 'HXC_APP_COMP_NOTIFICATIONS'
198 ,p_hook_type => 'AD');
199 --
200 end;
201 --
202 if g_debug then
203 hr_utility.set_location(' Leaving:'||l_proc, 10);
204 end if;
205 End post_delete;
206 --
207 -- ----------------------------------------------------------------------------
208 -- |---------------------------------< del >----------------------------------|
209 -- ----------------------------------------------------------------------------
210 Procedure del
211 (p_rec in hxc_han_shd.g_rec_type
212 ) is
213 --
214 l_proc varchar2(72) := g_package||'del';
215 --
216 Begin
217 if g_debug then
218 hr_utility.set_location('Entering:'||l_proc, 5);
219 end if;
220 --
221 -- We must lock the row which we need to delete.
222 --
223 hxc_han_shd.lck
224 (p_rec.comp_notification_id
225 ,p_rec.object_version_number
226 );
227 --
228 -- Call the supporting delete validate operation
229 --
230 hxc_han_bus.delete_validate(p_rec);
231 --
232 -- Call to raise any errors on multi-message list
233 hr_multi_message.end_validation_set;
234 --
235 -- Call the supporting pre-delete operation
236 --
237 hxc_han_del.pre_delete(p_rec);
238 --
239 -- Delete the row.
240 --
241 hxc_han_del.delete_dml(p_rec);
242 --
243 -- Call the supporting post-delete operation
244 --
245 hxc_han_del.post_delete(p_rec);
246 --
247 -- Call to raise any errors on multi-message list
248 hr_multi_message.end_validation_set;
249 --
250 End del;
251 --
252 -- ----------------------------------------------------------------------------
253 -- |---------------------------------< del >----------------------------------|
254 -- ----------------------------------------------------------------------------
255 Procedure del
256 (p_comp_notification_id in number
257 ,p_object_version_number in number
258 ) is
259 --
260 l_rec hxc_han_shd.g_rec_type;
261 l_proc varchar2(72) := g_package||'del';
262 --
263 Begin
264 if g_debug then
265 hr_utility.set_location('Entering:'||l_proc, 5);
266 end if;
267 --
268 -- As the delete procedure accepts a plsql record structure we do need to
269 -- convert the arguments into the record structure.
270 -- We don't need to call the supplied conversion argument routine as we
271 -- only need a few attributes.
272 --
273 l_rec.comp_notification_id := p_comp_notification_id;
274 l_rec.object_version_number := p_object_version_number;
275 l_rec.object_version_number := p_object_version_number;
276 --
277 -- Having converted the arguments into the hxc_han_rec
278 -- plsql record structure we must call the corresponding entity
279 -- business process
280 --
281 hxc_han_del.del(l_rec);
282 --
283 if g_debug then
284 hr_utility.set_location(' Leaving:'||l_proc, 10);
285 end if;
286 End del;
287 --
288 end hxc_han_del;