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