DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_DRU_DEL

Source


1 Package Body hxc_dru_del as
2 /* $Header: hxcdrurhi.pkb 120.2 2005/09/23 08:07:21 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_dru_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_dru_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_dru_shd.g_api_dml := true;  -- Set the api dml status
65   --
66   -- Delete the hxc_data_app_rule_usages row.
67   --
68   delete from hxc_data_app_rule_usages
69   where data_app_rule_usage_id = p_rec.data_app_rule_usage_id;
70   --
71   hxc_dru_shd.g_api_dml := false;   -- Unset the api dml status
72   --
73   if g_debug then
74 	hr_utility.set_location(' Leaving:'||l_proc, 10);
75   end if;
76 --
77 Exception
78   When hr_api.child_integrity_violated then
79     -- Child integrity has been violated
80     hxc_dru_shd.g_api_dml := false;   -- Unset the api dml status
81     hxc_dru_shd.constraint_error
82       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
83   When Others Then
84     hxc_dru_shd.g_api_dml := false;   -- Unset the api dml status
85     Raise;
86 End delete_dml;
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 hxc_dru_shd.g_rec_type) is
121 --
122   l_proc  varchar2(72);
123 --
124 Begin
125   if g_debug then
126 	 l_proc:= g_package||'pre_delete';
127 	 hr_utility.set_location('Entering:'||l_proc, 5);
128   end if;
129   --
130   if g_debug then
131 	hr_utility.set_location(' Leaving:'||l_proc, 10);
132   end if;
133 End pre_delete;
134 --
135 -- ----------------------------------------------------------------------------
136 -- |-----------------------------< post_delete >------------------------------|
137 -- ----------------------------------------------------------------------------
138 -- {Start Of Comments}
139 --
140 -- Description:
141 --   This private procedure contains any processing which is required after the
142 --   delete dml.
143 --
144 -- Prerequistes:
145 --   This is an internal procedure which is called from the del procedure.
146 --
147 -- In Parameters:
148 --   A Pl/Sql record structure.
149 --
150 -- Post Success:
151 --   Processing continues.
152 --
153 -- Post Failure:
154 --   If an error has occurred, an error message and exception will be raised
155 --   but not handled.
156 --
157 -- Developer Implementation Notes:
158 --   Any post-processing required after the delete dml is issued should be
159 --   coded within this procedure. It is important to note that any 3rd party
160 --   maintenance should be reviewed before placing in this procedure.
161 --
162 -- Access Status:
163 --   Internal Row Handler Use Only.
164 --
165 -- {End Of Comments}
166 -- -----------------------------------------------------------------------------
167 Procedure post_delete(p_rec in hxc_dru_shd.g_rec_type) is
168 --
169   l_proc  varchar2(72);
170 --
171 Begin
172   if g_debug then
173 	l_proc := g_package||'post_delete';
174 	hr_utility.set_location('Entering:'||l_proc, 5);
175   end if;
176     begin
177     --
178     hxc_dru_rkd.after_delete
179       (p_data_app_rule_usage_id
180       => p_rec.data_app_rule_usage_id
181       ,p_approval_style_id_o
182       => hxc_dru_shd.g_old_rec.approval_style_id
183       ,p_time_entry_rule_id_o
184       => hxc_dru_shd.g_old_rec.time_entry_rule_id
185       ,p_time_recipient_id_o
186       => hxc_dru_shd.g_old_rec.time_recipient_id
187       ,p_object_version_number_o
188       => hxc_dru_shd.g_old_rec.object_version_number
189       );
190     --
191   exception
192     --
193     when hr_api.cannot_find_prog_unit then
194       --
195       hr_api.cannot_find_prog_unit_error
196         (p_module_name => 'HXC_DATA_APP_RULE_USAGES'
197         ,p_hook_type   => 'AD');
198       --
199   end;
200   --
201   if g_debug then
202 	hr_utility.set_location(' Leaving:'||l_proc, 10);
203   end if;
204 End post_delete;
205 --
206 -- ----------------------------------------------------------------------------
207 -- |---------------------------------< del >----------------------------------|
208 -- ----------------------------------------------------------------------------
209 Procedure del
210   (p_rec	      in hxc_dru_shd.g_rec_type
211   ) is
212 --
213   l_proc  varchar2(72);
214 --
215 Begin
216   g_debug:=hr_utility.debug_enabled;
217   if g_debug then
218 	l_proc := g_package||'del';
219 	hr_utility.set_location('Entering:'||l_proc, 5);
220   end if;
221   --
222   -- We must lock the row which we need to delete.
223   --
224   hxc_dru_shd.lck
225     (p_rec.data_app_rule_usage_id
226     ,p_rec.object_version_number
227     );
228   --
229   -- Call the supporting delete validate operation
230   --
231   hxc_dru_bus.delete_validate(p_rec);
232   --
233   -- Call the supporting pre-delete operation
234   --
235   hxc_dru_del.pre_delete(p_rec);
236   --
237   -- Delete the row.
238   --
239   hxc_dru_del.delete_dml(p_rec);
240   --
241   -- Call the supporting post-delete operation
242   --
243   hxc_dru_del.post_delete(p_rec);
244   --
245 End del;
246 --
247 -- ----------------------------------------------------------------------------
248 -- |---------------------------------< del >----------------------------------|
249 -- ----------------------------------------------------------------------------
250 Procedure del
251   (p_data_app_rule_usage_id               in     number
252   ,p_object_version_number                in     number
253   ) is
254 --
255   l_rec	  hxc_dru_shd.g_rec_type;
256   l_proc  varchar2(72);
257 --
258 Begin
259   g_debug:=hr_utility.debug_enabled;
260   if g_debug then
261 	l_proc := g_package||'del';
262 	hr_utility.set_location('Entering:'||l_proc, 5);
263   end if;
264   --
265   -- As the delete procedure accepts a plsql record structure we do need to
266   -- convert the  arguments into the record structure.
267   -- We don't need to call the supplied conversion argument routine as we
268   -- only need a few attributes.
269   --
270   l_rec.data_app_rule_usage_id := p_data_app_rule_usage_id;
271   l_rec.object_version_number := p_object_version_number;
272   --
273   -- Having converted the arguments into the hxc_dru_rec
274   -- plsql record structure we must call the corresponding entity
275   -- business process
276   --
277   hxc_dru_del.del(l_rec);
278   --
279   if g_debug then
280 	hr_utility.set_location(' Leaving:'||l_proc, 10);
281   end if;
282 End del;
283 --
284 end hxc_dru_del;