DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_DTY_DEL

Source


1 Package Body hr_dty_del as
2 /* $Header: hrdtyrhi.pkb 120.3 2012/01/10 07:40:39 srannama ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_dty_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 delete the specified row from the schema using the primary key in
19 --      the predicates.
20 --   2) To trap any constraint violations that may have occurred.
21 --   3) To raise any other errors.
22 --
23 -- Prerequisites:
24 --   This is an internal private procedure which must be called from the del
25 --   procedure.
26 --
27 -- In Parameters:
28 --   A Pl/Sql record structre.
29 --
30 -- Post Success:
31 --   The specified row will be delete from the schema.
32 --
33 -- Post Failure:
34 --   If a child integrity constraint violation is raised the
35 --   constraint_error procedure will be called.
36 --
37 -- Developer Implementation Notes:
38 --   None.
39 --
40 -- Access Status:
41 --   Internal Row Handler Use Only.
42 --
43 -- {End Of Comments}
44 -- ----------------------------------------------------------------------------
45 Procedure delete_dml
46   (p_rec in hr_dty_shd.g_rec_type
47   ) is
48 --
49   l_proc  varchar2(72) := g_package||'delete_dml';
50 --
51 Begin
52   hr_utility.set_location('Entering:'||l_proc, 5);
53   --
54   --
55   --
56   -- Delete the hr_document_types row.
57   --
58   delete from hr_document_types
59   where document_type_id = p_rec.document_type_id;
60   --
61   --
62   --
63   hr_utility.set_location(' Leaving:'||l_proc, 10);
64 --
65 Exception
66   When hr_api.child_integrity_violated then
67     -- Child integrity has been violated
68     --
69     hr_dty_shd.constraint_error
70       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
71   When Others Then
72     --
73     Raise;
74 End delete_dml;
75 --
76 -- ----------------------------------------------------------------------------
77 -- |------------------------------< pre_delete >------------------------------|
78 -- ----------------------------------------------------------------------------
79 -- {Start Of Comments}
80 --
81 -- Description:
82 --   This private procedure contains any processing which is required before
83 --   the delete dml.
84 --
85 -- Prerequisites:
86 --   This is an internal procedure which is called from the del procedure.
87 --
88 -- In Parameters:
89 --   A Pl/Sql record structre.
90 --
91 -- Post Success:
92 --   Processing continues.
93 --
94 -- Post Failure:
95 --   If an error has occurred, an error message and exception will be raised
96 --   but not handled.
97 --
98 -- Developer Implementation Notes:
99 --   Any pre-processing required before the delete dml is issued should be
100 --   coded within this procedure. It is important to note that any 3rd party
101 --   maintenance should be reviewed before placing in this procedure.
102 --
103 -- Access Status:
104 --   Internal Row Handler Use Only.
105 --
106 -- {End Of Comments}
107 -- ----------------------------------------------------------------------------
108 Procedure pre_delete(p_rec in hr_dty_shd.g_rec_type) is
109 --
110   l_proc  varchar2(72) := g_package||'pre_delete';
111 --
112 Begin
113   hr_utility.set_location('Entering:'||l_proc, 5);
114   --
115   hr_utility.set_location(' Leaving:'||l_proc, 10);
116 End pre_delete;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |-----------------------------< post_delete >------------------------------|
120 -- ----------------------------------------------------------------------------
121 -- {Start Of Comments}
122 --
123 -- Description:
124 --   This private procedure contains any processing which is required after
125 --   the delete dml.
126 --
127 -- Prerequistes:
128 --   This is an internal procedure which is called from the del procedure.
129 --
130 -- In Parameters:
131 --   A Pl/Sql record structure.
132 --
133 -- Post Success:
134 --   Processing continues.
135 --
136 -- Post Failure:
137 --   If an error has occurred, an error message and exception will be raised
138 --   but not handled.
139 --
140 -- Developer Implementation Notes:
141 --   Any post-processing required after the delete dml is issued should be
142 --   coded within this procedure. It is important to note that any 3rd party
143 --   maintenance should be reviewed before placing in this procedure.
144 --
145 -- Access Status:
146 --   Internal Row Handler Use Only.
147 --
148 -- {End Of Comments}
149 -- -----------------------------------------------------------------------------
150 Procedure post_delete(p_rec in hr_dty_shd.g_rec_type) is
151 --
152   l_proc  varchar2(72) := g_package||'post_delete';
153 --
154 Begin
155   hr_utility.set_location('Entering:'||l_proc, 5);
156   begin
157     --
158     hr_dty_rkd.after_delete
159       (p_document_type_id
160       => p_rec.document_type_id
161       ,p_category_code_o
162       => hr_dty_shd.g_old_rec.category_code
163       ,p_sub_category_code_o
164       => hr_dty_shd.g_old_rec.sub_category_code
165       ,p_active_inactive_flag_o
166       => hr_dty_shd.g_old_rec.active_inactive_flag
167       ,p_multiple_occurences_flag_o
168       => hr_dty_shd.g_old_rec.multiple_occurences_flag
169       ,p_legislation_code_o
170       => hr_dty_shd.g_old_rec.legislation_code
171       ,p_authorization_required_o
172       => hr_dty_shd.g_old_rec.authorization_required
173       ,p_warning_period_o
174       => hr_dty_shd.g_old_rec.warning_period
175       ,p_request_id_o
176       => hr_dty_shd.g_old_rec.request_id
177       ,p_program_application_id_o
178       => hr_dty_shd.g_old_rec.program_application_id
179       ,p_program_id_o
180       => hr_dty_shd.g_old_rec.program_id
181       ,p_program_update_date_o
182       => hr_dty_shd.g_old_rec.program_update_date
183       ,p_object_version_number_o
184       => hr_dty_shd.g_old_rec.object_version_number
185       );
186     --
187   exception
188     --
189     when hr_api.cannot_find_prog_unit then
190       --
191       hr_api.cannot_find_prog_unit_error
192         (p_module_name => 'HR_DOCUMENT_TYPES'
193         ,p_hook_type   => 'AD');
194       --
195   end;
196   --
197   hr_utility.set_location(' Leaving:'||l_proc, 10);
198 End post_delete;
199 --
200 -- ----------------------------------------------------------------------------
201 -- |---------------------------------< del >----------------------------------|
202 -- ----------------------------------------------------------------------------
203 Procedure del
204   (p_rec              in hr_dty_shd.g_rec_type
205   ) is
206 --
207   l_proc  varchar2(72) := g_package||'del';
208 --
209 Begin
210   hr_utility.set_location('Entering:'||l_proc, 5);
211   --
212   -- We must lock the row which we need to delete.
213   --
214   hr_dty_shd.lck
215     (p_rec.document_type_id
216     ,p_rec.object_version_number
217     );
218   --
219   -- Call the supporting delete validate operation
220   --
221   hr_dty_bus.delete_validate(p_rec);
222   --
223   -- Call to raise any errors on multi-message list
224   hr_multi_message.end_validation_set;
225   --
226   -- Call the supporting pre-delete operation
227   --
228   hr_dty_del.pre_delete(p_rec);
229   --
230   -- Delete the row.
231   --
232   hr_dty_del.delete_dml(p_rec);
233   --
234   -- Call the supporting post-delete operation
235   --
236   hr_dty_del.post_delete(p_rec);
237   --
238   -- Call to raise any errors on multi-message list
239   hr_multi_message.end_validation_set;
240   --
241 End del;
242 --
243 -- ----------------------------------------------------------------------------
244 -- |---------------------------------< del >----------------------------------|
245 -- ----------------------------------------------------------------------------
246 Procedure del
247   (p_document_type_id                     in     number
248   ,p_object_version_number                in     number
249   ) is
250 --
251   l_rec   hr_dty_shd.g_rec_type;
252   l_proc  varchar2(72) := g_package||'del';
253 --
254 Begin
255   hr_utility.set_location('Entering:'||l_proc, 5);
256   --
257   -- As the delete procedure accepts a plsql record structure we do need to
258   -- convert the  arguments into the record structure.
259   -- We don't need to call the supplied conversion argument routine as we
260   -- only need a few attributes.
261   --
262   l_rec.document_type_id := p_document_type_id;
263   l_rec.object_version_number := p_object_version_number;
264   --
265   -- Having converted the arguments into the hr_dty_rec
266   -- plsql record structure we must call the corresponding entity
267   -- business process
268   --
269   hr_dty_del.del(l_rec);
270   --
271   hr_utility.set_location(' Leaving:'||l_proc, 10);
272 End del;
273 --
274 end hr_dty_del;