DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PRT_DEL

Source


6 -- ---------------------------------------------------------------------------+
1 Package Body per_prt_del as
2 /* $Header: peprtrhi.pkb 120.2 2006/05/03 18:37:44 kandra noship $ */
3 
4 -- ---------------------------------------------------------------------------+
5 -- |                     Private Global Definitions                           |
7 
8 g_package  varchar2(33)	:= '  per_prt_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 set and unset the g_api_dml status as required (as we are about to
19 --      perform dml).
20 --   2) To delete the specified row from the schema using the primary key in
21 --      the predicates.
22 --   3) To trap any constraint violations that may have occurred.
23 --   4) To raise any other errors.
24 
25 -- Pre Conditions:
26 --   This is an internal private procedure which must be called from the del
27 --   procedure.
28 
29 -- In Parameters:
30 --   A Pl/Sql record structre.
31 
32 -- Post Success:
33 --   The specified row will be delete from the schema.
34 
35 -- Post Failure:
36 --   On the delete dml failure it is important to note that we always reset the
37 --   g_api_dml status to false.
38 --   If a child integrity constraint violation is raised the
39 --   constraint_error procedure will be called.
40 --   If any other error is reported, the error will be raised after the
41 --   g_api_dml status is reset.
42 
43 -- Developer Implementation Notes:
44 --   None.
45 
46 -- Access Status:
47 --   Internal Table Handler Use Only.
48 
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------+
51 Procedure delete_dml(p_rec in per_prt_shd.g_rec_type) is
52 
53   l_proc  varchar2(72) := g_package||'delete_dml';
54 
55 Begin
56   hr_utility.set_location('Entering:'||l_proc, 5);
57 
58   -- Delete the per_performance_ratings row.
59 
60   delete from per_performance_ratings
61   where performance_rating_id = p_rec.performance_rating_id;
62 
63   hr_utility.set_location(' Leaving:'||l_proc, 10);
64 
65 Exception
66   When hr_api.child_integrity_violated then
67     -- Child integrity has been violated
68     per_prt_shd.constraint_error
69       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
70   When Others Then
71     Raise;
72 End delete_dml;
73 
74 -- ---------------------------------------------------------------------------+
75 -- |------------------------------< pre_delete >------------------------------|
76 -- ---------------------------------------------------------------------------+
77 -- {Start Of Comments}
78 
79 -- Description:
80 --   This private procedure contains any processing which is required before
81 --   the delete dml.
82 
83 -- Pre Conditions:
84 --   This is an internal procedure which is called from the del procedure.
85 
86 -- In Parameters:
87 --   A Pl/Sql record structre.
88 
89 -- Post Success:
90 --   Processing continues.
91 
92 -- Post Failure:
93 --   If an error has occurred, an error message and exception will be raised
94 --   but not handled.
95 
96 -- Developer Implementation Notes:
97 --   Any pre-processing required before the delete dml is issued should be
98 --   coded within this procedure. It is important to note that any 3rd party
99 --   maintenance should be reviewed before placing in this procedure.
100 
101 -- Access Status:
102 --   Internal Table Handler Use Only.
103 
104 -- {End Of Comments}
105 -- ---------------------------------------------------------------------------+
106 Procedure pre_delete(p_rec in per_prt_shd.g_rec_type) is
107 
108   l_proc  varchar2(72) := g_package||'pre_delete';
109 
110 Begin
111   hr_utility.set_location('Entering:'||l_proc, 5);
112 
113   hr_utility.set_location(' Leaving:'||l_proc, 10);
114 End pre_delete;
115 
116 -- ---------------------------------------------------------------------------+
117 -- |-----------------------------< post_delete >------------------------------|
118 -- ---------------------------------------------------------------------------+
119 -- {Start Of Comments}
120 
121 -- Description:
122 --   This private procedure contains any processing which is required after the
123 --   delete dml.
124 
125 -- Pre Conditions:
126 --   This is an internal procedure which is called from the del procedure.
127 
128 -- In Parameters:
129 --   A Pl/Sql record structre.
130 
131 -- Post Success:
132 --   Processing continues.
133 
134 -- Post Failure:
135 --   If an error has occurred, an error message and exception will be raised
136 --   but not handled.
137 
138 -- Developer Implementation Notes:
139 --   Any post-processing required after the delete dml is issued should be
140 --   coded within this procedure. It is important to note that any 3rd party
141 --   maintenance should be reviewed before placing in this procedure.
142 
143 -- Access Status:
147 -- ----------------------------------------------------------------------------
144 --   Internal table Handler Use Only.
145 
146 -- {End Of Comments}
148 Procedure post_delete(p_rec in per_prt_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   -- This is a hook point and the user hook for post_delete is called here.
156 
157   begin
158      per_prt_rkd.after_delete	(
159       p_performance_rating_id   => p_rec.performance_rating_id                ,
160       p_person_id_o             => p_rec.person_id,
161       p_objective_id_o          => per_prt_shd.g_old_rec.objective_id         ,
162       p_object_version_number_o => per_prt_shd.g_old_rec.object_version_number,
163       p_appraisal_id_o          => per_prt_shd.g_old_rec.appraisal_id         ,
164       p_performance_level_id_o  => per_prt_shd.g_old_rec.performance_level_id ,
165       p_comments_o              => per_prt_shd.g_old_rec.comments             ,
166       p_attribute_category_o    => per_prt_shd.g_old_rec.attribute_category   ,
167       p_attribute1_o            => per_prt_shd.g_old_rec.attribute1   ,
171       p_attribute5_o            => per_prt_shd.g_old_rec.attribute5   ,
168       p_attribute2_o            => per_prt_shd.g_old_rec.attribute2   ,
169       p_attribute3_o            => per_prt_shd.g_old_rec.attribute3   ,
170       p_attribute4_o            => per_prt_shd.g_old_rec.attribute4   ,
172       p_attribute6_o            => per_prt_shd.g_old_rec.attribute6   ,
173       p_attribute7_o            => per_prt_shd.g_old_rec.attribute7   ,
174       p_attribute8_o            => per_prt_shd.g_old_rec.attribute8   ,
175       p_attribute9_o            => per_prt_shd.g_old_rec.attribute9   ,
176       p_attribute10_o           => per_prt_shd.g_old_rec.attribute10  ,
177       p_attribute11_o           => per_prt_shd.g_old_rec.attribute11  ,
178       p_attribute12_o           => per_prt_shd.g_old_rec.attribute12  ,
179       p_attribute13_o           => per_prt_shd.g_old_rec.attribute13  ,
180       p_attribute14_o           => per_prt_shd.g_old_rec.attribute14  ,
181       p_attribute15_o           => per_prt_shd.g_old_rec.attribute15  ,
182       p_attribute16_o           => per_prt_shd.g_old_rec.attribute16  ,
183       p_attribute17_o           => per_prt_shd.g_old_rec.attribute17  ,
184       p_attribute18_o           => per_prt_shd.g_old_rec.attribute18  ,
185       p_attribute19_o           => per_prt_shd.g_old_rec.attribute19  ,
186       p_attribute20_o           => per_prt_shd.g_old_rec.attribute20  ,
187       p_appr_line_score_o       => per_prt_shd.g_old_rec.appr_line_score);
188      exception
189         when hr_api.cannot_find_prog_unit then
190              hr_api.cannot_find_prog_unit_error
191 		 (	p_module_name => 'PER_PERFORMANCE_RATINGS'
192 		 	,p_hook_type  => 'AD'
193 	        );
194   end;
195   -- End of API User Hook for post_delete.
199 
196 
197   hr_utility.set_location(' Leaving:'||l_proc, 10);
198 End post_delete;
200 -- ---------------------------------------------------------------------------+
201 -- |---------------------------------< del >----------------------------------|
202 -- ---------------------------------------------------------------------------+
203 Procedure del
204   (
205   p_rec	      in per_prt_shd.g_rec_type,
206   p_validate  in boolean default false
207   ) is
208 
209   l_proc  varchar2(72) := g_package||'del';
210 
211 Begin
212   hr_utility.set_location('Entering:'||l_proc, 5);
213 
214   -- Determine if the business process is to be validated.
215 
216   If p_validate then
217 
218     -- Issue the savepoint.
219 
220     SAVEPOINT del_per_prt;
221   End If;
222 
223   -- We must lock the row which we need to delete.
224 
225   per_prt_shd.lck
226 	(
227 	p_rec.performance_rating_id,
228 	p_rec.object_version_number
229 	);
230 
231   -- Call the supporting delete validate operation
232 
233   per_prt_bus.delete_validate(p_rec);
234 
235   --
236         hr_multi_message.end_validation_set;
237   --
238 
239   -- Call the supporting pre-delete operation
240 
241   pre_delete(p_rec);
242 
243   -- Delete the row.
244 
245   delete_dml(p_rec);
246 
247   -- Call the supporting post-delete operation
248 
249   post_delete(p_rec);
250 
251   --
252         hr_multi_message.end_validation_set;
253   --
254 
255   -- If we are validating then raise the Validate_Enabled exception
256 
257   If p_validate then
258     Raise HR_Api.Validate_Enabled;
259   End If;
260 
261   hr_utility.set_location(' Leaving:'||l_proc, 10);
262 Exception
263   When HR_Api.Validate_Enabled Then
264 
265     -- As the Validate_Enabled exception has been raised
266     -- we must rollback to the savepoint
267 
268     ROLLBACK TO del_per_prt;
269 End del;
270 
271 -- ---------------------------------------------------------------------------+
272 -- |---------------------------------< del >----------------------------------|
273 -- ---------------------------------------------------------------------------+
274 Procedure del
275   (
276   p_performance_rating_id              in number,
277   p_object_version_number              in number,
278   p_validate                           in boolean default false
279   ) is
280 
281   l_rec	  per_prt_shd.g_rec_type;
282   l_proc  varchar2(72) := g_package||'del';
283 
284 Begin
285   hr_utility.set_location('Entering:'||l_proc, 5);
286 
287   -- As the delete procedure accepts a plsql record structure we do need to
288   -- convert the  arguments into the record structure.
289   -- We don't need to call the supplied conversion argument routine as we
290   -- only need a few attributes.
291 
292   l_rec.performance_rating_id:= p_performance_rating_id;
293   l_rec.object_version_number := p_object_version_number;
294 
295   -- Having converted the arguments into the per_prt_rec
296   -- plsql record structure we must call the corresponding entity
297   -- business process
298 
299   del(l_rec, p_validate);
300 
301   hr_utility.set_location(' Leaving:'||l_proc, 10);
302 End del;
303 
304 end per_prt_del;