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