DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_IDO_DEL

Source


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