1 Package Body pqh_rht_del as
2 /* $Header: pqrhtrhi.pkb 115.7 2002/12/06 18:08:02 rpasapul noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_rht_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 -- 2) To delete the specified row from the schema using the primary key in
19 -- the predicates.
20 -- 3) To trap any constraint violations that may have occurred.
21 -- 4) 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_rht_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 --
53 -- Delete the pqh_routing_history row.
54 --
55 delete from pqh_routing_history
56 where routing_history_id = p_rec.routing_history_id;
57 --
58 --
59 hr_utility.set_location(' Leaving:'||l_proc, 10);
60 --
61 Exception
62 When hr_api.child_integrity_violated then
63 -- Child integrity has been violated
64 pqh_rht_shd.constraint_error
65 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
66 When Others Then
67 Raise;
68 End delete_dml;
69 --
70 -- ----------------------------------------------------------------------------
71 -- |------------------------------< pre_delete >------------------------------|
72 -- ----------------------------------------------------------------------------
73 -- {Start Of Comments}
74 --
75 -- Description:
76 -- This private procedure contains any processing which is required before
77 -- the delete dml.
78 --
79 -- Prerequisites:
80 -- This is an internal procedure which is called from the del procedure.
81 --
82 -- In Parameters:
83 -- A Pl/Sql record structre.
84 --
85 -- Post Success:
86 -- Processing continues.
87 --
88 -- Post Failure:
89 -- If an error has occurred, an error message and exception will be raised
90 -- but not handled.
91 --
92 -- Developer Implementation Notes:
93 -- Any pre-processing required before the delete dml is issued should be
94 -- coded within this procedure. It is important to note that any 3rd party
95 -- maintenance should be reviewed before placing in this procedure.
96 --
97 -- Access Status:
98 -- Internal Row Handler Use Only.
99 --
100 -- {End Of Comments}
101 -- ----------------------------------------------------------------------------
102 Procedure pre_delete(p_rec in pqh_rht_shd.g_rec_type) is
103 --
104 l_proc varchar2(72) := g_package||'pre_delete';
105 --
106 --
107
108 Begin
109 hr_utility.set_location('Entering:'||l_proc, 5);
110 --
111 --
112 hr_utility.set_location(' Leaving:'||l_proc, 10);
113 End pre_delete;
114 --
115 -- ----------------------------------------------------------------------------
116 -- |-----------------------------< post_delete >------------------------------|
117 -- ----------------------------------------------------------------------------
118 -- {Start Of Comments}
119 --
120 -- Description:
121 -- This private procedure contains any processing which is required after the
122 -- delete dml.
123 --
124 -- Prerequisites:
125 -- This is an internal procedure which is called from the del procedure.
126 --
127 -- In Parameters:
128 -- A Pl/Sql record structre.
129 --
130 -- Post Success:
131 -- Processing continues.
132 --
133 -- Post Failure:
134 -- If an error has occurred, an error message and exception will be raised
135 -- but not handled.
136 --
137 -- Developer Implementation Notes:
138 -- Any post-processing required after the delete dml is issued should be
139 -- coded within this procedure. It is important to note that any 3rd party
140 -- maintenance should be reviewed before placing in this procedure.
141 --
142 -- Access Status:
143 -- Internal table Handler Use Only.
144 --
145 -- {End Of Comments}
146 -- ----------------------------------------------------------------------------
147 Procedure post_delete(
148 p_effective_date in date,p_rec in pqh_rht_shd.g_rec_type) is
149 --
150 l_proc varchar2(72) := g_package||'post_delete';
151 --
152 Begin
153 hr_utility.set_location('Entering:'||l_proc, 5);
154 --
155 --
156 -- Start of API User Hook for post_delete.
157 --
158 begin
159 --
160 pqh_rht_rkd.after_delete
161 (
162 p_routing_history_id =>p_rec.routing_history_id
163 ,p_approval_cd_o =>pqh_rht_shd.g_old_rec.approval_cd
164 ,p_comments_o =>pqh_rht_shd.g_old_rec.comments
165 ,p_forwarded_by_assignment_id_o =>pqh_rht_shd.g_old_rec.forwarded_by_assignment_id
166 ,p_forwarded_by_member_id_o =>pqh_rht_shd.g_old_rec.forwarded_by_member_id
167 ,p_forwarded_by_position_id_o =>pqh_rht_shd.g_old_rec.forwarded_by_position_id
168 ,p_forwarded_by_user_id_o =>pqh_rht_shd.g_old_rec.forwarded_by_user_id
169 ,p_forwarded_by_role_id_o =>pqh_rht_shd.g_old_rec.forwarded_by_role_id
170 ,p_forwarded_to_assignment_id_o =>pqh_rht_shd.g_old_rec.forwarded_to_assignment_id
171 ,p_forwarded_to_member_id_o =>pqh_rht_shd.g_old_rec.forwarded_to_member_id
172 ,p_forwarded_to_position_id_o =>pqh_rht_shd.g_old_rec.forwarded_to_position_id
173 ,p_forwarded_to_user_id_o =>pqh_rht_shd.g_old_rec.forwarded_to_user_id
174 ,p_forwarded_to_role_id_o =>pqh_rht_shd.g_old_rec.forwarded_to_role_id
175 ,p_notification_date_o =>pqh_rht_shd.g_old_rec.notification_date
176 ,p_pos_structure_version_id_o =>pqh_rht_shd.g_old_rec.pos_structure_version_id
177 ,p_routing_category_id_o =>pqh_rht_shd.g_old_rec.routing_category_id
178 ,p_transaction_category_id_o =>pqh_rht_shd.g_old_rec.transaction_category_id
179 ,p_transaction_id_o =>pqh_rht_shd.g_old_rec.transaction_id
180 ,p_user_action_cd_o =>pqh_rht_shd.g_old_rec.user_action_cd
181 ,p_from_range_name_o =>pqh_rht_shd.g_old_rec.from_range_name
182 ,p_to_range_name_o =>pqh_rht_shd.g_old_rec.to_range_name
183 ,p_list_range_name_o =>pqh_rht_shd.g_old_rec.list_range_name
184 ,p_object_version_number_o =>pqh_rht_shd.g_old_rec.object_version_number
185 );
186 --
187 exception
188 --
189 when hr_api.cannot_find_prog_unit then
190 --
191 hr_api.cannot_find_prog_unit_error
192 (p_module_name => 'pqh_routing_history'
193 ,p_hook_type => 'AD');
194 --
195 end;
196 --
197 -- End of API User Hook for post_delete.
198 --
199 --
200 hr_utility.set_location(' Leaving:'||l_proc, 10);
201 End post_delete;
202 --
203 -- ----------------------------------------------------------------------------
204 -- |---------------------------------< del >----------------------------------|
205 -- ----------------------------------------------------------------------------
206 Procedure del
207 (
208 p_effective_date in date,
209 p_rec in pqh_rht_shd.g_rec_type
210 ) is
211 --
212 l_proc varchar2(72) := g_package||'del';
213 --
214 Begin
215 hr_utility.set_location('Entering:'||l_proc, 5);
216 --
217 -- We must lock the row which we need to delete.
218 --
219 pqh_rht_shd.lck
220 (
221 p_rec.routing_history_id,
222 p_rec.object_version_number
223 );
224 --
225 -- Call the supporting delete validate operation
226 --
227 pqh_rht_bus.delete_validate(p_rec
228 ,p_effective_date);
229 --
230 -- Call the supporting pre-delete operation
231 --
232 pre_delete(p_rec);
233 --
234 -- Delete the row.
235 --
236 delete_dml(p_rec);
237 --
238 -- Call the supporting post-delete operation
239 --
240 post_delete(
241 p_effective_date,p_rec);
242 End del;
243 --
244 -- ----------------------------------------------------------------------------
245 -- |---------------------------------< del >----------------------------------|
246 -- ----------------------------------------------------------------------------
247 Procedure del
248 (
249 p_effective_date in date,
250 p_routing_history_id in number,
251 p_object_version_number in number
252 ) is
253 --
254 l_rec pqh_rht_shd.g_rec_type;
255 l_proc varchar2(72) := g_package||'del';
256 --
257 Begin
258 hr_utility.set_location('Entering:'||l_proc, 5);
259 --
260 -- As the delete procedure accepts a plsql record structure we do need to
261 -- convert the arguments into the record structure.
262 -- We don't need to call the supplied conversion argument routine as we
263 -- only need a few attributes.
264 --
265 l_rec.routing_history_id:= p_routing_history_id;
266 l_rec.object_version_number := p_object_version_number;
267 --
268 -- Having converted the arguments into the pqh_rht_rec
269 -- plsql record structure we must call the corresponding entity
270 -- business process
271 --
272 del(
273 p_effective_date,l_rec);
274 --
275 hr_utility.set_location(' Leaving:'||l_proc, 10);
276 End del;
277 --
278 end pqh_rht_del;