1 Package Body hxc_hac_del as
2 /* $Header: hxchacrhi.pkb 120.4 2006/06/13 08:42:23 gsirigin noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_hac_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_hac_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 hxc_hac_shd.g_api_dml := true; -- Set the api dml status
65 --
66 -- Delete the hxc_approval_comps row.
67 --
68
69 delete from hxc_approval_comps
70 where parent_comp_id = p_rec.approval_comp_id and
71 parent_comp_ovn = p_rec.object_version_number;
72
73 delete from hxc_approval_comps
74 where approval_comp_id = p_rec.approval_comp_id;
75 --
76 hxc_hac_shd.g_api_dml := false; -- Unset the api dml status
77 --
78 if g_debug then
79 hr_utility.set_location(' Leaving:'||l_proc, 10);
80 end if;
81 --
82 Exception
83 When hr_api.child_integrity_violated then
84 -- Child integrity has been violated
85 hxc_hac_shd.g_api_dml := false; -- Unset the api dml status
86 hxc_hac_shd.constraint_error
87 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
88 When Others Then
89 hxc_hac_shd.g_api_dml := false; -- Unset the api dml status
90 Raise;
91 End delete_dml;
92 --
93 -- ----------------------------------------------------------------------------
94 -- |------------------------------< pre_delete >------------------------------|
95 -- ----------------------------------------------------------------------------
96 -- {Start Of Comments}
97 --
98 -- Description:
99 -- This private procedure contains any processing which is required before
100 -- the delete dml.
101 --
102 -- Prerequisites:
103 -- This is an internal procedure which is called from the del procedure.
104 --
105 -- In Parameters:
106 -- A Pl/Sql record structre.
107 --
108 -- Post Success:
109 -- Processing continues.
110 --
111 -- Post Failure:
112 -- If an error has occurred, an error message and exception will be raised
113 -- but not handled.
114 --
115 -- Developer Implementation Notes:
116 -- Any pre-processing required before the delete dml is issued should be
117 -- coded within this procedure. It is important to note that any 3rd party
118 -- maintenance should be reviewed before placing in this procedure.
119 --
120 -- Access Status:
121 -- Internal Row Handler Use Only.
122 --
123 -- {End Of Comments}
124 -- ----------------------------------------------------------------------------
125 Procedure pre_delete(p_rec in hxc_hac_shd.g_rec_type) is
126 --
127 l_proc varchar2(72);
128 --
129 Begin
130 if g_debug then
131 l_proc := g_package||'pre_delete';
132 hr_utility.set_location('Entering:'||l_proc, 5);
133 --
134 hr_utility.set_location(' Leaving:'||l_proc, 10);
135 end if;
136 End pre_delete;
137 --
138 -- ----------------------------------------------------------------------------
139 -- |-----------------------------< post_delete >------------------------------|
140 -- ----------------------------------------------------------------------------
141 -- {Start Of Comments}
142 --
143 -- Description:
144 -- This private procedure contains any processing which is required after the
145 -- delete dml.
146 --
147 -- Prerequistes:
148 -- This is an internal procedure which is called from the del procedure.
149 --
150 -- In Parameters:
151 -- A Pl/Sql record structure.
152 --
153 -- Post Success:
154 -- Processing continues.
155 --
156 -- Post Failure:
157 -- If an error has occurred, an error message and exception will be raised
158 -- but not handled.
159 --
160 -- Developer Implementation Notes:
161 -- Any post-processing required after the delete dml is issued should be
162 -- coded within this procedure. It is important to note that any 3rd party
163 -- maintenance should be reviewed before placing in this procedure.
164 --
165 -- Access Status:
166 -- Internal Row Handler Use Only.
167 --
168 -- {End Of Comments}
169 -- -----------------------------------------------------------------------------
170 Procedure post_delete(p_rec in hxc_hac_shd.g_rec_type) is
171 --
172 l_proc varchar2(72);
173 --
174 Begin
175 if g_debug then
176 l_proc := g_package||'post_delete';
177 hr_utility.set_location('Entering:'||l_proc, 5);
178 end if;
179 begin
180 --
181 hxc_hac_rkd.after_delete
182 (p_approval_comp_id
183 => p_rec.approval_comp_id
184 ,p_approval_style_id_o
185 => hxc_hac_shd.g_old_rec.approval_style_id
186 ,p_time_recipient_id_o
187 => hxc_hac_shd.g_old_rec.time_recipient_id
188 ,p_approval_mechanism_o
189 => hxc_hac_shd.g_old_rec.approval_mechanism
190 ,p_approval_mechanism_id_o
191 => hxc_hac_shd.g_old_rec.approval_mechanism_id
192 ,p_wf_item_type_o
193 => hxc_hac_shd.g_old_rec.wf_item_type
194 ,p_wf_name_o
195 => hxc_hac_shd.g_old_rec.wf_name
196 ,p_start_date_o
197 => hxc_hac_shd.g_old_rec.start_date
198 ,p_end_date_o
199 => hxc_hac_shd.g_old_rec.end_date
200 ,p_object_version_number_o
201 => hxc_hac_shd.g_old_rec.object_version_number
202 ,p_approval_order_o
203 => hxc_hac_shd.g_old_rec.approval_order
204 ,p_time_category_id_o
205 => hxc_hac_shd.g_old_rec.time_category_id
206 ,p_parent_comp_id_o
207 => hxc_hac_shd.g_old_rec.parent_comp_id
208 ,p_parent_comp_ovn_o
209 => hxc_hac_shd.g_old_rec.parent_comp_ovn
210 ,p_run_recipient_extensions_o
211 =>hxc_hac_shd.g_old_rec.run_recipient_extensions
212 );
213 --
214 exception
215 --
216 when hr_api.cannot_find_prog_unit then
217 --
218 hr_api.cannot_find_prog_unit_error
219 (p_module_name => 'HXC_APPROVAL_COMPS'
220 ,p_hook_type => 'AD');
221 --
222 end;
223 --
224 if g_debug then
225 hr_utility.set_location(' Leaving:'||l_proc, 10);
226 end if;
227 End post_delete;
228 --
229 -- ----------------------------------------------------------------------------
230 -- |---------------------------------< del >----------------------------------|
231 -- ----------------------------------------------------------------------------
232 Procedure del
233 (p_rec in hxc_hac_shd.g_rec_type
234 ) is
235 --
236 l_proc varchar2(72);
237 --
238 Begin
239 g_debug:=hr_utility.debug_enabled;
240 if g_debug then
241 l_proc := g_package||'del';
242 hr_utility.set_location('Entering:'||l_proc, 5);
243 end if;
244 --
245 -- We must lock the row which we need to delete.
246 --
247 hxc_hac_shd.lck
248 (p_rec.approval_comp_id
249 ,p_rec.object_version_number
250 );
251 --
252 -- Call the supporting delete validate operation
253 --
254 hxc_hac_bus.delete_validate(p_rec);
255 --
256 -- Call the supporting pre-delete operation
257 --
258 hxc_hac_del.pre_delete(p_rec);
259 --
260 -- Delete the row.
261 --
262 hxc_hac_del.delete_dml(p_rec);
263 --
264 -- Call the supporting post-delete operation
265 --
266 hxc_hac_del.post_delete(p_rec);
267 --
268 End del;
269 --
270 -- ----------------------------------------------------------------------------
271 -- |---------------------------------< del >----------------------------------|
272 -- ----------------------------------------------------------------------------
273 Procedure del
274 (p_approval_comp_id in number
275 ,p_object_version_number in number
276 ) is
277 --
278 l_rec hxc_hac_shd.g_rec_type;
279 l_proc varchar2(72);
280 --
281 Begin
282 g_debug:=hr_utility.debug_enabled;
283 if g_debug then
284 l_proc := g_package||'del';
285 hr_utility.set_location('Entering:'||l_proc, 5);
286 end if;
287 --
288 -- As the delete procedure accepts a plsql record structure we do need to
289 -- convert the arguments into the record structure.
290 -- We don't need to call the supplied conversion argument routine as we
291 -- only need a few attributes.
292 --
293 l_rec.approval_comp_id := p_approval_comp_id;
294 l_rec.object_version_number := p_object_version_number;
295 --
296 -- Having converted the arguments into the hxc_hac_rec
297 -- plsql record structure we must call the corresponding entity
298 -- business process
299 --
300 hxc_hac_del.del(l_rec);
301 --
302 if g_debug then
303 hr_utility.set_location(' Leaving:'||l_proc, 10);
304 end if;
305 End del;
306 --
307 end hxc_hac_del;