1 Package Body pqh_tem_del as
2 /* $Header: pqtemrhi.pkb 120.5 2011/04/28 09:32:18 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_tem_del.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< delete_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the actual dml delete logic. The functions of
17 -- this procedure are as follows:
18 -- 1) To delete the specified row from the schema using the primary key in
19 -- the predicates.
20 -- 2) To trap any constraint violations that may have occurred.
21 -- 3) To raise any other errors.
22 --
23 -- Prerequisites:
24 -- This is an internal private procedure which must be called from the del
25 -- procedure.
26 --
27 -- In Parameters:
28 -- A Pl/Sql record structre.
29 --
30 -- Post Success:
31 -- The specified row will be delete from the schema.
32 --
33 -- Post Failure:
34 -- If a child integrity constraint violation is raised the
35 -- constraint_error procedure will be called.
36 --
37 -- Developer Implementation Notes:
38 -- None.
39 --
40 -- Access Status:
41 -- Internal Row Handler Use Only.
42 --
43 -- {End Of Comments}
44 -- ----------------------------------------------------------------------------
45 Procedure delete_dml(p_rec in pqh_tem_shd.g_rec_type) is
46 --
47 l_proc varchar2(72) := g_package||'delete_dml';
48 --
49 Begin
50 hr_utility.set_location('Entering:'||l_proc, 5);
51 --
52 PER_RIC_PKG.chk_integrity(
53 p_entity_name=>'PQH_TEMPLATES',
54 p_ref_entity_info =>
55 PER_RIC_PKG.ref_entity_tbl(
56 PER_RIC_PKG.ref_info_rec('PQH_REF_TEMPLATES',PER_RIC_PKG.column_info_tbl(
57 PER_RIC_PKG.col_info_rec('BASE_TEMPLATE_ID', NULL,p_rec.template_id, NULL))),
58 PER_RIC_PKG.ref_info_rec('PQH_REF_TEMPLATES',PER_RIC_PKG.column_info_tbl(
59 PER_RIC_PKG.col_info_rec('PARENT_TEMPLATE_ID', NULL,p_rec.template_id, NULL))),
60 PER_RIC_PKG.ref_info_rec('PQH_TEMPLATE_ATTRIBUTES', PER_RIC_PKG.column_info_tbl(
61 PER_RIC_PKG.col_info_rec('TEMPLATE_ID',NULL,p_rec.template_id,NULL))),
62 PER_RIC_PKG.ref_info_rec('PQH_TEMPLATES_TL', PER_RIC_PKG.column_info_tbl(
63 PER_RIC_PKG.col_info_rec('TEMPLATE_ID',NULL,p_rec.template_id,NULL)))),
64 p_ref_type=>'DEL');
65 --
66 -- Delete the pqh_templates row.
67 --
68 delete from pqh_templates
69 where template_id = p_rec.template_id;
70 --
71 --
72 hr_utility.set_location(' Leaving:'||l_proc, 10);
73 --
74 Exception
75 When hr_api.child_integrity_violated then
76 -- Child integrity has been violated
77 pqh_tem_shd.constraint_error
78 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
79 When Others Then
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 pqh_tem_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 the
132 -- delete dml.
133 --
134 -- Prerequisites:
135 -- This is an internal procedure which is called from the del procedure.
136 --
137 -- In Parameters:
138 -- A Pl/Sql record structre.
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 table Handler Use Only.
154 --
155 -- {End Of Comments}
156 -- ----------------------------------------------------------------------------
157 Procedure post_delete(
158 p_effective_date in date,p_rec in pqh_tem_shd.g_rec_type) is
159 --
160 l_proc varchar2(72) := g_package||'post_delete';
161 --
162 Begin
163 hr_utility.set_location('Entering:'||l_proc, 5);
164 --
165 --
166 -- Start of API User Hook for post_delete.
167 --
168 begin
169 --
170 pqh_tem_rkd.after_delete
171 (
172 p_template_id =>p_rec.template_id
173 ,p_template_name_o =>pqh_tem_shd.g_old_rec.template_name
174 ,p_short_name_o =>pqh_tem_shd.g_old_rec.short_name
175 ,p_attribute_only_flag_o =>pqh_tem_shd.g_old_rec.attribute_only_flag
176 ,p_enable_flag_o =>pqh_tem_shd.g_old_rec.enable_flag
177 ,p_create_flag_o =>pqh_tem_shd.g_old_rec.create_flag
178 ,p_transaction_category_id_o =>pqh_tem_shd.g_old_rec.transaction_category_id
179 ,p_under_review_flag_o =>pqh_tem_shd.g_old_rec.under_review_flag
180 ,p_object_version_number_o =>pqh_tem_shd.g_old_rec.object_version_number
181 ,p_freeze_status_cd_o =>pqh_tem_shd.g_old_rec.freeze_status_cd
182 ,p_template_type_cd_o =>pqh_tem_shd.g_old_rec.template_type_cd
183 ,p_legislation_code_o =>pqh_tem_shd.g_old_rec.legislation_code
184 );
185 --
186 exception
187 --
188 when hr_api.cannot_find_prog_unit then
189 --
190 hr_api.cannot_find_prog_unit_error
191 (p_module_name => 'pqh_templates'
192 ,p_hook_type => 'AD');
193 --
194 end;
195 --
196 -- End of API User Hook for post_delete.
197 --
198 --
199 hr_utility.set_location(' Leaving:'||l_proc, 10);
200 End post_delete;
201 --
202 -- ----------------------------------------------------------------------------
203 -- |---------------------------------< del >----------------------------------|
204 -- ----------------------------------------------------------------------------
205 Procedure del
206 (
207 p_effective_date in date,
208 p_rec in pqh_tem_shd.g_rec_type
209 ) is
210 --
211 l_proc varchar2(72) := g_package||'del';
212 --
213 Begin
214 hr_utility.set_location('Entering:'||l_proc, 5);
215 --
216 -- We must lock the row which we need to delete.
217 --
218 pqh_tem_shd.lck
219 (
220 p_rec.template_id,
221 p_rec.object_version_number
222 );
223 --
224 -- Call the supporting delete validate operation
225 --
226 pqh_tem_bus.delete_validate(p_rec
227 ,p_effective_date);
228 --
229 -- Call the supporting pre-delete operation
230 --
231 pre_delete(p_rec);
232 --
233 -- Delete the row.
234 --
235 delete_dml(p_rec);
236 --
237 -- Call the supporting post-delete operation
238 --
239 post_delete(
240 p_effective_date,p_rec);
241 End del;
242 --
243 -- ----------------------------------------------------------------------------
244 -- |---------------------------------< del >----------------------------------|
245 -- ----------------------------------------------------------------------------
246 Procedure del
247 (
248 p_effective_date in date,
249 p_template_id in number,
250 p_object_version_number in number
251 ) is
252 --
253 l_rec pqh_tem_shd.g_rec_type;
254 l_proc varchar2(72) := g_package||'del';
255 --
256 Begin
257 hr_utility.set_location('Entering:'||l_proc, 5);
258 --
259 -- As the delete procedure accepts a plsql record structure we do need to
260 -- convert the arguments into the record structure.
261 -- We don't need to call the supplied conversion argument routine as we
262 -- only need a few attributes.
263 --
264 l_rec.template_id:= p_template_id;
265 l_rec.object_version_number := p_object_version_number;
266 --
267 -- Having converted the arguments into the pqh_tem_rec
268 -- plsql record structure we must call the corresponding entity
269 -- business process
270 --
271 del(
272 p_effective_date,l_rec);
273 --
274 hr_utility.set_location(' Leaving:'||l_proc, 10);
275 End del;
276 --
277 end pqh_tem_del;