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