DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ZA_LSA_UPD

Source


1 Package Body per_za_lsa_upd as
2 /* $Header: pezalsup.pkb 115.1 2002/12/05 06:51:01 nsugavan noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_za_lsa_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_lsa_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_lsa_shd.g_api_dml := true;  -- Set the api dml status
65   --
66   -- Update the per_za_assessments Row
67   --
68   update per_za_learnership_agreements
69   set
70     agreement_id           = p_rec.agreement_id,
71 	name				   = p_rec.name,
72 	description			   = p_rec.description,
73 	agreement_number	   = p_rec.agreement_number,
74   	person_id 			   = p_rec.person_id,
75 	agreement_start_date   = p_rec.agreement_start_date,
76 	agreement_end_date	   = p_rec.agreement_end_date,
77 	status				   = p_rec.status,
78 	seta				   = p_rec.seta,
79 	probationary_end_date  = p_rec.probationary_end_date,
80 	terminated_by		   = p_rec.terminated_by,
81 	learner_type		   = p_rec.learner_type,
82 	reason_for_termination = p_rec.reason_for_termination,
83 	actual_end_date		   = p_rec.actual_end_date,
84 	agreement_hard_copy_id = p_rec.agreement_hard_copy_id
85   where agreement_id = p_rec.agreement_id;
86   --
87   per_za_lsa_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.check_integrity_violated Then
93     -- A check constraint has been violated
94     per_za_lsa_shd.g_api_dml := false;   -- Unset the api dml status
95     per_za_lsa_shd.constraint_error
96       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
97   When hr_api.parent_integrity_violated Then
98     -- Parent integrity has been violated
99     per_za_lsa_shd.g_api_dml := false;   -- Unset the api dml status
100     per_za_lsa_shd.constraint_error
101       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
102   When hr_api.unique_integrity_violated Then
103     -- Unique integrity has been violated
104     per_za_lsa_shd.g_api_dml := false;   -- Unset the api dml status
105     per_za_lsa_shd.constraint_error
106       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
107   When Others Then
108     per_za_lsa_shd.g_api_dml := false;   -- Unset the api dml status
109     Raise;
110 End update_dml;
111 --
112 -- ----------------------------------------------------------------------------
113 -- |------------------------------< pre_update >------------------------------|
114 -- ----------------------------------------------------------------------------
115 -- {Start Of Comments}
116 --
117 -- Description:
118 --   This private procedure contains any processing which is required before
119 --   the update dml.
120 --
121 -- Pre Conditions:
122 --   This is an internal procedure which is called from the upd procedure.
123 --
124 -- In Parameters:
125 --   A Pl/Sql record structre.
126 --
127 -- Post Success:
128 --   Processing continues.
129 --
130 -- Post Failure:
131 --   If an error has occurred, an error message and exception will be raised
132 --   but not handled.
133 --
134 -- Developer Implementation Notes:
135 --   Any pre-processing required before the update dml is issued should be
136 --   coded within this procedure. It is important to note that any 3rd party
137 --   maintenance should be reviewed before placing in this procedure.
138 --
139 -- Access Status:
140 --   Internal Table Handler Use Only.
141 --
142 -- {End Of Comments}
143 -- ----------------------------------------------------------------------------
144 Procedure pre_update(p_rec in per_za_lsa_shd.g_za_rec_type) is
145 --
146   l_proc  varchar2(72) := g_package||'pre_update';
147 --
148 Begin
149   hr_utility.set_location('Entering:'||l_proc, 5);
150   --
151   hr_utility.set_location(' Leaving:'||l_proc, 10);
152 End pre_update;
153 --
154 -- ----------------------------------------------------------------------------
155 -- |-----------------------------< post_update >------------------------------|
156 -- ----------------------------------------------------------------------------
157 -- {Start Of Comments}
158 --
159 -- Description:
160 --   This private procedure contains any processing which is required after the
161 --   update dml.
162 --
163 -- Pre Conditions:
164 --   This is an internal procedure which is called from the upd procedure.
165 --
166 -- In Parameters:
167 --   A Pl/Sql record structre.
168 --
169 -- Post Success:
170 --   Processing continues.
171 --
172 -- Post Failure:
173 --   If an error has occurred, an error message and exception will be raised
174 --   but not handled.
175 --
176 -- Developer Implementation Notes:
177 --   Any post-processing required after the update dml is issued should be
178 --   coded within this procedure. It is important to note that any 3rd party
179 --   maintenance should be reviewed before placing in this procedure.
180 --
181 -- Access Status:
182 --   Internal Table Handler Use Only.
183 --
184 -- {End Of Comments}
185 -- ----------------------------------------------------------------------------
186 Procedure post_update(p_rec in per_za_lsa_shd.g_za_rec_type) is
187 --
188   l_proc  varchar2(72) := g_package||'post_update';
189 --
190 Begin
191   hr_utility.set_location('Entering:'||l_proc, 5);
192   --
193   hr_utility.set_location(' Leaving:'||l_proc, 10);
194 End post_update;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |---------------------------------< upd >----------------------------------|
198 -- ----------------------------------------------------------------------------
199 Procedure upd
200   (
201   p_rec            in out nocopy per_za_lsa_shd.g_za_rec_type,
202   p_validate       in     boolean default false
203   ) is
204 --
205   l_proc  varchar2(72) := g_package||'upd';
206 --
207 Begin
208   hr_utility.set_location('Entering:'||l_proc, 5);
209   --
210   -- Determine if the business process is to be validated.
211   --
212   If p_validate then
213     --
214     -- Issue the savepoint.
215     --
216     SAVEPOINT upd_ass;
217   End If;
218   --
219   -- We must lock the row which we need to update.
220   --
221   per_za_lsa_shd.lck
222 	(
223 	p_rec.agreement_id,
224 	p_rec.person_id
225 	);
226   --
227   -- 1. During an update system defaults are used to determine if
228   --    arguments have been defaulted or not. We must therefore
229   --    derive the full record structure values to be updated.
230   --
231   -- 2. Call the supporting update validate operations.
232   --
233 --  convert_defs(p_rec);
234 --  per_za_ass_bus.update_validate(p_rec,p_effective_date);
235   --
236   -- Call the supporting pre-update operation
237   --
238   pre_update(p_rec);
239   --
240   -- Update the row.
241   --
242   update_dml(p_rec);
243   --
244   -- Call the supporting post-update operation
245   --
246   post_update(p_rec);
247   --
248   -- If we are validating then raise the Validate_Enabled exception
249   --
250   If p_validate then
251     Raise HR_Api.Validate_Enabled;
252   End If;
253   --
254   hr_utility.set_location(' Leaving:'||l_proc, 10);
255 Exception
256   When HR_Api.Validate_Enabled Then
257     --
258     -- As the Validate_Enabled exception has been raised
259     -- we must rollback to the savepoint
260     --
261     ROLLBACK TO upd_ass;
262 End upd;
263 --
264 -- ----------------------------------------------------------------------------
265 -- |---------------------------------< upd >----------------------------------|
266 -- ----------------------------------------------------------------------------
267 Procedure upd
268   (
269   	p_agreement_id           in number,
270 	p_validate				 in	boolean	 default false,
271 	p_name					 in varchar2 default null,
272 	p_description			 in varchar2 default null,
273 	p_agreement_number		 in varchar2 default null,
274   	p_person_id              in number,
275 	p_agreement_start_date   in date     default null,
276 	p_agreement_end_date     in date 	 default null,
277 	p_status				 in varchar2 default null,
278 	p_seta					 in varchar2 default null,
279 	p_probationary_end_date	 in date 	 default null,
280 	p_terminated_by			 in varchar2 default null,
281 	p_learner_type			 in varchar2 default null,
282 	p_reason_for_termination in varchar2 default null,
283 	p_actual_end_date		 in date	 default null,
284 	p_agreement_hard_copy_id in number	 default null) IS
285 --
286   l_rec	  per_za_lsa_shd.g_za_rec_type;
287   l_proc  varchar2(72) := g_package||'upd';
288 --
289 Begin
290   hr_utility.set_location('Entering:'||l_proc, 5);
291   --
292   -- Call conversion function to turn arguments into the
293   -- l_rec structure.
294   --
295   l_rec :=
296   per_za_lsa_shd.convert_args
297   (
298   	p_agreement_id,
299   	p_person_id,
300 	p_name,
301 	p_description,
302 	p_agreement_number,
303 	p_agreement_start_date,
304 	p_agreement_end_date,
305 	p_status,
306 	p_seta,
307 	p_probationary_end_date,
308 	p_terminated_by,
309 	p_learner_type,
310 	p_reason_for_termination,
311 	p_actual_end_date,
312 	p_agreement_hard_copy_id
313   );
314   --
315   -- Having converted the arguments into the
316   -- plsql record structure we call the corresponding record
317   -- business process.
318   --
319   upd(l_rec, p_validate);
320   --
321   hr_utility.set_location(' Leaving:'||l_proc, 10);
322 End upd;
323 --
324 end per_za_lsa_upd;