DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_APT_DEL

Source


1 Package Body per_apt_del as
2 /* $Header: peaptrhi.pkb 120.10.12020000.1 2012/06/29 00:43:57 appldev ship $ */
3 
4 -- ---------------------------------------------------------------------------+
5 -- |                     Private Global Definitions                           |
6 -- ---------------------------------------------------------------------------+
7 
8 g_package  varchar2(33)	:= '  per_apt_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:
27 -- In Parameters:
24 --   This is an internal private procedure which must be called from the del
25 --   procedure.
26 
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_apt_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   -- Delete the per_appraisal_templates row.
53 
54   delete from per_appraisal_templates
55   where appraisal_template_id = p_rec.appraisal_template_id;
56 
57   hr_utility.set_location(' Leaving:'||l_proc, 10);
58 
59 Exception
60   When hr_api.child_integrity_violated then
61     -- Child integrity has been violated
62     per_apt_shd.constraint_error
63       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
64   When Others Then
65     Raise;
66 End delete_dml;
67 
68 -- ---------------------------------------------------------------------------+
69 -- |------------------------------< pre_delete >------------------------------|
70 -- ---------------------------------------------------------------------------+
71 -- {Start Of Comments}
72 
73 -- Description:
74 --   This private procedure contains any processing which is required before
75 --   the delete dml.
76 
77 -- Pre Conditions:
78 --   This is an internal procedure which is called from the del procedure.
79 
80 -- In Parameters:
81 --   A Pl/Sql record structre.
82 
83 -- Post Success:
84 --   Processing continues.
85 
86 -- Post Failure:
87 --   If an error has occurred, an error message and exception will be raised
88 --   but not handled.
89 
90 -- Developer Implementation Notes:
91 --   Any pre-processing required before the delete dml is issued should be
92 --   coded within this procedure. It is important to note that any 3rd party
93 --   maintenance should be reviewed before placing in this procedure.
94 
95 -- Access Status:
96 --   Internal Table Handler Use Only.
97 
98 -- {End Of Comments}
99 -- ---------------------------------------------------------------------------+
100 Procedure pre_delete(p_rec in per_apt_shd.g_rec_type) is
101 
102   l_proc  varchar2(72) := g_package||'pre_delete';
103 
104 Begin
105   hr_utility.set_location('Entering:'||l_proc, 5);
106 
107   hr_utility.set_location(' Leaving:'||l_proc, 10);
108 End pre_delete;
109 
110 -- ---------------------------------------------------------------------------+
111 -- |-----------------------------< post_delete >------------------------------|
112 -- ---------------------------------------------------------------------------+
113 -- {Start Of Comments}
114 
115 -- Description:
116 --   This private procedure contains any processing which is required after the
117 --   delete dml.
118 
119 -- Pre Conditions:
120 --   This is an internal procedure which is called from the del procedure.
121 
122 -- In Parameters:
123 --   A Pl/Sql record structre.
124 
125 -- Post Success:
126 --   Processing continues.
127 
128 -- Post Failure:
129 --   If an error has occurred, an error message and exception will be raised
130 --   but not handled.
131 
132 -- Developer Implementation Notes:
133 --   Any post-processing required after the delete dml is issued should be
134 --   coded within this procedure. It is important to note that any 3rd party
135 --   maintenance should be reviewed before placing in this procedure.
136 
137 -- Access Status:
138 --   Internal table Handler Use Only.
139 
140 -- {End Of Comments}
141 -- ---------------------------------------------------------------------------+
142 Procedure post_delete(p_rec in per_apt_shd.g_rec_type) is
143 
144   l_proc  varchar2(72) := g_package||'post_delete';
145 
146 Begin
147   hr_utility.set_location('Entering:'||l_proc, 5);
148 
149   -- This is a hook point and the user hook for post_delete is called here.
150 
151   begin
152      per_apt_rkd.after_delete	(
153        p_appraisal_template_id       => p_rec.appraisal_template_id                 ,
154        p_business_group_id_o         => per_apt_shd.g_old_rec.business_group_id     ,
155        p_object_version_number_o     => per_apt_shd.g_old_rec.object_version_number ,
156        p_name_o                      => per_apt_shd.g_old_rec.name                  ,
157        p_description_o               => per_apt_shd.g_old_rec.description           ,
158        p_instructions_o              => per_apt_shd.g_old_rec.instructions          ,
159        p_date_from_o                 => per_apt_shd.g_old_rec.date_from             ,
160        p_date_to_o                   => per_apt_shd.g_old_rec.date_to               ,
161        p_assessment_type_id_o        => per_apt_shd.g_old_rec.assessment_type_id        ,
162        p_rating_scale_id_o           => per_apt_shd.g_old_rec.rating_scale_id           ,
163        p_questionnaire_template_id_o => per_apt_shd.g_old_rec.questionnaire_template_id ,
164        p_attribute_category_o        => per_apt_shd.g_old_rec.attribute_category        ,
165        p_attribute1_o                => per_apt_shd.g_old_rec.attribute1   ,
169        p_attribute5_o                => per_apt_shd.g_old_rec.attribute5   ,
166        p_attribute2_o                => per_apt_shd.g_old_rec.attribute2   ,
167        p_attribute3_o                => per_apt_shd.g_old_rec.attribute3   ,
168        p_attribute4_o                => per_apt_shd.g_old_rec.attribute4   ,
170        p_attribute6_o                => per_apt_shd.g_old_rec.attribute6   ,
171        p_attribute7_o                => per_apt_shd.g_old_rec.attribute7   ,
172        p_attribute8_o                => per_apt_shd.g_old_rec.attribute8   ,
173        p_attribute9_o                => per_apt_shd.g_old_rec.attribute9   ,
174        p_attribute10_o               => per_apt_shd.g_old_rec.attribute10   ,
175        p_attribute11_o               => per_apt_shd.g_old_rec.attribute11   ,
176        p_attribute12_o               => per_apt_shd.g_old_rec.attribute12   ,
177        p_attribute13_o               => per_apt_shd.g_old_rec.attribute13   ,
178        p_attribute14_o               => per_apt_shd.g_old_rec.attribute14   ,
179        p_attribute15_o               => per_apt_shd.g_old_rec.attribute15   ,
180        p_attribute16_o               => per_apt_shd.g_old_rec.attribute16   ,
181        p_attribute17_o               => per_apt_shd.g_old_rec.attribute17   ,
182        p_attribute18_o               => per_apt_shd.g_old_rec.attribute18   ,
183        p_attribute19_o               => per_apt_shd.g_old_rec.attribute19   ,
184        p_attribute20_o               => per_apt_shd.g_old_rec.attribute20   ,
185        p_objective_asmnt_type_id_o      => per_apt_shd.g_old_rec.objective_asmnt_type_id,
186        p_ma_quest_template_id_o      => per_apt_shd.g_old_rec.ma_quest_template_id,
187        p_link_appr_to_learning_path_o      => per_apt_shd.g_old_rec.link_appr_to_learning_path,
188        p_final_score_formula_id_o      => per_apt_shd.g_old_rec.final_score_formula_id,
189        p_update_personal_comp_profi_o      => per_apt_shd.g_old_rec.update_personal_comp_profile,
190        p_comp_profile_source_type_o      => per_apt_shd.g_old_rec.comp_profile_source_type,
191        p_show_competency_ratings_o      => per_apt_shd.g_old_rec.show_competency_ratings,
192        p_show_objective_ratings_o      => per_apt_shd.g_old_rec.show_objective_ratings,
193        p_show_overall_ratings_o      => per_apt_shd.g_old_rec.show_overall_ratings,
194        p_show_overall_comments_o      => per_apt_shd.g_old_rec.show_overall_comments,
195        p_provide_overall_feedback_o      => per_apt_shd.g_old_rec.provide_overall_feedback,
196        p_show_participant_details_o      => per_apt_shd.g_old_rec.show_participant_details,
197        p_allow_add_participant_o      => per_apt_shd.g_old_rec.allow_add_participant,
198        p_show_additional_details_o      => per_apt_shd.g_old_rec.show_additional_details,
199        p_show_participant_names_o      => per_apt_shd.g_old_rec.show_participant_names,
200        p_show_participant_ratings_o      => per_apt_shd.g_old_rec.show_participant_ratings,
201        p_available_flag_o      => per_apt_shd.g_old_rec.available_flag,
202        p_show_questionnaire_info_o      => per_apt_shd.g_old_rec.show_questionnaire_info,
203        p_show_participant_comments_o      => per_apt_shd.g_old_rec.show_participant_comments  -- 8651478 bug fix
204 
205     ,p_show_term_employee_o           => per_apt_shd.g_old_rec.show_term_employee  -- 6181267 bug fix
206     ,p_show_term_contigent_o          => per_apt_shd.g_old_rec.show_term_contigent   -- 6181267 bug fix
207     ,p_disp_term_emp_period_from_o    => per_apt_shd.g_old_rec.disp_term_emp_period_from   -- 6181267 bug fix
208     ,p_show_future_term_employee_o         => per_apt_shd.g_old_rec.show_future_term_employee -- 6181267 bug fix
209 
210        );
211      exception
212         when hr_api.cannot_find_prog_unit then
213              hr_api.cannot_find_prog_unit_error
214 		 (	p_module_name => 'PER_APPRAISAL_TEMPLATES'
215 		 	,p_hook_type  => 'AD'
216 	        );
217   end;
218   -- End of API User Hook for post_delete.
219 
220   hr_utility.set_location(' Leaving:'||l_proc, 10);
221 End post_delete;
222 
223 -- ---------------------------------------------------------------------------+
224 -- |---------------------------------< del >----------------------------------|
225 -- ---------------------------------------------------------------------------+
226 Procedure del
227   (
228   p_rec	      in per_apt_shd.g_rec_type,
229   p_validate  in boolean default false
230   ) is
231 
232   l_proc  varchar2(72) := g_package||'del';
233 
234 Begin
235   hr_utility.set_location('Entering:'||l_proc, 5);
236 
237   -- Determine if the business process is to be validated.
238 
239   If p_validate then
240 
241     -- Issue the savepoint.
242 
243     SAVEPOINT del_per_apt;
244   End If;
245 
246   -- We must lock the row which we need to delete.
247 
248   per_apt_shd.lck
249 	(
250 	p_rec.appraisal_template_id,
251 	p_rec.object_version_number
252 	);
253 
254   -- Call the supporting delete validate operation
255 
256   per_apt_bus.delete_validate(p_rec);
257 
258   -- Call the supporting pre-delete operation
259 
260   pre_delete(p_rec);
261 
262   -- Delete the row.
263 
264   delete_dml(p_rec);
265 
266   -- Call the supporting post-delete operation
267 
268   post_delete(p_rec);
269 
270   -- If we are validating then raise the Validate_Enabled exception
271 
272   If p_validate then
273     Raise HR_Api.Validate_Enabled;
274   End If;
275 
276   hr_utility.set_location(' Leaving:'||l_proc, 10);
277 Exception
278   When HR_Api.Validate_Enabled Then
279 
280     -- As the Validate_Enabled exception has been raised
281     -- we must rollback to the savepoint
282 
283     ROLLBACK TO del_per_apt;
284 End del;
285 
286 -- ---------------------------------------------------------------------------+
287 -- |---------------------------------< del >----------------------------------|
288 -- ---------------------------------------------------------------------------+
289 Procedure del
290   (
291   p_appraisal_template_id              in number,
292   p_object_version_number              in number,
293   p_validate                           in boolean default false
294   ) is
295 
296   l_rec	  per_apt_shd.g_rec_type;
297   l_proc  varchar2(72) := g_package||'del';
298 
299 Begin
300   hr_utility.set_location('Entering:'||l_proc, 5);
301 
302   -- As the delete procedure accepts a plsql record structure we do need to
303   -- convert the  arguments into the record structure.
304   -- We don't need to call the supplied conversion argument routine as we
305   -- only need a few attributes.
306 
307   l_rec.appraisal_template_id:= p_appraisal_template_id;
308   l_rec.object_version_number := p_object_version_number;
309 
310   -- Having converted the arguments into the per_apt_rec
311   -- plsql record structure we must call the corresponding entity
312   -- business process
313 
314   del(l_rec, p_validate);
315 
316   hr_utility.set_location(' Leaving:'||l_proc, 10);
317 End del;
318 
319 end per_apt_del;