1 Package Body hr_nmf_del as
2 /* $Header: hrnmfrhi.pkb 120.0 2005/05/31 01:34 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_nmf_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 delete the specified row from the schema using the primary key in
20 -- the predicates.
21 -- 2) To trap any constraint violations that may have occurred.
22 -- 3) To raise any other errors.
23 --
24 -- Prerequisites:
25 -- This is an internal private procedure which must be called from the del
26 -- procedure.
27 --
28 -- In Parameters:
29 -- A Pl/Sql record structre.
30 --
31 -- Post Success:
32 -- The specified row will be delete from the schema.
33 --
34 -- Post Failure:
35 -- If a child integrity constraint violation is raised the
36 -- constraint_error procedure will be called.
37 --
38 -- Developer Implementation Notes:
39 -- None.
40 --
41 -- Access Status:
42 -- Internal Row Handler Use Only.
43 --
44 -- {End Of Comments}
45 -- ----------------------------------------------------------------------------
46 Procedure delete_dml
47 (p_rec in hr_nmf_shd.g_rec_type
48 ) is
49 --
50 l_proc varchar2(72) := g_package||'delete_dml';
51 --
52 Begin
53 if g_debug then
54 hr_utility.set_location('Entering:'||l_proc, 5);
55 end if;
56 --
57 -- Delete the hr_name_formats row.
58 --
59 delete from hr_name_formats
60 where name_format_id = p_rec.name_format_id;
61 --
62 if g_debug then
63 hr_utility.set_location(' Leaving:'||l_proc, 10);
64 end if;
65 --
66 Exception
67 When hr_api.child_integrity_violated then
68 -- Child integrity has been violated
69 hr_nmf_shd.constraint_error
70 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
71 When Others Then
72 Raise;
73 End delete_dml;
74 --
75 -- ----------------------------------------------------------------------------
76 -- |------------------------------< pre_delete >------------------------------|
77 -- ----------------------------------------------------------------------------
78 -- {Start Of Comments}
79 --
80 -- Description:
81 -- This private procedure contains any processing which is required before
82 -- the delete dml.
83 --
84 -- Prerequisites:
85 -- This is an internal procedure which is called from the del procedure.
86 --
87 -- In Parameters:
88 -- A Pl/Sql record structre.
89 --
90 -- Post Success:
91 -- Processing continues.
92 --
93 -- Post Failure:
94 -- If an error has occurred, an error message and exception will be raised
95 -- but not handled.
96 --
97 -- Developer Implementation Notes:
98 -- Any pre-processing required before the delete dml is issued should be
99 -- coded within this procedure. It is important to note that any 3rd party
100 -- maintenance should be reviewed before placing in this procedure.
101 --
102 -- Access Status:
103 -- Internal Row Handler Use Only.
104 --
105 -- {End Of Comments}
106 -- ----------------------------------------------------------------------------
107 Procedure pre_delete(p_rec in hr_nmf_shd.g_rec_type) is
108 --
109 l_proc varchar2(72) := g_package||'pre_delete';
110 --
111 Begin
112 if g_debug then
113 hr_utility.set_location('Entering:'||l_proc, 5);
114 end if;
115 --
116 if g_debug then
117 hr_utility.set_location(' Leaving:'||l_proc, 10);
118 end if;
119 End pre_delete;
120 --
121 -- ----------------------------------------------------------------------------
122 -- |-----------------------------< post_delete >------------------------------|
123 -- ----------------------------------------------------------------------------
124 -- {Start Of Comments}
125 --
126 -- Description:
127 -- This private procedure contains any processing which is required after
128 -- the delete dml.
129 --
130 -- Prerequistes:
131 -- This is an internal procedure which is called from the del procedure.
132 --
133 -- In Parameters:
134 -- A Pl/Sql record structure.
135 --
136 -- Post Success:
137 -- Processing continues.
138 --
139 -- Post Failure:
140 -- If an error has occurred, an error message and exception will be raised
141 -- but not handled.
142 --
143 -- Developer Implementation Notes:
144 -- Any post-processing required after the delete dml is issued should be
145 -- coded within this procedure. It is important to note that any 3rd party
146 -- maintenance should be reviewed before placing in this procedure.
147 --
148 -- Access Status:
149 -- Internal Row Handler Use Only.
150 --
151 -- {End Of Comments}
152 -- -----------------------------------------------------------------------------
153 Procedure post_delete(p_rec in hr_nmf_shd.g_rec_type) is
154 --
155 l_proc varchar2(72) := g_package||'post_delete';
156 --
157 Begin
158 if g_debug then
159 hr_utility.set_location('Entering:'||l_proc, 5);
160 end if;
161 begin
162 --
163 hr_nmf_rkd.after_delete
164 (p_name_format_id
165 => p_rec.name_format_id
166 ,p_format_name_o
167 => hr_nmf_shd.g_old_rec.format_name
168 ,p_legislation_code_o
169 => hr_nmf_shd.g_old_rec.legislation_code
170 ,p_user_format_choice_o
171 => hr_nmf_shd.g_old_rec.user_format_choice
172 ,p_format_mask_o
173 => hr_nmf_shd.g_old_rec.format_mask
174 ,p_object_version_number_o
175 => hr_nmf_shd.g_old_rec.object_version_number
176 );
177 --
178 exception
179 --
180 when hr_api.cannot_find_prog_unit then
181 --
182 hr_api.cannot_find_prog_unit_error
183 (p_module_name => 'HR_NAME_FORMATS'
184 ,p_hook_type => 'AD');
185 --
186 end;
187 --
188 if g_debug then
189 hr_utility.set_location(' Leaving:'||l_proc, 10);
190 end if;
191 End post_delete;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |---------------------------------< del >----------------------------------|
195 -- ----------------------------------------------------------------------------
196 Procedure del
197 (p_rec in hr_nmf_shd.g_rec_type
198 ) is
199 --
200 l_proc varchar2(72) := g_package||'del';
201 --
202 Begin
203 if g_debug then
204 hr_utility.set_location('Entering:'||l_proc, 5);
205 end if;
206 --
207 -- We must lock the row which we need to delete.
208 --
209 hr_nmf_shd.lck
210 (p_rec.name_format_id
211 ,p_rec.object_version_number
212 );
213 --
214 -- Call the supporting delete validate operation
215 --
216 hr_nmf_bus.delete_validate(p_rec);
217 --
218 -- Call to raise any errors on multi-message list
219 hr_multi_message.end_validation_set;
220 --
221 -- Call the supporting pre-delete operation
222 --
223 hr_nmf_del.pre_delete(p_rec);
224 --
225 -- Delete the row.
226 --
227 hr_nmf_del.delete_dml(p_rec);
228 --
229 -- Call the supporting post-delete operation
230 --
231 hr_nmf_del.post_delete(p_rec);
232 --
233 -- Call to raise any errors on multi-message list
234 hr_multi_message.end_validation_set;
235 --
236 End del;
237 --
238 -- ----------------------------------------------------------------------------
239 -- |---------------------------------< del >----------------------------------|
240 -- ----------------------------------------------------------------------------
241 Procedure del
242 (p_name_format_id in number
243 ,p_object_version_number in number
244 ) is
245 --
246 l_rec hr_nmf_shd.g_rec_type;
247 l_proc varchar2(72) := g_package||'del';
248 --
249 Begin
250 if g_debug then
251 hr_utility.set_location('Entering:'||l_proc, 5);
252 end if;
253 --
254 -- As the delete procedure accepts a plsql record structure we do need to
255 -- convert the arguments into the record structure.
256 -- We don't need to call the supplied conversion argument routine as we
257 -- only need a few attributes.
258 --
259 l_rec.name_format_id := p_name_format_id;
260 l_rec.object_version_number := p_object_version_number;
261 --
262 -- Having converted the arguments into the hr_nmf_rec
263 -- plsql record structure we must call the corresponding entity
264 -- business process
265 --
266 hr_nmf_del.del(l_rec);
267 --
268 if g_debug then
269 hr_utility.set_location(' Leaving:'||l_proc, 10);
270 end if;
271 End del;
272 --
273 end hr_nmf_del;