[Home] [Help]
PACKAGE BODY: APPS.PER_ASN_SHD
Source
1 Package Body per_asn_shd as
2 /* $Header: peasnrhi.pkb 115.11 2003/09/01 08:19:06 bdivvela ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_asn_shd.'; -- Global package name
9 --
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 hr_utility.set_location('Entering:'||l_proc, 5);
21 --
22 If (p_constraint_name = 'PER_ASSESSMENTS_DATE_CHK') Then
23 hr_utility.set_message(801, 'HR_51591_ASN_END_STA_DATE_ERR');
24 hr_utility.set_message_token('PROCEDURE', l_proc);
25 hr_utility.set_message_token('STEP','5');
26 hr_utility.raise_error;
27 ElsIf (p_constraint_name = 'PER_ASSESSMENTS_DATE_END_CHK') Then
28 hr_utility.set_message(801, 'HR_51590_ASN_START_DATE_NULL');
29 hr_utility.set_message_token('PROCEDURE', l_proc);
30 hr_utility.set_message_token('STEP','10');
31 hr_utility.raise_error;
32 ElsIf (p_constraint_name = 'PER_ASSESSMENTS_FK1') Then
33 hr_utility.set_message(801, 'HR_51583_ASN_NO_AST_EXISTS');
34 hr_utility.set_message_token('PROCEDURE', l_proc);
35 hr_utility.set_message_token('STEP','15');
36 hr_utility.raise_error;
37 ElsIf (p_constraint_name = 'PER_ASSESSMENTS_FK2') Then
38 hr_utility.set_message(801, 'HR_7208_API_BUS_GRP_INVALID');
39 hr_utility.set_message_token('PROCEDURE', l_proc);
40 hr_utility.set_message_token('STEP','20');
41 hr_utility.raise_error;
42 ElsIf (p_constraint_name = 'PER_ASSESSMENTS_FK3') Then
43 hr_utility.set_message(801, 'HR_51592_ASN_GROUP_NO_EXIST');
44 hr_utility.set_message_token('PROCEDURE', l_proc);
45 hr_utility.set_message_token('STEP','25');
46 hr_utility.raise_error;
47 ElsIf (p_constraint_name = 'PER_ASSESSMENTS_FK4') Then
48 hr_utility.set_message(801, 'HR_51830_ASN_APPRAI_NO_EXIST');
49 hr_utility.set_message_token('PROCEDURE', l_proc);
50 hr_utility.set_message_token('STEP','25');
51 hr_utility.raise_error;
52 ElsIf (p_constraint_name = 'PER_ASSESSMENTS_PK') Then
53 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
54 hr_utility.set_message_token('PROCEDURE', l_proc);
55 hr_utility.set_message_token('STEP','30');
56 hr_utility.raise_error;
57 ElsIf (p_constraint_name = 'PER_ASSESSMENTS_UK1') Then
58 hr_utility.set_message(801, 'HR_51593_ASN_DUP_ROW_EXIST');
59 hr_utility.set_message_token('PROCEDURE', l_proc);
60 hr_utility.set_message_token('STEP','35');
61 hr_utility.raise_error;
62 Else
63 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
64 hr_utility.set_message_token('PROCEDURE', l_proc);
65 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
66 hr_utility.raise_error;
67 End If;
68 --
69 hr_utility.set_location(' Leaving:'||l_proc, 10);
70 End constraint_error;
71 --
72 -- ----------------------------------------------------------------------------
73 -- |-----------------------------< api_updating >-----------------------------|
74 -- ----------------------------------------------------------------------------
75 Function api_updating
76 (
77 p_assessment_id in number,
78 p_object_version_number in number
79 ) Return Boolean Is
80 --
81 --
82 -- Cursor selects the 'current' row from the HR Schema
83 --
84 Cursor C_Sel1 is
85 select
86 assessment_id,
87 assessment_type_id,
88 business_group_id,
89 person_id,
90 assessment_group_id,
91 assessment_period_start_date,
92 assessment_period_end_date,
93 assessment_date,
94 assessor_person_id,
95 appraisal_id,
96 group_date,
97 group_initiator_id,
98 comments,
99 total_score,
100 status,
101 attribute_category,
102 attribute1,
103 attribute2,
104 attribute3,
105 attribute4,
106 attribute5,
107 attribute6,
108 attribute7,
109 attribute8,
110 attribute9,
111 attribute10,
112 attribute11,
113 attribute12,
114 attribute13,
115 attribute14,
116 attribute15,
117 attribute16,
118 attribute17,
119 attribute18,
120 attribute19,
121 attribute20,
122 object_version_number
123 from per_assessments
124 where assessment_id = p_assessment_id;
125 --
126 l_proc varchar2(72) := g_package||'api_updating';
127 l_fct_ret boolean;
128 --
129 Begin
130 hr_utility.set_location('Entering:'||l_proc, 5);
131 --
132 If (
133 p_assessment_id is null and
134 p_object_version_number is null
135 ) Then
136 --
137 -- One of the primary key arguments is null therefore we must
138 -- set the returning function value to false
139 --
140 l_fct_ret := false;
141 Else
142 If (
143 p_assessment_id = g_old_rec.assessment_id and
144 p_object_version_number = g_old_rec.object_version_number
145 ) Then
146 hr_utility.set_location(l_proc, 10);
147 --
148 -- The g_old_rec is current therefore we must
149 -- set the returning function to true
150 --
151 l_fct_ret := true;
152 Else
153 --
154 -- Select the current row into g_old_rec
155 --
156 Open C_Sel1;
157 Fetch C_Sel1 Into g_old_rec;
158 If C_Sel1%notfound Then
159 Close C_Sel1;
160 --
161 -- The primary key is invalid therefore we must error
162 --
163 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
164 hr_utility.raise_error;
165 End If;
166 Close C_Sel1;
167 If (p_object_version_number <> g_old_rec.object_version_number) Then
168 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
169 hr_utility.raise_error;
170 End If;
171 hr_utility.set_location(l_proc, 15);
172 l_fct_ret := true;
173 End If;
174 End If;
175 hr_utility.set_location(' Leaving:'||l_proc, 20);
176 Return (l_fct_ret);
177 --
178 End api_updating;
179 --
180 -- ----------------------------------------------------------------------------
181 -- |---------------------------------< lck >----------------------------------|
182 -- ----------------------------------------------------------------------------
183 Procedure lck
184 (
185 p_assessment_id in number,
186 p_object_version_number in number
187 ) is
188 --
189 -- Cursor selects the 'current' row from the HR Schema
190 --
191 Cursor C_Sel1 is
192 select assessment_id,
193 assessment_type_id,
194 business_group_id,
195 person_id,
196 assessment_group_id,
197 assessment_period_start_date,
198 assessment_period_end_date,
199 assessment_date,
200 assessor_person_id,
201 appraisal_id,
202 group_date,
203 group_initiator_id,
204 comments,
205 total_score,
206 status,
207 attribute_category,
208 attribute1,
209 attribute2,
210 attribute3,
211 attribute4,
212 attribute5,
213 attribute6,
214 attribute7,
215 attribute8,
216 attribute9,
217 attribute10,
218 attribute11,
219 attribute12,
220 attribute13,
221 attribute14,
222 attribute15,
223 attribute16,
224 attribute17,
225 attribute18,
226 attribute19,
227 attribute20,
228 object_version_number
229 from per_assessments
230 where assessment_id = p_assessment_id
231 for update nowait;
232 --
233 l_proc varchar2(72) := g_package||'lck';
234 --
235 Begin
236 hr_utility.set_location('Entering:'||l_proc, 5);
237 --
238 -- Add any mandatory argument checking here:
239 -- Example:
240 -- hr_api.mandatory_arg_error
241 -- (p_api_name => l_proc,
242 -- p_argument => 'object_version_number',
243 -- p_argument_value => p_object_version_number);
244 --
245 Open C_Sel1;
246 Fetch C_Sel1 Into g_old_rec;
247 If C_Sel1%notfound then
248 Close C_Sel1;
249 --
250 -- The primary key is invalid therefore we must error
251 --
252 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
253 hr_utility.raise_error;
254 End If;
255 Close C_Sel1;
256 If (p_object_version_number <> g_old_rec.object_version_number) Then
257 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
258 hr_utility.raise_error;
259 End If;
260 --
261 hr_utility.set_location(' Leaving:'||l_proc, 10);
262 --
263 -- We need to trap the ORA LOCK exception
264 --
265 Exception
266 When HR_Api.Object_Locked then
267 --
268 -- The object is locked therefore we need to supply a meaningful
269 -- error message.
270 --
271 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
272 hr_utility.set_message_token('TABLE_NAME', 'per_assessments');
273 hr_utility.raise_error;
274 End lck;
275 --
276 -- ----------------------------------------------------------------------------
277 -- |-----------------------------< convert_args >-----------------------------|
278 -- ----------------------------------------------------------------------------
279 Function convert_args
280 (
281 p_assessment_id in number,
282 p_assessment_type_id in number,
283 p_business_group_id in number,
284 p_person_id in number,
285 p_assessment_group_id in number,
286 p_assessment_period_start_date in date,
287 p_assessment_period_end_date in date,
288 p_assessment_date in date,
289 p_assessor_person_id in number,
290 p_appraisal_id in number,
291 p_group_date in date,
292 p_group_initiator_id in number,
293 p_comments in varchar2,
294 p_total_score in number,
295 p_status in varchar2,
296 p_attribute_category in varchar2,
297 p_attribute1 in varchar2,
298 p_attribute2 in varchar2,
299 p_attribute3 in varchar2,
300 p_attribute4 in varchar2,
301 p_attribute5 in varchar2,
302 p_attribute6 in varchar2,
303 p_attribute7 in varchar2,
304 p_attribute8 in varchar2,
305 p_attribute9 in varchar2,
306 p_attribute10 in varchar2,
307 p_attribute11 in varchar2,
308 p_attribute12 in varchar2,
309 p_attribute13 in varchar2,
310 p_attribute14 in varchar2,
311 p_attribute15 in varchar2,
312 p_attribute16 in varchar2,
313 p_attribute17 in varchar2,
314 p_attribute18 in varchar2,
315 p_attribute19 in varchar2,
316 p_attribute20 in varchar2,
317 p_object_version_number in number
318 )
319 Return g_rec_type is
320 --
321 l_rec g_rec_type;
322 l_proc varchar2(72) := g_package||'convert_args';
323 --
324 Begin
325 --
326 hr_utility.set_location('Entering:'||l_proc, 5);
327 --
328 -- Convert arguments into local l_rec structure.
329 hr_utility.set_location(' p_status in convert_args:'||p_status, 10);
330 --
331 l_rec.assessment_id := p_assessment_id;
332 l_rec.assessment_type_id := p_assessment_type_id;
333 l_rec.business_group_id := p_business_group_id;
334 l_rec.person_id := p_person_id;
338 l_rec.assessment_date := p_assessment_date;
335 l_rec.assessment_group_id := p_assessment_group_id;
336 l_rec.assessment_period_start_date := p_assessment_period_start_date;
337 l_rec.assessment_period_end_date := p_assessment_period_end_date;
339 l_rec.assessor_person_id := p_assessor_person_id;
340 l_rec.appraisal_id := p_appraisal_id;
341 l_rec.group_date := p_group_date;
342 l_rec.group_initiator_id := p_group_initiator_id;
343 l_rec.comments := p_comments;
344 l_rec.total_score := p_total_score;
345 l_rec.status := p_status;
346 l_rec.attribute_category := p_attribute_category;
347 l_rec.attribute1 := p_attribute1;
348 l_rec.attribute2 := p_attribute2;
349 l_rec.attribute3 := p_attribute3;
350 l_rec.attribute4 := p_attribute4;
351 l_rec.attribute5 := p_attribute5;
352 l_rec.attribute6 := p_attribute6;
353 l_rec.attribute7 := p_attribute7;
354 l_rec.attribute8 := p_attribute8;
355 l_rec.attribute9 := p_attribute9;
356 l_rec.attribute10 := p_attribute10;
357 l_rec.attribute11 := p_attribute11;
358 l_rec.attribute12 := p_attribute12;
359 l_rec.attribute13 := p_attribute13;
360 l_rec.attribute14 := p_attribute14;
361 l_rec.attribute15 := p_attribute15;
362 l_rec.attribute16 := p_attribute16;
363 l_rec.attribute17 := p_attribute17;
364 l_rec.attribute18 := p_attribute18;
365 l_rec.attribute19 := p_attribute19;
366 l_rec.attribute20 := p_attribute20;
367 l_rec.object_version_number := p_object_version_number;
368 --
369 -- Return the plsql record structure.
370 --
371 hr_utility.set_location(' l_rec.status in convert_args:'||l_rec.status, 10);
372 hr_utility.set_location(' p_status in convert_args:'||p_status, 10);
373 hr_utility.set_location(' Leaving:'||l_proc, 10);
374 Return(l_rec);
375 --
376 End convert_args;
377 --
378 end per_asn_shd;