DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_PDH_DEL

Source


1 Package Body ghr_pdh_del as
2 /* $Header: ghpdhrhi.pkb 120.1 2006/01/17 06:21:22 sumarimu noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ghr_pdh_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_pdh_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 ghr_pd_routing_history row.
54   --
55   delete from ghr_pd_routing_history
56   where pd_routing_history_id = p_rec.pd_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     ghr_pdh_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 -- Pre Conditions:
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 Table Handler Use Only.
99 --
100 -- {End Of Comments}
101 -- ----------------------------------------------------------------------------
102 Procedure pre_delete(p_rec in ghr_pdh_shd.g_rec_type) is
103 --
104   l_proc  varchar2(72) := g_package||'pre_delete';
105 --
106 Begin
107   hr_utility.set_location('Entering:'||l_proc, 5);
108   --
109   hr_utility.set_location(' Leaving:'||l_proc, 10);
110 End pre_delete;
111 --
112 -- ----------------------------------------------------------------------------
113 -- |-----------------------------< post_delete >------------------------------|
114 -- ----------------------------------------------------------------------------
115 -- {Start Of Comments}
116 --
117 -- Description:
118 --   This private procedure contains any processing which is required after the
119 --   delete dml.
120 --
121 -- Pre Conditions:
122 --   This is an internal procedure which is called from the del procedure.
123 --
124 -- In Parameters:
125 --   A Pl/Sql record structre.
126 --
127 -- Post Success:
128 --   Processing continues.
129 --
130 -- Post Failure:
131 --   If an error has occurred, an error message and exception will be raised
132 --   but not handled.
133 --
134 -- Developer Implementation Notes:
135 --   Any post-processing required after the delete dml is issued should be
136 --   coded within this procedure. It is important to note that any 3rd party
137 --   maintenance should be reviewed before placing in this procedure.
138 --
139 -- Access Status:
140 --   Internal table Handler Use Only.
141 --
142 -- {End Of Comments}
143 -- ----------------------------------------------------------------------------
144 Procedure post_delete(p_rec in ghr_pdh_shd.g_rec_type) is
145 --
146   l_proc  varchar2(72) := g_package||'post_delete';
147 --
148 Begin
149   hr_utility.set_location('Entering:'||l_proc, 5);
150   --
151   -- This is a hook point and the user hook for post_delete is called here.
152   --
153   begin
154      ghr_pdh_rkd.after_delete	(
155       p_pd_routing_history_id       =>     p_rec.pd_routing_history_id,
156       p_position_description_id_o   =>     ghr_pdh_shd.g_old_rec.position_description_id,
157       p_initiator_flag_o            =>     ghr_pdh_shd.g_old_rec.initiator_flag,
158       p_requester_flag_o            =>     ghr_pdh_shd.g_old_rec.requester_flag,
159       p_approver_flag_o             =>     ghr_pdh_shd.g_old_rec.approver_flag,
160       p_personnelist_flag_o         =>     ghr_pdh_shd.g_old_rec.personnelist_flag,
161       p_reviewer_flag_o             =>     ghr_pdh_shd.g_old_rec.reviewer_flag,
162       p_authorizer_flag_o           =>     ghr_pdh_shd.g_old_rec.authorizer_flag,
163       p_approved_flag_o             =>     ghr_pdh_shd.g_old_rec.approved_flag,
164       p_user_name_o                 =>     ghr_pdh_shd.g_old_rec.user_name,
165       p_user_name_employee_id_o     =>     ghr_pdh_shd.g_old_rec.user_name_employee_id,
166       p_user_name_emp_first_name_o  =>     ghr_pdh_shd.g_old_rec.user_name_emp_first_name,
167       p_user_name_emp_last_name_o   =>     ghr_pdh_shd.g_old_rec.user_name_emp_last_name,
168       p_user_name_emp_middle_names_o=>     ghr_pdh_shd.g_old_rec.user_name_emp_middle_names,
169       p_action_taken_o              =>     ghr_pdh_shd.g_old_rec.action_taken,
170       p_groupbox_id_o               =>     ghr_pdh_shd.g_old_rec.groupbox_id,
171       p_routing_list_id_o           =>     ghr_pdh_shd.g_old_rec.routing_list_id,
172       p_routing_seq_number_o        =>     ghr_pdh_shd.g_old_rec.routing_seq_number,
173       p_date_notification_sent_o    =>     ghr_pdh_shd.g_old_rec.date_notification_sent,
174       p_item_key_o            =>     ghr_pdh_shd.g_old_rec.item_key,
175       p_object_version_number_o     =>     ghr_pdh_shd.g_old_rec.object_version_number );
176 
177   exception
178         when hr_api.cannot_find_prog_unit then
179              hr_api.cannot_find_prog_unit_error
180 		 (	 p_module_name => 'GHR_PD_ROUTING_HISTORY'
181 			,p_hook_type   => 'AD'
182 	        );
183   end;
184   -- End of API User Hook for post_delete.
185   hr_utility.set_location(' Leaving:'||l_proc, 10);
186 End post_delete;
187 --
188 -- ----------------------------------------------------------------------------
189 -- |---------------------------------< del >----------------------------------|
190 -- ----------------------------------------------------------------------------
191 Procedure del
192   (
193   p_rec	      in ghr_pdh_shd.g_rec_type,
194   p_validate  in boolean default false
195   ) is
196 --
197   l_proc  varchar2(72) := g_package||'del';
198 --
199 Begin
200   hr_utility.set_location('Entering:'||l_proc, 5);
201   --
202   -- Determine if the business process is to be validated.
203   --
204   If p_validate then
205     --
206     -- Issue the savepoint.
207     --
208     SAVEPOINT del_ghr_pdh;
209   End If;
210   --
211   -- We must lock the row which we need to delete.
212   --
213   ghr_pdh_shd.lck
214 	(
215 	p_rec.pd_routing_history_id,
216 	p_rec.object_version_number
217 	);
218   --
219   -- Call the supporting delete validate operation
220   --
221   ghr_pdh_bus.delete_validate(p_rec);
222   --
223   -- Call the supporting pre-delete operation
224   --
225   pre_delete(p_rec);
226   --
227   -- Delete the row.
228   --
229   delete_dml(p_rec);
230   --
231   -- Call the supporting post-delete operation
232   --
233   post_delete(p_rec);
234   --
235   -- If we are validating then raise the Validate_Enabled exception
236   --
237   If p_validate then
238     Raise HR_Api.Validate_Enabled;
239   End If;
240   --
241   hr_utility.set_location(' Leaving:'||l_proc, 10);
242 Exception
243   When HR_Api.Validate_Enabled Then
244     --
245     -- As the Validate_Enabled exception has been raised
246     -- we must rollback to the savepoint
247     --
248     ROLLBACK TO del_ghr_pdh;
249 End del;
250 --
251 -- ----------------------------------------------------------------------------
252 -- |---------------------------------< del >----------------------------------|
253 -- ----------------------------------------------------------------------------
254 Procedure del
255   (
256   p_pd_routing_history_id              in number,
257   p_object_version_number              in number,
258   p_validate                           in boolean default false
259   ) is
260 --
261   l_rec	  ghr_pdh_shd.g_rec_type;
262   l_proc  varchar2(72) := g_package||'del';
263 --
264 Begin
265   hr_utility.set_location('Entering:'||l_proc, 5);
266   --
267   -- As the delete procedure accepts a plsql record structure we do need to
268   -- convert the  arguments into the record structure.
269   -- We don't need to call the supplied conversion argument routine as we
270   -- only need a few attributes.
271   --
272   l_rec.pd_routing_history_id:= p_pd_routing_history_id;
273   l_rec.object_version_number := p_object_version_number;
274   --
275   -- Having converted the arguments into the ghr_pdh_rec
276   -- plsql record structure we must call the corresponding entity
277   -- business process
278   --
279   del(l_rec, p_validate);
280   --
281   hr_utility.set_location(' Leaving:'||l_proc, 10);
282 End del;
283 --
284 end ghr_pdh_del;