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