DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ZA_AO_ASS_UPD

Source


1 Package Body per_za_ao_ass_upd as
2 /* $Header: pezaaaup.pkb 115.1 2002/12/05 06:49:06 nsugavan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_za_ao_ass_upd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< update_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml update logic. The processing of
17 --   this procedure is:
18 --   1) Increment the object_version_number by 1 if the object_version_number
19 --      is defined as an attribute for this entity.
20 --   2) To set and unset the g_api_dml status as required (as we are about to
21 --      perform dml).
22 --   3) To update the specified row in the schema using the primary key in
23 --      the predicates.
24 --   4) To trap any constraint violations that may have occurred.
25 --   5) To raise any other errors.
26 --
27 -- Pre Conditions:
28 --   This is an internal private procedure which must be called from the upd
29 --   procedure.
30 --
31 -- In Parameters:
32 --   A Pl/Sql record structre.
33 --
34 -- Post Success:
35 --   The specified row will be updated in the schema.
36 --
37 -- Post Failure:
38 --   On the update dml failure it is important to note that we always reset the
39 --   g_api_dml status to false.
40 --   If a check, unique or parent integrity constraint violation is raised the
41 --   constraint_error procedure will be called.
42 --   If any other error is reported, the error will be raised after the
43 --   g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 --   The update 'set' attribute list should be modified if any of your
47 --   attributes are not updateable.
48 --
49 -- Access Status:
50 --   Internal Table Handler Use Only.
51 --
52 -- {End Of Comments}
53 -- ----------------------------------------------------------------------------
54 Procedure update_dml(p_rec in out nocopy per_za_ao_ass_shd.g_za_rec_type) is
55 --
56   l_proc  varchar2(72) := g_package||'update_dml';
57 --
58 Begin
59   hr_utility.set_location('Entering:'||l_proc, 5);
60   --
61   -- Increment the object version
62   --
63   --
64   per_za_ao_ass_shd.g_api_dml := true;  -- Set the api dml status
65   --
66   -- Update the per_za_ao_assessments Row
67   --
68   update per_za_areas_of_assessment
69   set
70 	assessment_id 		      = p_rec.assessment_id,
71 	area_of_assessment		  = p_rec.area_of_assessment,
72 	assessment_result		  = p_rec.assessment_result,
73 	assessment_criteria		  = p_rec.assessment_criteria
74   where area_of_assessment_id 		  = p_rec.area_of_assessment_id;
75   --
76   per_za_ao_ass_shd.g_api_dml := false;   -- Unset the api dml status
77   --
78   hr_utility.set_location(' Leaving:'||l_proc, 10);
79 --
80 Exception
81   When hr_api.check_integrity_violated Then
82     -- A check constraint has been violated
83     per_za_ao_ass_shd.g_api_dml := false;   -- Unset the api dml status
84     per_za_ao_ass_shd.constraint_error
85       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
86   When hr_api.parent_integrity_violated Then
87     -- Parent integrity has been violated
88     per_za_ao_ass_shd.g_api_dml := false;   -- Unset the api dml status
89     per_za_ao_ass_shd.constraint_error
90       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
91   When hr_api.unique_integrity_violated Then
92     -- Unique integrity has been violated
93     per_za_ao_ass_shd.g_api_dml := false;   -- Unset the api dml status
94     per_za_ao_ass_shd.constraint_error
95       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
96   When Others Then
97     per_za_ao_ass_shd.g_api_dml := false;   -- Unset the api dml status
98     Raise;
99 End update_dml;
100 --
101 -- ----------------------------------------------------------------------------
102 -- |------------------------------< pre_update >------------------------------|
103 -- ----------------------------------------------------------------------------
104 -- {Start Of Comments}
105 --
106 -- Description:
107 --   This private procedure contains any processing which is required before
108 --   the update dml.
109 --
110 -- Pre Conditions:
111 --   This is an internal procedure which is called from the upd procedure.
112 --
113 -- In Parameters:
114 --   A Pl/Sql record structre.
115 --
116 -- Post Success:
117 --   Processing continues.
118 --
119 -- Post Failure:
120 --   If an error has occurred, an error message and exception will be raised
121 --   but not handled.
122 --
123 -- Developer Implementation Notes:
124 --   Any pre-processing required before the update dml is issued should be
125 --   coded within this procedure. It is important to note that any 3rd party
126 --   maintenance should be reviewed before placing in this procedure.
127 --
128 -- Access Status:
129 --   Internal Table Handler Use Only.
130 --
131 -- {End Of Comments}
132 -- ----------------------------------------------------------------------------
133 Procedure pre_update(p_rec in per_za_ao_ass_shd.g_za_rec_type) is
134 --
135   l_proc  varchar2(72) := g_package||'pre_update';
136 --
137 Begin
138   hr_utility.set_location('Entering:'||l_proc, 5);
139   --
140   hr_utility.set_location(' Leaving:'||l_proc, 10);
141 End pre_update;
142 --
143 -- ----------------------------------------------------------------------------
144 -- |-----------------------------< post_update >------------------------------|
145 -- ----------------------------------------------------------------------------
146 -- {Start Of Comments}
147 --
148 -- Description:
149 --   This private procedure contains any processing which is required after the
150 --   update dml.
151 --
152 -- Pre Conditions:
153 --   This is an internal procedure which is called from the upd procedure.
154 --
155 -- In Parameters:
156 --   A Pl/Sql record structre.
157 --
158 -- Post Success:
159 --   Processing continues.
160 --
161 -- Post Failure:
162 --   If an error has occurred, an error message and exception will be raised
163 --   but not handled.
164 --
165 -- Developer Implementation Notes:
166 --   Any post-processing required after the update dml is issued should be
167 --   coded within this procedure. It is important to note that any 3rd party
168 --   maintenance should be reviewed before placing in this procedure.
169 --
170 -- Access Status:
171 --   Internal Table Handler Use Only.
172 --
173 -- {End Of Comments}
174 -- ----------------------------------------------------------------------------
175 Procedure post_update(p_rec in per_za_ao_ass_shd.g_za_rec_type) is
176 --
177   l_proc  varchar2(72) := g_package||'post_update';
178 --
179 Begin
180   hr_utility.set_location('Entering:'||l_proc, 5);
181   --
182   hr_utility.set_location(' Leaving:'||l_proc, 10);
183 End post_update;
184 --
185 -- ----------------------------------------------------------------------------
186 -- |---------------------------------< upd >----------------------------------|
187 -- ----------------------------------------------------------------------------
188 Procedure upd
189   (
190   p_rec            in out nocopy per_za_ao_ass_shd.g_za_rec_type,
191   p_validate       in     boolean default false
192   ) is
193 --
194   l_proc  varchar2(72) := g_package||'upd';
195 --
196 Begin
197   hr_utility.set_location('Entering:'||l_proc, 5);
198   --
199   -- Determine if the business process is to be validated.
200   --
201   If p_validate then
202     --
203     -- Issue the savepoint.
204     --
205     SAVEPOINT upd_ass;
206   End If;
207   --
208   -- We must lock the row which we need to update.
209   --
210   per_za_ao_ass_shd.lck
211 	(
212 	p_rec.area_of_assessment_id
213 	);
214   --
215   -- 1. During an update system defaults are used to determine if
216   --    arguments have been defaulted or not. We must therefore
217   --    derive the full record structure values to be updated.
218   --
219   -- 2. Call the supporting update validate operations.
220   --
221 --  convert_defs(p_rec);
222 --  per_za_ao_ass_bus.update_validate(p_rec,p_effective_date);
223   --
224   -- Call the supporting pre-update operation
225   --
226   pre_update(p_rec);
227   --
228   -- Update the row.
229   --
230   update_dml(p_rec);
231   --
232   -- Call the supporting post-update operation
233   --
234   post_update(p_rec);
235   --
236   -- If we are validating then raise the Validate_Enabled exception
237   --
238   If p_validate then
239     Raise HR_Api.Validate_Enabled;
240   End If;
241   --
242   hr_utility.set_location(' Leaving:'||l_proc, 10);
243 Exception
244   When HR_Api.Validate_Enabled Then
245     --
246     -- As the Validate_Enabled exception has been raised
247     -- we must rollback to the savepoint
248     --
249     ROLLBACK TO upd_ass;
250 End upd;
251 --
252 -- ----------------------------------------------------------------------------
253 -- |---------------------------------< upd >----------------------------------|
254 -- ----------------------------------------------------------------------------
255 Procedure upd
256   (
257     p_area_of_assessment_id     in number,
258   	p_assessment_id             in number,
259 	p_area_of_assessment		in varchar2 default null,
260 	p_assessment_result			in varchar2 default null,
261 	p_assessment_criteria		in varchar2 default null,
262 	p_validate					in boolean default false
263   ) is
264 --
265   l_rec	  per_za_ao_ass_shd.g_za_rec_type;
266   l_proc  varchar2(72) := g_package||'upd';
267 --
268 Begin
269   hr_utility.set_location('Entering:'||l_proc, 5);
270   --
271   -- Call conversion function to turn arguments into the
272   -- l_rec structure.
273   --
274   l_rec :=
275   per_za_ao_ass_shd.convert_args
276   (
277     p_area_of_assessment_id,
278   	p_assessment_id,
279 	p_area_of_assessment,
280 	p_assessment_result,
281 	p_assessment_criteria
282   );
283   --
284   -- Having converted the arguments into the
285   -- plsql record structure we call the corresponding record
286   -- business process.
287   --
288   upd(l_rec, p_validate);
289   --
290   hr_utility.set_location(' Leaving:'||l_proc, 10);
291 End upd;
292 --
293 end per_za_ao_ass_upd;