DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_FTU_DEL

Source


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