DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_APR_DEL

Source


1 Package Body per_apr_del as
2 /* $Header: peaprrhi.pkb 120.29.12020000.2 2012/07/05 00:47:21 amnaraya ship $ */
3 
4 -- ---------------------------------------------------------------------------+
5 -- |                     Private Global Definitions                           |
6 -- ---------------------------------------------------------------------------+
7 
8 g_package  varchar2(33)	:= '  per_apr_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 per_apr_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 per_appraisals row.
54 
55   delete from per_appraisals
56   where appraisal_id = p_rec.appraisal_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     per_apr_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 per_apr_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 per_apr_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      per_apr_rkd.after_delete	(
155             p_appraisal_id                   => p_rec.appraisal_id                          ,
156             p_business_group_id_o            => per_apr_shd.g_old_rec.business_group_id     ,
157             p_appraisal_template_id_o        => per_apr_shd.g_old_rec.appraisal_template_id ,
158             p_appraisee_person_id_o          => per_apr_shd.g_old_rec.appraisee_person_id   ,
159             p_appraiser_person_id_o          => per_apr_shd.g_old_rec.appraiser_person_id   ,
160             p_appraisal_date_o               => per_apr_shd.g_old_rec.appraisal_date        ,
161             p_group_date_o                   => per_apr_shd.g_old_rec.group_date            ,
162             p_group_initiator_id_o           => per_apr_shd.g_old_rec.group_initiator_id    ,
163             p_appraisal_period_end_date_o    => per_apr_shd.g_old_rec.appraisal_period_end_date   ,
164             p_appraisal_period_start_dat_o   => per_apr_shd.g_old_rec.appraisal_period_start_date ,
165             p_type_o                         => per_apr_shd.g_old_rec.type                  ,
166             p_next_appraisal_date_o          => per_apr_shd.g_old_rec.next_appraisal_date   ,
167             p_status_o                       => per_apr_shd.g_old_rec.status                ,
168             p_comments_o                     => per_apr_shd.g_old_rec.comments              ,
169             p_overall_performance_level_o    => per_apr_shd.g_old_rec.overall_performance_level_id,
170             p_open_o                         => per_apr_shd.g_old_rec.open                  ,
171             p_attribute_category_o           => per_apr_shd.g_old_rec.attribute_category    ,
172             p_attribute1_o                   => per_apr_shd.g_old_rec.attribute1            ,
173             p_attribute2_o                   => per_apr_shd.g_old_rec.attribute2            ,
174             p_attribute3_o                   => per_apr_shd.g_old_rec.attribute3            ,
175             p_attribute4_o                   => per_apr_shd.g_old_rec.attribute4            ,
176             p_attribute5_o                   => per_apr_shd.g_old_rec.attribute5            ,
177             p_attribute6_o                   => per_apr_shd.g_old_rec.attribute6            ,
178             p_attribute7_o                   => per_apr_shd.g_old_rec.attribute7            ,
179             p_attribute8_o                   => per_apr_shd.g_old_rec.attribute8            ,
180             p_attribute9_o                   => per_apr_shd.g_old_rec.attribute9            ,
181             p_attribute10_o                  => per_apr_shd.g_old_rec.attribute10           ,
182             p_attribute11_o                  => per_apr_shd.g_old_rec.attribute11           ,
183             p_attribute12_o                  => per_apr_shd.g_old_rec.attribute12           ,
184             p_attribute13_o                  => per_apr_shd.g_old_rec.attribute13           ,
185             p_attribute14_o                  => per_apr_shd.g_old_rec.attribute14           ,
186             p_attribute15_o                  => per_apr_shd.g_old_rec.attribute15           ,
187             p_attribute16_o                  => per_apr_shd.g_old_rec.attribute16           ,
188             p_attribute17_o                  => per_apr_shd.g_old_rec.attribute17           ,
189             p_attribute18_o                  => per_apr_shd.g_old_rec.attribute18           ,
190             p_attribute19_o                  => per_apr_shd.g_old_rec.attribute19           ,
191             p_attribute20_o                  => per_apr_shd.g_old_rec.attribute20           ,
192             p_object_version_number_o        => per_apr_shd.g_old_rec.object_version_number ,
193             p_system_type_o                  => per_apr_shd.g_old_rec.system_type           ,
194             p_system_params_o                => per_apr_shd.g_old_rec.system_params         ,
195             p_appraisee_access_o             => per_apr_shd.g_old_rec.appraisee_access      ,
196             p_main_appraiser_id_o            => per_apr_shd.g_old_rec.main_appraiser_id     ,
197             p_assignment_id_o                => per_apr_shd.g_old_rec.assignment_id         ,
198             p_assignment_start_date_o        => per_apr_shd.g_old_rec.assignment_start_date ,
199             p_asg_business_group_id_o        => per_apr_shd.g_old_rec.assignment_business_group_id ,
200 	    p_assignment_organization_id_o   => per_apr_shd.g_old_rec.assignment_organization_id ,
201 	    p_assignment_job_id_o            => per_apr_shd.g_old_rec.assignment_job_id,
202 	    p_assignment_position_id_o       => per_apr_shd.g_old_rec.assignment_position_id,
203             p_assignment_grade_id_o          => per_apr_shd.g_old_rec.assignment_grade_id,
204             p_appraisal_system_status_o      => per_apr_shd.g_old_rec.appraisal_system_status,
205             p_potential_readiness_level_o    => per_apr_shd.g_old_rec.potential_readiness_level,
206 	    p_potnl_short_term_workopp_o => per_apr_shd.g_old_rec.potential_short_term_workopp,
207 	    p_potnl_long_term_workopp_o  => per_apr_shd.g_old_rec.potential_long_term_workopp,
208 	    p_potential_details_o            => per_apr_shd.g_old_rec.potential_details,
209   	    p_event_id_o    		         => per_apr_shd.g_old_rec.event_id,
210             p_show_competency_ratings_o      => per_apr_shd.g_old_rec.show_competency_ratings,
211             p_show_objective_ratings_o       => per_apr_shd.g_old_rec.show_objective_ratings,
212             p_show_questionnaire_info_o      => per_apr_shd.g_old_rec.show_questionnaire_info,
213             p_show_participant_details_o     => per_apr_shd.g_old_rec.show_participant_details,
214             p_show_participant_ratings_o     => per_apr_shd.g_old_rec.show_participant_ratings,
215             p_show_participant_names_o       => per_apr_shd.g_old_rec.show_participant_names,
216             p_show_overall_ratings_o         => per_apr_shd.g_old_rec.show_overall_ratings,
217             p_show_overall_comments_o        => per_apr_shd.g_old_rec.show_overall_comments,
218             p_update_appraisal_o             => per_apr_shd.g_old_rec.update_appraisal,
219             p_provide_overall_feedback_o     => per_apr_shd.g_old_rec.provide_overall_feedback,
220             p_appraisee_comments_o           => per_apr_shd.g_old_rec.appraisee_comments,
221   	    p_plan_id_o                      => per_apr_shd.g_old_rec.plan_id,
222         p_offline_status_o               => per_apr_shd.g_old_rec.offline_status,
223  p_retention_potential_o               => per_apr_shd.g_old_rec.retention_potential,
224             p_show_participant_comments_o     => per_apr_shd.g_old_rec.show_participant_comments   -- 8651478 bug fix
225             );
226      exception
227         when hr_api.cannot_find_prog_unit then
228              hr_api.cannot_find_prog_unit_error
229 		 (	p_module_name => 'PER_APPRAISALS'
230 		 	,p_hook_type  => 'AD'
231 	        );
232   end;
233   -- End of API User Hook for post_delete.
234 
235   hr_utility.set_location(' Leaving:'||l_proc, 10);
236 End post_delete;
237 
238 -- ---------------------------------------------------------------------------+
239 -- |---------------------------------< del >----------------------------------|
240 -- ---------------------------------------------------------------------------+
241 Procedure del
242   (
243   p_rec	      in per_apr_shd.g_rec_type,
244   p_validate  in boolean default false
245   ) is
246 
247   l_proc  varchar2(72) := g_package||'del';
248 
249 Begin
250   hr_utility.set_location('Entering:'||l_proc, 5);
251 
252   -- Determine if the business process is to be validated.
253 
254   If p_validate then
255 
256     -- Issue the savepoint.
257 
258     SAVEPOINT del_per_apr;
259   End If;
260 
261   -- We must lock the row which we need to delete.
262 
263   per_apr_shd.lck
264 	(
265 	p_rec.appraisal_id,
266 	p_rec.object_version_number
267 	);
268 
269   -- Call the supporting delete validate operation
270 
271   per_apr_bus.delete_validate(p_rec);
272   -- raise any errors
273   hr_multi_message.end_validation_set;
274 
275   -- Call the supporting pre-delete operation
276 
277   pre_delete(p_rec);
278 
279   -- Delete the row.
280 
281   delete_dml(p_rec);
282 
283   -- Call the supporting post-delete operation
284 
285   post_delete(p_rec);
286   -- raise any errors
287   hr_multi_message.end_validation_set;
288 
289   -- If we are validating then raise the Validate_Enabled exception
290 
291   If p_validate then
292     Raise HR_Api.Validate_Enabled;
293   End If;
294 
295   hr_utility.set_location(' Leaving:'||l_proc, 10);
296 Exception
297   When HR_Api.Validate_Enabled Then
298 
299     -- As the Validate_Enabled exception has been raised
300     -- we must rollback to the savepoint
301 
302     ROLLBACK TO del_per_apr;
303 End del;
304 
305 -- ---------------------------------------------------------------------------+
306 -- |---------------------------------< del >----------------------------------|
307 -- ---------------------------------------------------------------------------+
308 Procedure del
309   (
310   p_appraisal_id                       in number,
311   p_object_version_number              in number,
312   p_validate                           in boolean default false
313   ) is
314 
315   l_rec	  per_apr_shd.g_rec_type;
316   l_proc  varchar2(72) := g_package||'del';
317 
318 Begin
319   hr_utility.set_location('Entering:'||l_proc, 5);
320 
321   -- As the delete procedure accepts a plsql record structure we do need to
322   -- convert the  arguments into the record structure.
323   -- We don't need to call the supplied conversion argument routine as we
324   -- only need a few attributes.
325 
326   l_rec.appraisal_id:= p_appraisal_id;
327   l_rec.object_version_number := p_object_version_number;
328 
329   -- Having converted the arguments into the per_apr_rec
330   -- plsql record structure we must call the corresponding entity
331   -- business process
332 
333   del(l_rec, p_validate);
334 
335   hr_utility.set_location(' Leaving:'||l_proc, 10);
336 End del;
337 
338 end per_apr_del;