DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_TSR_DEL

Source


1 Package Body ota_tsr_del as
2 /* $Header: ottsr01t.pkb 120.3.12020000.3 2012/12/14 09:48:09 atadepal ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ota_tsr_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 this
17 --   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 -- Pre Conditions:
26 --   This is an internal private procedure which must be called from the del
27 --   procedure.
28 --
29 -- In Arguments:
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 Development Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml(p_rec in ota_tsr_shd.g_rec_type) is
52 --
53   l_proc  varchar2(72) := g_package||'delete_dml';
54   l_resDefId ota_resource_definitions.resource_definition_id%type;
55 --
56 Begin
57   hr_utility.set_location('Entering:'||l_proc, 5);
58   --
59   ota_tsr_shd.g_api_dml := true;  -- Set the api dml status
60 
61   -- Bug. no. 3242410
62   ota_srt_del.del_tl (p_supplied_resource_id => p_rec.supplied_resource_id);
63 
64 
65   select resource_definition_id   into l_resDefId
66   from ota_suppliable_resources
67   where supplied_resource_id  = p_rec.supplied_resource_id;
68 
69   -- Delete the ota_suppliable_resources row.
70   --
71 
72   delete from ota_suppliable_resources
73   where supplied_resource_id = p_rec.supplied_resource_id;
74 
75   begin
76 
77 
78    delete from ota_resource_definitions
79    where resource_definition_id = l_resDefId;
80 
81   Exception
82    When Others Then
83     ota_tsr_shd.g_api_dml := false;   -- Unset the api dml status
84     Raise;
85   End;
86   --
87   ota_tsr_shd.g_api_dml := false;   -- Unset the api dml status
88   --
89   hr_utility.set_location(' Leaving:'||l_proc, 10);
90 --
91 Exception
92   When hr_api.child_integrity_violated then
93     -- Child integrity has been violated
94     ota_tsr_shd.g_api_dml := false;   -- Unset the api dml status
95     ota_tsr_shd.constraint_error
96       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
97   When Others Then
98     ota_tsr_shd.g_api_dml := false;   -- Unset the api dml status
99     Raise;
100 End delete_dml;
101 --
102 -- ----------------------------------------------------------------------------
103 -- |------------------------------< pre_delete >------------------------------|
104 -- ----------------------------------------------------------------------------
105 -- {Start Of Comments}
106 --
107 -- Description:
108 --   This private procedure contains any processing which is required before
109 --   the delete dml.
110 --
111 -- Pre Conditions:
112 --   This is an internal procedure which is called from the del procedure.
113 --
114 -- In Arguments:
115 --   A Pl/Sql record structre.
116 --
117 -- Post Success:
118 --   Processing continues.
119 --
120 -- Post Failure:
121 --   If an error has occurred, an error message and exception will be raised
122 --   but not handled.
123 --
124 -- Developer Implementation Notes:
125 --   Any pre-processing required before the delete dml is issued should be
126 --   coded within this procedure. It is important to note that any 3rd party
127 --   maintenance should be reviewed before placing in this procedure.
128 --
129 -- Access Status:
130 --   Internal Development Use Only.
131 --
132 -- {End Of Comments}
133 -- ----------------------------------------------------------------------------
134 Procedure pre_delete(p_rec in ota_tsr_shd.g_rec_type) is
135 --
136   l_proc  varchar2(72) := g_package||'pre_delete';
137 --
138 Begin
139   hr_utility.set_location('Entering:'||l_proc, 5);
140   --
141   hr_utility.set_location(' Leaving:'||l_proc, 10);
142 End pre_delete;
143 --
144 -- ----------------------------------------------------------------------------
145 -- |-----------------------------< post_delete >------------------------------|
146 -- ----------------------------------------------------------------------------
147 -- {Start Of Comments}
148 --
149 -- Description:
150 --   This private procedure contains any processing which is required after the
151 --   delete dml.
152 --
153 -- Pre Conditions:
154 --   This is an internal procedure which is called from the del procedure.
155 --
156 -- In Arguments:
157 --   A Pl/Sql record structre.
158 --
159 -- Post Success:
160 --   Processing continues.
161 --
162 -- Post Failure:
163 --   If an error has occurred, an error message and exception will be raised
164 --   but not handled.
165 --
166 -- Developer Implementation Notes:
167 --   Any post-processing required after the delete dml is issued should be
168 --   coded within this procedure. It is important to note that any 3rd party
169 --   maintenance should be reviewed before placing in this procedure.
170 --
171 -- Access Status:
172 --   Internal Development Use Only.
173 --
174 -- {End Of Comments}
175 -- ----------------------------------------------------------------------------
176 Procedure post_delete(p_rec in ota_tsr_shd.g_rec_type) is
177 --
178   l_proc  varchar2(72) := g_package||'post_delete';
179 --
180 Begin
181   hr_utility.set_location('Entering:'||l_proc, 5);
182   --
183   hr_utility.set_location(' Leaving:'||l_proc, 10);
184 End post_delete;
185 --
186 -- ----------------------------------------------------------------------------
187 -- |---------------------------------< del >----------------------------------|
188 -- ----------------------------------------------------------------------------
189 Procedure del
190   (
191   p_rec	      in ota_tsr_shd.g_rec_type,
192   p_validate  in boolean
193   ) is
194 --
195   l_proc  varchar2(72) := g_package||'del';
196 --
197 Begin
198   hr_utility.set_location('Entering:'||l_proc, 5);
199   --
200   -- Determine if the business process is to be validated.
201   --
202   If p_validate then
203     --
204     -- Issue the savepoint.
205     --
206     SAVEPOINT del_ota_tsr;
207   End If;
208   --
209   -- We must lock the row which we need to delete.
210   --
211   ota_tsr_shd.lck
212 	(
213 	p_rec.supplied_resource_id,
214 	p_rec.object_version_number
215 	);
216   --
217   -- Call the supporting delete validate operation
218   --
219   ota_tsr_bus.delete_validate(p_rec);
220   --
221   -- Call the supporting pre-delete operation
222   --
223   pre_delete(p_rec);
224   --
225   -- Delete the row.
226   --
227   delete_dml(p_rec);
228   --
229   -- Call the supporting post-delete operation
230   --
231   post_delete(p_rec);
232   --
233   -- If we are validating then raise the Validate_Enabled exception
234   --
235   If p_validate then
236     Raise HR_Api.Validate_Enabled;
237   End If;
238   --
239   hr_utility.set_location(' Leaving:'||l_proc, 10);
240 Exception
241   When HR_Api.Validate_Enabled Then
242     --
243     -- As the Validate_Enabled exception has been raised
244     -- we must rollback to the savepoint
245     --
246     ROLLBACK TO del_ota_tsr;
247 End del;
248 --
249 -- ----------------------------------------------------------------------------
250 -- |---------------------------------< del >----------------------------------|
251 -- ----------------------------------------------------------------------------
252 Procedure del
253   (
254   p_supplied_resource_id               in number,
255   p_object_version_number              in number,
256   p_validate                           in boolean
257   ) is
258 --
259   l_rec	  ota_tsr_shd.g_rec_type;
260   l_proc  varchar2(72) := g_package||'del';
261 --
262 Begin
263   hr_utility.set_location('Entering:'||l_proc, 5);
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.supplied_resource_id:= p_supplied_resource_id;
271   l_rec.object_version_number := p_object_version_number;
272   --
273   -- Having converted the arguments into the ota_tsr_rec
274   -- plsql record structure we must call the corresponding entity
275   -- business process
276   --
277   del(l_rec, p_validate);
278   --
279   hr_utility.set_location(' Leaving:'||l_proc, 10);
280 End del;
281 --
282 end ota_tsr_del;