DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_DTT_DEL

Source


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