DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TCN_DEL

Source


1 Package Body hr_tcn_del as
2 /* $Header: hrtcnrhi.pkb 120.1 2011/04/28 12:06:24 sidsaxen ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hr_tcn_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 -- Prerequisites:
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 Row Handler Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml
52   (p_rec in hr_tcn_shd.g_rec_type
53   ) is
54 --
55   l_proc  varchar2(72) := g_package||'delete_dml';
56 --
57 Begin
58   hr_utility.set_location('Entering:'||l_proc, 5);
59   --
60   --
61   -- Added the following code as a part of Zero Downtime Patching Project.
62   -- Code Starts Here.
63   --
64   PER_RIC_PKG.chk_integrity (
65     p_entity_name=>'HR_TEMPLATE_CANVASES_B',
66       p_ref_entity_info=>PER_RIC_PKG.ref_entity_tbl(
67         PER_RIC_PKG.ref_info_rec('HR_CANVAS_PROPERTIES',PER_RIC_PKG.column_info_tbl(
68           PER_RIC_PKG.col_info_rec('TEMPLATE_CANVAS_ID',NULL,p_rec.template_canvas_id,NULL))),
69         PER_RIC_PKG.ref_info_rec('HR_TEMPLATE_TAB_PAGES_B', PER_RIC_PKG.column_info_tbl(
70           PER_RIC_PKG.col_info_rec('TEMPLATE_CANVAS_ID',NULL,p_rec.template_canvas_id,NULL)))),
71     p_ref_type=>'DEL');
72   --
73   -- Code Ends Here
74   --
75   --
76   -- Delete the hr_template_canvases_b row.
77   --
78   delete from hr_template_canvases_b
79   where template_canvas_id = p_rec.template_canvas_id;
80   --
81   --
82   --
83   hr_utility.set_location(' Leaving:'||l_proc, 10);
84 --
85 Exception
86   When hr_api.child_integrity_violated then
87     -- Child integrity has been violated
88     --
89     hr_tcn_shd.constraint_error
90       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
91   When Others Then
92     --
93     Raise;
94 End delete_dml;
95 --
96 -- ----------------------------------------------------------------------------
97 -- |------------------------------< pre_delete >------------------------------|
98 -- ----------------------------------------------------------------------------
99 -- {Start Of Comments}
100 --
101 -- Description:
102 --   This private procedure contains any processing which is required before
103 --   the delete dml.
104 --
105 -- Prerequisites:
106 --   This is an internal procedure which is called from the del procedure.
107 --
108 -- In Parameters:
109 --   A Pl/Sql record structre.
110 --
111 -- Post Success:
112 --   Processing continues.
113 --
114 -- Post Failure:
115 --   If an error has occurred, an error message and exception will be raised
116 --   but not handled.
117 --
118 -- Developer Implementation Notes:
119 --   Any pre-processing required before the delete dml is issued should be
120 --   coded within this procedure. It is important to note that any 3rd party
121 --   maintenance should be reviewed before placing in this procedure.
122 --
123 -- Access Status:
124 --   Internal Row Handler Use Only.
125 --
126 -- {End Of Comments}
127 -- ----------------------------------------------------------------------------
128 Procedure pre_delete(p_rec in hr_tcn_shd.g_rec_type) is
129 --
130   l_proc  varchar2(72) := g_package||'pre_delete';
131 --
132 Begin
133   hr_utility.set_location('Entering:'||l_proc, 5);
134   --
135   hr_utility.set_location(' Leaving:'||l_proc, 10);
136 End pre_delete;
137 --
138 -- ----------------------------------------------------------------------------
139 -- |-----------------------------< post_delete >------------------------------|
140 -- ----------------------------------------------------------------------------
141 -- {Start Of Comments}
142 --
143 -- Description:
144 --   This private procedure contains any processing which is required after the
145 --   delete dml.
146 --
147 -- Prerequistes:
148 --   This is an internal procedure which is called from the del procedure.
149 --
150 -- In Parameters:
151 --   A Pl/Sql record structure.
152 --
153 -- Post Success:
154 --   Processing continues.
155 --
156 -- Post Failure:
157 --   If an error has occurred, an error message and exception will be raised
158 --   but not handled.
159 --
160 -- Developer Implementation Notes:
161 --   Any post-processing required after the delete dml is issued should be
162 --   coded within this procedure. It is important to note that any 3rd party
163 --   maintenance should be reviewed before placing in this procedure.
164 --
165 -- Access Status:
166 --   Internal Row Handler Use Only.
167 --
168 -- {End Of Comments}
169 -- -----------------------------------------------------------------------------
170 Procedure post_delete(p_rec in hr_tcn_shd.g_rec_type) is
171 --
172   l_proc  varchar2(72) := g_package||'post_delete';
173 --
174 Begin
175   hr_utility.set_location('Entering:'||l_proc, 5);
176     begin
177     --
178     hr_tcn_rkd.after_delete
179       (p_template_canvas_id
180       => p_rec.template_canvas_id
181       ,p_object_version_number_o
182       => hr_tcn_shd.g_old_rec.object_version_number
183       ,p_template_window_id_o
184       => hr_tcn_shd.g_old_rec.template_window_id
185       ,p_form_canvas_id_o
186       => hr_tcn_shd.g_old_rec.form_canvas_id
187       );
188     --
189   exception
190     --
191     when hr_api.cannot_find_prog_unit then
192       --
193       hr_api.cannot_find_prog_unit_error
194         (p_module_name => 'HR_TEMPLATE_CANVASES_B'
195         ,p_hook_type   => 'AD');
196       --
197   end;
198   --
199   hr_utility.set_location(' Leaving:'||l_proc, 10);
200 End post_delete;
201 --
202 -- ----------------------------------------------------------------------------
203 -- |---------------------------------< del >----------------------------------|
204 -- ----------------------------------------------------------------------------
205 Procedure del
206   (p_rec	      in hr_tcn_shd.g_rec_type
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   -- We must lock the row which we need to delete.
215   --
216   hr_tcn_shd.lck
217     (p_rec.template_canvas_id
218     ,p_rec.object_version_number
219     );
220   --
221   -- Call the supporting delete validate operation
222   --
223   hr_tcn_bus.delete_validate(p_rec);
224   --
225   -- Call the supporting pre-delete operation
226   --
227   hr_tcn_del.pre_delete(p_rec);
228   --
229   -- Delete the row.
230   --
231   hr_tcn_del.delete_dml(p_rec);
232   --
233   -- Call the supporting post-delete operation
234   --
235   hr_tcn_del.post_delete(p_rec);
236   --
237 End del;
238 --
239 -- ----------------------------------------------------------------------------
240 -- |---------------------------------< del >----------------------------------|
241 -- ----------------------------------------------------------------------------
242 Procedure del
243   (p_template_canvas_id                   in     number
244   ,p_object_version_number                in     number
245   ) is
246 --
247   l_rec	  hr_tcn_shd.g_rec_type;
248   l_proc  varchar2(72) := g_package||'del';
249 --
250 Begin
251   hr_utility.set_location('Entering:'||l_proc, 5);
252   --
253   -- As the delete procedure accepts a plsql record structure we do need to
254   -- convert the  arguments into the record structure.
255   -- We don't need to call the supplied conversion argument routine as we
256   -- only need a few attributes.
257   --
258   l_rec.template_canvas_id := p_template_canvas_id;
259   l_rec.object_version_number := p_object_version_number;
260   --
261   -- Having converted the arguments into the hr_tcn_rec
262   -- plsql record structure we must call the corresponding entity
263   -- business process
264   --
265   hr_tcn_del.del(l_rec);
266   --
267   hr_utility.set_location(' Leaving:'||l_proc, 10);
268 End del;
269 --
270 end hr_tcn_del;