DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TIC_DEL

Source


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