DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_APS_DEL

Source


1 Package Body hxc_aps_del as
2 /* $Header: hxcaprpsrhi.pkb 120.2 2005/09/23 10:38:57 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_aps_del.';  -- Global package name
9 g_debug	   boolean	:= hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------------< delete_dml >------------------------------|
13 -- ----------------------------------------------------------------------------
14 -- {Start Of Comments}
15 --
16 -- Description:
17 --   This procedure controls the actual dml delete logic. The functions of
18 --   this procedure are as follows:
19 --   1) To set and unset the g_api_dml status as required (as we are about to
20 --      perform dml).
21 --   2) To delete the specified row from the schema using the primary key in
22 --      the predicates.
23 --   3) To trap any constraint violations that may have occurred.
24 --   4) To raise any other errors.
25 --
26 -- Prerequisites:
27 --   This is an internal private procedure which must be called from the del
28 --   procedure.
29 --
30 -- In Parameters:
31 --   A Pl/Sql record structre.
32 --
33 -- Post Success:
34 --   The specified row will be delete from the schema.
35 --
36 -- Post Failure:
37 --   On the delete dml failure it is important to note that we always reset the
38 --   g_api_dml status to false.
39 --   If a child integrity constraint violation is raised the
40 --   constraint_error procedure will be called.
41 --   If any other error is reported, the error will be raised after the
42 --   g_api_dml status is reset.
43 --
44 -- Developer Implementation Notes:
45 --   None.
46 --
47 -- Access Status:
48 --   Internal Row Handler Use Only.
49 --
50 -- {End Of Comments}
51 -- ----------------------------------------------------------------------------
52 Procedure delete_dml
53   (p_rec in hxc_aps_shd.g_rec_type
54   ) is
55 --
56   l_proc  varchar2(72);
57 --
58 Begin
59   if g_debug then
60 	 l_proc:= g_package||'delete_dml';
61 	 hr_utility.set_location('Entering:'||l_proc, 5);
62   end if;
63   --
64   hxc_aps_shd.g_api_dml := true;  -- Set the api dml status
65   --
66   -- First of all delete any child rows
67   --
68   delete from hxc_approval_period_comps
69   where approval_period_set_id = p_rec.approval_period_set_id;
70   --
71   -- Delete the hxc_approval_period_sets row.
72   --
73   delete from hxc_approval_period_sets
74   where approval_period_set_id = p_rec.approval_period_set_id;
75   --
76   hxc_aps_shd.g_api_dml := false;   -- Unset the api dml status
77   --
78   if g_debug then
79 	hr_utility.set_location(' Leaving:'||l_proc, 10);
80   end if;
81 --
82 Exception
83   When hr_api.child_integrity_violated then
84     -- Child integrity has been violated
85     hxc_aps_shd.g_api_dml := false;   -- Unset the api dml status
86     hxc_aps_shd.constraint_error
87       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
88   When Others Then
89     hxc_aps_shd.g_api_dml := false;   -- Unset the api dml status
90     Raise;
91 End delete_dml;
92 --
93 -- ----------------------------------------------------------------------------
94 -- |------------------------------< pre_delete >------------------------------|
95 -- ----------------------------------------------------------------------------
96 -- {Start Of Comments}
97 --
98 -- Description:
99 --   This private procedure contains any processing which is required before
100 --   the delete dml.
101 --
102 -- Prerequisites:
103 --   This is an internal procedure which is called from the del procedure.
104 --
105 -- In Parameters:
106 --   A Pl/Sql record structre.
107 --
108 -- Post Success:
109 --   Processing continues.
110 --
111 -- Post Failure:
112 --   If an error has occurred, an error message and exception will be raised
113 --   but not handled.
114 --
115 -- Developer Implementation Notes:
116 --   Any pre-processing required before the delete dml is issued should be
117 --   coded within this procedure. It is important to note that any 3rd party
118 --   maintenance should be reviewed before placing in this procedure.
119 --
120 -- Access Status:
121 --   Internal Row Handler Use Only.
122 --
123 -- {End Of Comments}
124 -- ----------------------------------------------------------------------------
125 Procedure pre_delete(p_rec in hxc_aps_shd.g_rec_type) is
126 --
127   l_proc  varchar2(72);
128 --
129 Begin
130   if g_debug then
131 	 l_proc:= g_package||'pre_delete';
132 	 hr_utility.set_location('Entering:'||l_proc, 5);
133 	--
134 	hr_utility.set_location(' Leaving:'||l_proc, 10);
135   end if;
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 hxc_aps_shd.g_rec_type) is
171 --
172   l_proc  varchar2(72);
173 --
174 Begin
175   if g_debug then
176 	 l_proc:= g_package||'post_delete';
177 	 hr_utility.set_location('Entering:'||l_proc, 5);
178   end if;
179     begin
180     --
181     hxc_aps_rkd.after_delete
182       (p_approval_period_set_id
183       => p_rec.approval_period_set_id
184       ,p_name_o
185       => hxc_aps_shd.g_old_rec.name
186       ,p_object_version_number_o
187       => hxc_aps_shd.g_old_rec.object_version_number
188       );
189     --
190   exception
191     --
192     when hr_api.cannot_find_prog_unit then
193       --
194       hr_api.cannot_find_prog_unit_error
195         (p_module_name => 'HXC_APPROVAL_PERIOD_SETS'
196         ,p_hook_type   => 'AD');
197       --
198   end;
199   --
200   if g_debug then
201 	hr_utility.set_location(' Leaving:'||l_proc, 10);
202   end if;
203 End post_delete;
204 --
205 -- ----------------------------------------------------------------------------
206 -- |---------------------------------< del >----------------------------------|
207 -- ----------------------------------------------------------------------------
208 Procedure del
209   (p_rec	      in hxc_aps_shd.g_rec_type
210   ) is
211 --
212   l_proc  varchar2(72);
213 --
214 Begin
215   g_debug:=hr_utility.debug_enabled;
216   if g_debug then
217 	 l_proc:= g_package||'del';
218 	 hr_utility.set_location('Entering:'||l_proc, 5);
219   end if;
220   --
221   -- We must lock the row which we need to delete.
222   --
223   hxc_aps_shd.lck
224     (p_rec.approval_period_set_id
225     ,p_rec.object_version_number
226     );
227   --
228   -- Call the supporting delete validate operation
229   --
230   hxc_aps_bus.delete_validate(p_rec);
231   --
232   -- Call the supporting pre-delete operation
233   --
234   hxc_aps_del.pre_delete(p_rec);
235   --
236   -- Delete the row.
237   --
238   hxc_aps_del.delete_dml(p_rec);
239   --
240   -- Call the supporting post-delete operation
241   --
242   hxc_aps_del.post_delete(p_rec);
243   --
244 End del;
245 --
246 -- ----------------------------------------------------------------------------
247 -- |---------------------------------< del >----------------------------------|
248 -- ----------------------------------------------------------------------------
249 Procedure del
250   (p_approval_period_set_id               in     number
251   ,p_object_version_number                in     number
252   ) is
253 --
254   l_rec	  hxc_aps_shd.g_rec_type;
255   l_proc  varchar2(72);
256 --
257 Begin
258   g_debug:=hr_utility.debug_enabled;
259   if g_debug then
260 	 l_proc:= g_package||'del';
261 	 hr_utility.set_location('Entering:'||l_proc, 5);
262   end if;
263   --
264   -- As the delete procedure accepts a plsql record structure we do need to
265   -- convert the  arguments into the record structure.
266   -- We don't need to call the supplied conversion argument routine as we
267   -- only need a few attributes.
268   --
269   l_rec.approval_period_set_id := p_approval_period_set_id;
270   l_rec.object_version_number := p_object_version_number;
271   --
272   -- Having converted the arguments into the hxc_aps_rec
273   -- plsql record structure we must call the corresponding entity
274   -- business process
275   --
276   hxc_aps_del.del(l_rec);
277   --
278   if g_debug then
279 	hr_utility.set_location(' Leaving:'||l_proc, 10);
280   end if;
281 End del;
282 --
283 end hxc_aps_del;