DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_PRH_DEL

Source


1 Package Body ghr_prh_del as
2 /* $Header: ghprhrhi.pkb 120.2.12000000.1 2007/03/27 09:52:58 managarw noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ghr_prh_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 -- Pre Conditions:
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 Table Handler Use Only.
42 --
43 -- {End Of Comments}
44 -- ----------------------------------------------------------------------------
45 Procedure delete_dml(p_rec in ghr_prh_shd.g_rec_type) is
46 --
47   l_proc  varchar2(72);
48 --
49 Begin
50   l_proc := g_package||'delete_dml';
51   hr_utility.set_location('Entering:'||l_proc, 5);
52   --
53 
54   -- Delete the ghr_pa_routing_history row.
55   --
56   delete from ghr_pa_routing_history
57   where pa_routing_history_id = p_rec.pa_routing_history_id;
58   --
59 
60   hr_utility.set_location(' Leaving:'||l_proc, 10);
61 --
62 Exception
63   When hr_api.child_integrity_violated then
64     -- Child integrity has been violated
65     ghr_prh_shd.constraint_error
66       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
67   When Others Then
68      Raise;
69 End delete_dml;
70 --
71 -- ----------------------------------------------------------------------------
72 -- |------------------------------< pre_delete >------------------------------|
73 -- ----------------------------------------------------------------------------
74 -- {Start Of Comments}
75 --
76 -- Description:
77 --   This private procedure contains any processing which is required before
78 --   the delete dml.
79 --
80 -- Pre Conditions:
81 --   This is an internal procedure which is called from the del procedure.
82 --
83 -- In Parameters:
84 --   A Pl/Sql record structre.
85 --
86 -- Post Success:
87 --   Processing continues.
88 --
89 -- Post Failure:
90 --   If an error has occurred, an error message and exception will be raised
91 --   but not handled.
92 --
93 -- Developer Implementation Notes:
94 --   Any pre-processing required before the delete dml is issued should be
95 --   coded within this procedure. It is important to note that any 3rd party
96 --   maintenance should be reviewed before placing in this procedure.
97 --
98 -- Access Status:
99 --   Internal Table Handler Use Only.
100 --
101 -- {End Of Comments}
102 -- ----------------------------------------------------------------------------
103 Procedure pre_delete(p_rec in ghr_prh_shd.g_rec_type) is
104 --
105   l_proc  varchar2(72) ;
106 --
107 Begin
108   l_proc := g_package||'pre_delete';
109   hr_utility.set_location('Entering:'||l_proc, 5);
110   --
111   hr_utility.set_location(' Leaving:'||l_proc, 10);
112 End pre_delete;
113 --
114 -- ----------------------------------------------------------------------------
115 -- |-----------------------------< post_delete >------------------------------|
116 -- ----------------------------------------------------------------------------
117 -- {Start Of Comments}
118 --
119 -- Description:
120 --   This private procedure contains any processing which is required after the
121 --   delete dml.
122 --
123 -- Pre Conditions:
124 --   This is an internal procedure which is called from the del procedure.
125 --
126 -- In Parameters:
127 --   A Pl/Sql record structre.
128 --
129 -- Post Success:
130 --   Processing continues.
131 --
132 -- Post Failure:
133 --   If an error has occurred, an error message and exception will be raised
134 --   but not handled.
135 --
136 -- Developer Implementation Notes:
137 --   Any post-processing required after the delete dml is issued should be
138 --   coded within this procedure. It is important to note that any 3rd party
139 --   maintenance should be reviewed before placing in this procedure.
140 --
141 -- Access Status:
142 --   Internal table Handler Use Only.
143 --
144 -- {End Of Comments}
145 -- ----------------------------------------------------------------------------
146 Procedure post_delete(p_rec in ghr_prh_shd.g_rec_type) is
147 --
148   l_proc  varchar2(72) ;
149 --
150 Begin
151   l_proc := g_package||'post_delete';
152   hr_utility.set_location('Entering:'||l_proc, 5);
153   --
154   -- This is a hook point and the user hook for post_delete is called here.
155   --
156   begin
157      ghr_prh_rkd.after_delete	(
158       p_pa_routing_history_id      => p_rec.pa_routing_history_id,
159       p_pa_request_id_o            => ghr_prh_shd.g_old_rec.pa_request_id,
160       p_action_taken_o             => ghr_prh_shd.g_old_rec.action_taken,
161       p_approved_flag_o            => ghr_prh_shd.g_old_rec.approved_flag,
162       p_approver_flag_o            => ghr_prh_shd.g_old_rec.approver_flag,
163       p_approval_status_o          => ghr_prh_shd.g_old_rec.approval_status,
164       p_attachment_modified_flag_o => ghr_prh_shd.g_old_rec.attachment_modified_flag,
165       p_authorizer_flag_o          => ghr_prh_shd.g_old_rec.authorizer_flag,
166       p_date_notification_sent_o   => ghr_prh_shd.g_old_rec.date_notification_sent,
167       p_groupbox_id_o              => ghr_prh_shd.g_old_rec.groupbox_id,
168       p_initiator_flag_o           => ghr_prh_shd.g_old_rec.initiator_flag,
169       p_nature_of_action_id_o      => ghr_prh_shd.g_old_rec.nature_of_action_id,
170       p_noa_family_code_o          => ghr_prh_shd.g_old_rec.noa_family_code,
171       p_notepad_o                  => ghr_prh_shd.g_old_rec.notepad,
172       p_personnelist_flag_o        => ghr_prh_shd.g_old_rec.personnelist_flag,
173       p_requester_flag_o           => ghr_prh_shd.g_old_rec.requester_flag,
174       p_reviewer_flag_o            => ghr_prh_shd.g_old_rec.reviewer_flag,
175       p_routing_list_id_o          => ghr_prh_shd.g_old_rec.routing_list_id,
176       p_routing_seq_number_o       => ghr_prh_shd.g_old_rec.routing_seq_number,
177       p_second_nature_of_action_id_o =>
178                                    ghr_prh_shd.g_old_rec.second_nature_of_action_id,
179       p_user_name_o                => ghr_prh_shd.g_old_rec.user_name,
180       p_user_name_employee_id_o    => ghr_prh_shd.g_old_rec.user_name_employee_id,
181       p_user_name_emp_first_name_o => ghr_prh_shd.g_old_rec.user_name_emp_first_name,
182       p_user_name_emp_last_name_o  => ghr_prh_shd.g_old_rec.user_name_emp_last_name,
183       p_user_name_emp_middle_names_o =>
184                                    ghr_prh_shd.g_old_rec.user_name_emp_middle_names,
185       p_object_version_number_o    => ghr_prh_shd.g_old_rec.object_version_number
186       );
187 
188   exception
189         when hr_api.cannot_find_prog_unit then
190              hr_api.cannot_find_prog_unit_error
191 		 (	 p_module_name => 'GHR_PA_ROUTING_HISTORY'
192 			,p_hook_type   => 'AD'
193 	        );
194   end;
195   -- End of API User Hook for post_delete.
196   --
197   hr_utility.set_location(' Leaving:'||l_proc, 10);
198 End post_delete;
199 --
200 -- ----------------------------------------------------------------------------
201 -- |---------------------------------< del >----------------------------------|
202 -- ----------------------------------------------------------------------------
203 Procedure del
204   (
205   p_rec	      in ghr_prh_shd.g_rec_type,
206   p_validate  in boolean default false
207   ) is
208 --
209   l_proc  varchar2(72);
210 --
211 Begin
212   l_proc  := g_package||'del';
213   hr_utility.set_location('Entering:'||l_proc, 5);
214   --
215   -- Determine if the business process is to be validated.
216   --
217   If p_validate then
218     --
219     -- Issue the savepoint.
220     --
221     SAVEPOINT del_ghr_prh;
222   End If;
223   --
224   -- We must lock the row which we need to delete.
225   --
226   ghr_prh_shd.lck
227 	(
228 	p_rec.pa_routing_history_id,
229 	p_rec.object_version_number
230 	);
231   --
232   -- Call the supporting delete validate operation
233   --
234   ghr_prh_bus.delete_validate(p_rec);
235   --
236   -- Call the supporting pre-delete operation
237   --
238   pre_delete(p_rec);
239   --
240   -- Delete the row.
241   --
242   delete_dml(p_rec);
243   --
244   -- Call the supporting post-delete operation
245   --
246   post_delete(p_rec);
247   --
248   -- If we are validating then raise the Validate_Enabled exception
249   --
250   If p_validate then
251     Raise HR_Api.Validate_Enabled;
252   End If;
253   --
254   hr_utility.set_location(' Leaving:'||l_proc, 10);
255 Exception
256   When HR_Api.Validate_Enabled Then
257     --
258     -- As the Validate_Enabled exception has been raised
259     -- we must rollback to the savepoint
260     --
261     ROLLBACK TO del_ghr_prh;
262 End del;
263 --
264 -- ----------------------------------------------------------------------------
265 -- |---------------------------------< del >----------------------------------|
266 -- ----------------------------------------------------------------------------
267 Procedure del
268   (
269   p_pa_routing_history_id              in number,
270   p_object_version_number              in number,
271   p_validate                           in boolean default false
272   ) is
273 --
274   l_rec	  ghr_prh_shd.g_rec_type;
275   l_proc  varchar2(72) ;
276 --
277 Begin
278   l_proc  := g_package||'del';
279   hr_utility.set_location('Entering:'||l_proc, 5);
280   --
281   -- As the delete procedure accepts a plsql record structure we do need to
282   -- convert the  arguments into the record structure.
283   -- We don't need to call the supplied conversion argument routine as we
284   -- only need a few attributes.
285   --
286   l_rec.pa_routing_history_id:= p_pa_routing_history_id;
287   l_rec.object_version_number := p_object_version_number;
288   --
289   -- Having converted the arguments into the ghr_prh_rec
290   -- plsql record structure we must call the corresponding entity
291   -- business process
292   --
293   del(l_rec, p_validate);
294   --
295   hr_utility.set_location(' Leaving:'||l_proc, 10);
296 End del;
297 --
298 end ghr_prh_del;