DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SUC_DEL

Source


1 PACKAGE BODY per_suc_del
2 AS
6 -- |                     Private Global Definitions                           |
3 /* $Header: pesucrhi.pkb 120.1.12010000.9 2010/02/22 20:28:53 schowdhu ship $ */
4 --
5 -- ----------------------------------------------------------------------------
7 -- ----------------------------------------------------------------------------
8 --
9    g_package   VARCHAR2 (33) := '  per_suc_del.';                            -- Global package name
10 
11 --
12 -- ----------------------------------------------------------------------------
13 -- |------------------------------< delete_dml >------------------------------|
14 -- ----------------------------------------------------------------------------
15 -- {Start Of Comments}
16 --
17 -- Description:
18 --   This procedure controls the actual dml delete logic. The functions of
19 --   this procedure are as follows:
20 --   1) To set and unset the g_api_dml status as required (as we are about to
21 --      perform dml).
22 --   2) To delete the specified row from the schema using the primary key in
23 --      the predicates.
24 --   3) To trap any constraint violations that may have occurred.
25 --   4) To raise any other errors.
26 --
27 -- Prerequisites:
28 --   This is an internal private procedure which must be called from the del
29 --   procedure.
30 --
31 -- In Parameters:
32 --   A Pl/Sql record structre.
33 --
34 -- Post Success:
35 --   The specified row will be delete from the schema.
36 --
37 -- Post Failure:
38 --   On the delete dml failure it is important to note that we always reset the
39 --   g_api_dml status to false.
40 --   If a child integrity constraint violation is raised the
41 --   constraint_error procedure will be called.
42 --   If any other error is reported, the error will be raised after the
43 --   g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 --   None.
47 --
48 -- Access Status:
49 --   Internal Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53    PROCEDURE delete_dml (p_rec IN per_suc_shd.g_rec_type)
54    IS
55 --
56       l_proc   VARCHAR2 (72) := g_package || 'delete_dml';
57 --
58    BEGIN
59       hr_utility.set_location ('Entering:' || l_proc, 5);
60       --
61       per_suc_shd.g_api_dml      := TRUE;                                 -- Set the api dml status
62 
63       --
64       -- Delete the per_succession_planning row.
65       --
66       DELETE FROM per_succession_planning
67             WHERE succession_plan_id = p_rec.succession_plan_id;
68 
69       --
70       per_suc_shd.g_api_dml      := FALSE;                              -- Unset the api dml status
71       --
72       hr_utility.set_location (' Leaving:' || l_proc, 10);
73 --
74    EXCEPTION
75       WHEN hr_api.child_integrity_violated
76       THEN
77          -- Child integrity has been violated
78          per_suc_shd.g_api_dml      := FALSE;                           -- Unset the api dml status
79          per_suc_shd.constraint_error (p_constraint_name      => hr_api.strip_constraint_name
80                                                                                            (SQLERRM));
81       WHEN OTHERS
82       THEN
83          per_suc_shd.g_api_dml      := FALSE;                           -- Unset the api dml status
84          RAISE;
85    END delete_dml;
86 
87 --
88 -- ----------------------------------------------------------------------------
89 -- |------------------------------< pre_delete >------------------------------|
90 -- ----------------------------------------------------------------------------
91 -- {Start Of Comments}
92 --
93 -- Description:
94 --   This private procedure contains any processing which is required before
95 --   the delete dml.
96 --
97 -- Prerequisites:
98 --   This is an internal procedure which is called from the del procedure.
99 --
100 -- In Parameters:
101 --   A Pl/Sql record structre.
102 --
103 -- Post Success:
104 --   Processing continues.
105 --
106 -- Post Failure:
107 --   If an error has occurred, an error message and exception will be raised
108 --   but not handled.
109 --
110 -- Developer Implementation Notes:
111 --   Any pre-processing required before the delete dml is issued should be
112 --   coded within this procedure. It is important to note that any 3rd party
113 --   maintenance should be reviewed before placing in this procedure.
114 --
115 -- Access Status:
116 --   Internal Row Handler Use Only.
117 --
118 -- {End Of Comments}
119 -- ----------------------------------------------------------------------------
120    PROCEDURE pre_delete (p_rec IN per_suc_shd.g_rec_type)
121    IS
122 --
123       l_proc   VARCHAR2 (72) := g_package || 'pre_delete';
124 --
125    BEGIN
126       hr_utility.set_location ('Entering:' || l_proc, 5);
127       --
128       hr_utility.set_location (' Leaving:' || l_proc, 10);
129    END pre_delete;
130 
131 --
132 -- ----------------------------------------------------------------------------
133 -- |-----------------------------< post_delete >------------------------------|
134 -- ----------------------------------------------------------------------------
135 -- {Start Of Comments}
136 --
137 -- Description:
138 --   This private procedure contains any processing which is required after the
139 --   delete dml.
140 --
141 -- Prerequisites:
142 --   This is an internal procedure which is called from the del procedure.
143 --
144 -- In Parameters:
145 --   A Pl/Sql record structre.
146 --
147 -- Post Success:
148 --   Processing continues.
149 --
150 -- Post Failure:
151 --   If an error has occurred, an error message and exception will be raised
152 --   but not handled.
153 --
154 -- Developer Implementation Notes:
155 --   Any post-processing required after the delete dml is issued should be
156 --   coded within this procedure. It is important to note that any 3rd party
157 --   maintenance should be reviewed before placing in this procedure.
158 --
159 -- Access Status:
160 --   Internal table Handler Use Only.
161 --
162 -- {End Of Comments}
163 -- ----------------------------------------------------------------------------
164    PROCEDURE post_delete (p_rec IN per_suc_shd.g_rec_type)
165    IS
166 --
167       l_proc   VARCHAR2 (72) := g_package || 'post_delete';
168 --
169    BEGIN
170       hr_utility.set_location ('Entering:' || l_proc, 5);
171 
172       --
173       -- Start of Row Handler User Hook for post_delete.
174       --
175       BEGIN
176          per_suc_rkd.after_delete
177                      (p_succession_plan_id             => p_rec.succession_plan_id,
178                       p_person_id_o                    => per_suc_shd.g_old_rec.person_id,
179                       p_position_id_o                  => per_suc_shd.g_old_rec.position_id,
180                       p_business_group_id_o            => per_suc_shd.g_old_rec.business_group_id,
181                       p_start_date_o                   => per_suc_shd.g_old_rec.start_date,
182                       p_time_scale_o                   => per_suc_shd.g_old_rec.time_scale,
183                       p_end_date_o                     => per_suc_shd.g_old_rec.end_date,
184                       p_available_for_promotion_o      => per_suc_shd.g_old_rec.available_for_promotion,
185                       p_manager_comments_o             => per_suc_shd.g_old_rec.manager_comments,
186                       p_object_version_number_o        => per_suc_shd.g_old_rec.object_version_number,
187                       p_attribute_category_o           => per_suc_shd.g_old_rec.attribute_category,
188                       p_attribute1_o                   => per_suc_shd.g_old_rec.attribute1,
189                       p_attribute2_o                   => per_suc_shd.g_old_rec.attribute2,
190                       p_attribute3_o                   => per_suc_shd.g_old_rec.attribute3,
191                       p_attribute4_o                   => per_suc_shd.g_old_rec.attribute4,
192                       p_attribute5_o                   => per_suc_shd.g_old_rec.attribute5,
193                       p_attribute6_o                   => per_suc_shd.g_old_rec.attribute6,
194                       p_attribute7_o                   => per_suc_shd.g_old_rec.attribute7,
195                       p_attribute8_o                   => per_suc_shd.g_old_rec.attribute8,
196                       p_attribute9_o                   => per_suc_shd.g_old_rec.attribute9,
197                       p_attribute10_o                  => per_suc_shd.g_old_rec.attribute10,
198                       p_attribute11_o                  => per_suc_shd.g_old_rec.attribute11,
199                       p_attribute12_o                  => per_suc_shd.g_old_rec.attribute12,
200                       p_attribute13_o                  => per_suc_shd.g_old_rec.attribute13,
201                       p_attribute14_o                  => per_suc_shd.g_old_rec.attribute14,
202                       p_attribute15_o                  => per_suc_shd.g_old_rec.attribute15,
203                       p_attribute16_o                  => per_suc_shd.g_old_rec.attribute16,
204                       p_attribute17_o                  => per_suc_shd.g_old_rec.attribute17,
205                       p_attribute18_o                  => per_suc_shd.g_old_rec.attribute18,
206                       p_attribute19_o                  => per_suc_shd.g_old_rec.attribute19,
207                       p_attribute20_o                  => per_suc_shd.g_old_rec.attribute20,
208                       p_job_id_o                       => per_suc_shd.g_old_rec.job_id,
209                       p_successee_person_id_o          => per_suc_shd.g_old_rec.successee_person_id,
210                       p_person_rank_o                  => per_suc_shd.g_old_rec.person_rank,
211                       p_performance_o                  => per_suc_shd.g_old_rec.PERFORMANCE,
212                       p_plan_status_o                  => per_suc_shd.g_old_rec.plan_status,
213                       p_readiness_percentage_o         => per_suc_shd.g_old_rec.readiness_percentage
214                      );
215       EXCEPTION
216          WHEN hr_api.cannot_find_prog_unit
217          THEN
218             hr_api.cannot_find_prog_unit_error (p_module_name      => 'PER_SUCCESSION_PLANNING',
219                                                 p_hook_type        => 'AD'
220                                                );
221       END;
222 
223       --
224       -- End of Row Handler User Hook for post_delete.
225       --
226       hr_utility.set_location (' Leaving:' || l_proc, 10);
227    END post_delete;
228 
229 --
230 -- ----------------------------------------------------------------------------
231 -- |---------------------------------< del >----------------------------------|
232 -- ----------------------------------------------------------------------------
233    PROCEDURE del (p_rec IN per_suc_shd.g_rec_type)
234    IS
235 --
236       l_proc   VARCHAR2 (72) := g_package || 'del';
237 --
238    BEGIN
239       hr_utility.set_location ('Entering:' || l_proc, 5);
240       --
241       -- We must lock the row which we need to delete.
242       --
243       per_suc_shd.lck (p_rec.succession_plan_id, p_rec.object_version_number);
244       --
245       -- Call the supporting delete validate operation
246       --
247       per_suc_bus.delete_validate (p_rec);
248       --
249       -- Call the supporting pre-delete operation
250       --
251       pre_delete (p_rec);
252       --
253       -- Delete the row.
254       --
255       delete_dml (p_rec);
256       --
257       -- Call the supporting post-delete operation
258       --
259       post_delete (p_rec);
260    END del;
261 
262 --
263 -- ----------------------------------------------------------------------------
264 -- |---------------------------------< del >----------------------------------|
265 -- ----------------------------------------------------------------------------
266    PROCEDURE del (p_succession_plan_id IN NUMBER, p_object_version_number IN NUMBER)
267    IS
268 --
269       l_rec    per_suc_shd.g_rec_type;
270       l_proc   VARCHAR2 (72)          := g_package || 'del';
271 --
272    BEGIN
273       hr_utility.set_location ('Entering:' || l_proc, 5);
274       --
275       -- As the delete procedure accepts a plsql record structure we do need to
276       -- convert the  arguments into the record structure.
277       -- We don't need to call the supplied conversion argument routine as we
278       -- only need a few attributes.
279       --
280       l_rec.succession_plan_id   := p_succession_plan_id;
281       l_rec.object_version_number := p_object_version_number;
282       --
283       -- Having converted the arguments into the per_suc_rec
284       -- plsql record structure we must call the corresponding entity
285       -- business process
286       --
287       del (l_rec);
288       --
289       hr_utility.set_location (' Leaving:' || l_proc, 10);
290    END del;
291 --
292 END per_suc_del;