DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_TTP_DEL

Source


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