DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_LME_SHD

Source


1 Package Body ota_lme_shd as
2 /* $Header: otlmerhi.pkb 120.0 2005/05/29 07:18:51 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ota_lme_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_LP_MEMBER_ENROLLMENTS_PK') 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_lp_member_enrollment_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        lp_member_enrollment_id
50       ,lp_enrollment_id
51       ,learning_path_section_id
52       ,learning_path_member_id
53       ,member_status_code
54       ,completion_target_date
55       ,completion_date
56       ,business_group_id
57       ,object_version_number
58       ,attribute_category
59       ,attribute1
60       ,attribute2
61       ,attribute3
62       ,attribute4
63       ,attribute5
64       ,attribute6
65       ,attribute7
66       ,attribute8
67       ,attribute9
68       ,attribute10
69       ,attribute11
70       ,attribute12
71       ,attribute13
72       ,attribute14
73       ,attribute15
74       ,attribute16
75       ,attribute17
76       ,attribute18
77       ,attribute19
78       ,attribute20
79       ,attribute21
80       ,attribute22
81       ,attribute23
82       ,attribute24
83       ,attribute25
84       ,attribute26
85       ,attribute27
86       ,attribute28
87       ,attribute29
88       ,attribute30
89       ,creator_person_id
90     from        ota_lp_member_enrollments
91     where       lp_member_enrollment_id = p_lp_member_enrollment_id;
92   --
93   l_fct_ret     boolean;
94   --
95 Begin
96   --
97   If (p_lp_member_enrollment_id is null and
98       p_object_version_number is null
99      ) Then
100     --
101     -- One of the primary key arguments is null therefore we must
102     -- set the returning function value to false
103     --
104     l_fct_ret := false;
105   Else
106     If (p_lp_member_enrollment_id
107         = ota_lme_shd.g_old_rec.lp_member_enrollment_id and
108         p_object_version_number
109         = ota_lme_shd.g_old_rec.object_version_number
110        ) Then
111       --
112       -- The g_old_rec is current therefore we must
113       -- set the returning function to true
114       --
115       l_fct_ret := true;
116     Else
117       --
118       -- Select the current row into g_old_rec
119       --
120       Open C_Sel1;
121       Fetch C_Sel1 Into ota_lme_shd.g_old_rec;
122       If C_Sel1%notfound Then
123         Close C_Sel1;
124         --
125         -- The primary key is invalid therefore we must error
126         --
127         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
128         fnd_message.raise_error;
129       End If;
130       Close C_Sel1;
131       If (p_object_version_number
132           <> ota_lme_shd.g_old_rec.object_version_number) Then
133         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
134         fnd_message.raise_error;
135       End If;
136       l_fct_ret := true;
137     End If;
138   End If;
139   Return (l_fct_ret);
140 --
141 End api_updating;
142 --
143 -- ----------------------------------------------------------------------------
144 -- |---------------------------------< lck >----------------------------------|
145 -- ----------------------------------------------------------------------------
146 Procedure lck
147   (p_lp_member_enrollment_id              in     number
148   ,p_object_version_number                in     number
149   ) is
150 --
151 -- Cursor selects the 'current' row from the HR Schema
152 --
153   Cursor C_Sel1 is
154     select
155        lp_member_enrollment_id
156       ,lp_enrollment_id
157       ,learning_path_section_id
158       ,learning_path_member_id
159       ,member_status_code
160       ,completion_target_date
161       ,completion_date
162       ,business_group_id
163       ,object_version_number
164       ,attribute_category
165       ,attribute1
166       ,attribute2
167       ,attribute3
168       ,attribute4
169       ,attribute5
170       ,attribute6
171       ,attribute7
172       ,attribute8
173       ,attribute9
174       ,attribute10
175       ,attribute11
176       ,attribute12
177       ,attribute13
178       ,attribute14
179       ,attribute15
180       ,attribute16
181       ,attribute17
182       ,attribute18
183       ,attribute19
184       ,attribute20
185       ,attribute21
186       ,attribute22
187       ,attribute23
188       ,attribute24
189       ,attribute25
190       ,attribute26
191       ,attribute27
192       ,attribute28
193       ,attribute29
194       ,attribute30
195       ,creator_person_id
196     from        ota_lp_member_enrollments
197     where       lp_member_enrollment_id = p_lp_member_enrollment_id
198     for update nowait;
199 --
200   l_proc        varchar2(72) := g_package||'lck';
201 --
202 Begin
203   hr_utility.set_location('Entering:'||l_proc, 5);
204   --
205   hr_api.mandatory_arg_error
206     (p_api_name           => l_proc
207     ,p_argument           => 'LP_MEMBER_ENROLLMENT_ID'
208     ,p_argument_value     => p_lp_member_enrollment_id
209     );
210   hr_utility.set_location(l_proc,6);
211   hr_api.mandatory_arg_error
212     (p_api_name           => l_proc
213     ,p_argument           => 'OBJECT_VERSION_NUMBER'
214     ,p_argument_value     => p_object_version_number
215     );
216   --
217   Open  C_Sel1;
218   Fetch C_Sel1 Into ota_lme_shd.g_old_rec;
219   If C_Sel1%notfound then
220     Close C_Sel1;
221     --
222     -- The primary key is invalid therefore we must error
223     --
224     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
225     fnd_message.raise_error;
226   End If;
227   Close C_Sel1;
228   If (p_object_version_number
229       <> ota_lme_shd.g_old_rec.object_version_number) Then
230         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
231         fnd_message.raise_error;
232   End If;
233   --
234   hr_utility.set_location(' Leaving:'||l_proc, 10);
235   --
236   -- We need to trap the ORA LOCK exception
237   --
238 Exception
239   When HR_Api.Object_Locked then
240     --
241     -- The object is locked therefore we need to supply a meaningful
242     -- error message.
243     --
244     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
245     fnd_message.set_token('TABLE_NAME', 'ota_lp_member_enrollments');
246     fnd_message.raise_error;
247 End lck;
248 --
249 -- ----------------------------------------------------------------------------
250 -- |-----------------------------< convert_args >-----------------------------|
251 -- ----------------------------------------------------------------------------
252 Function convert_args
253   (p_lp_member_enrollment_id        in number
254   ,p_lp_enrollment_id               in number
255   ,p_learning_path_section_id       in number
256   ,p_learning_path_member_id        in number
257   ,p_member_status_code                  in varchar2
258   ,p_completion_target_date         in date
259   ,p_completion_date                 in date
260   ,p_business_group_id              in number
261   ,p_object_version_number          in number
262   ,p_attribute_category             in varchar2
263   ,p_attribute1                     in varchar2
264   ,p_attribute2                     in varchar2
265   ,p_attribute3                     in varchar2
266   ,p_attribute4                     in varchar2
267   ,p_attribute5                     in varchar2
268   ,p_attribute6                     in varchar2
269   ,p_attribute7                     in varchar2
270   ,p_attribute8                     in varchar2
271   ,p_attribute9                     in varchar2
272   ,p_attribute10                    in varchar2
273   ,p_attribute11                    in varchar2
274   ,p_attribute12                    in varchar2
275   ,p_attribute13                    in varchar2
276   ,p_attribute14                    in varchar2
277   ,p_attribute15                    in varchar2
278   ,p_attribute16                    in varchar2
279   ,p_attribute17                    in varchar2
280   ,p_attribute18                    in varchar2
281   ,p_attribute19                    in varchar2
282   ,p_attribute20                    in varchar2
283   ,p_attribute21                    in varchar2
284   ,p_attribute22                    in varchar2
285   ,p_attribute23                    in varchar2
286   ,p_attribute24                    in varchar2
287   ,p_attribute25                    in varchar2
288   ,p_attribute26                    in varchar2
289   ,p_attribute27                    in varchar2
290   ,p_attribute28                    in varchar2
291   ,p_attribute29                    in varchar2
292   ,p_attribute30                    in varchar2
293   ,p_creator_person_id              in number
294   )
295   Return g_rec_type is
296 --
297   l_rec   g_rec_type;
298 --
299 Begin
300   --
301   -- Convert arguments into local l_rec structure.
302   --
303   l_rec.lp_member_enrollment_id          := p_lp_member_enrollment_id;
304   l_rec.lp_enrollment_id                 := p_lp_enrollment_id;
305   l_rec.learning_path_section_id         := p_learning_path_section_id;
306   l_rec.learning_path_member_id          := p_learning_path_member_id;
307   l_rec.member_status_code                    := p_member_status_code;
308   l_rec.completion_target_date           := p_completion_target_date;
309   l_rec.completion_date                   := p_completion_date;
310   l_rec.business_group_id                := p_business_group_id;
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.attribute21                      := p_attribute21;
334   l_rec.attribute22                      := p_attribute22;
335   l_rec.attribute23                      := p_attribute23;
336   l_rec.attribute24                      := p_attribute24;
337   l_rec.attribute25                      := p_attribute25;
338   l_rec.attribute26                      := p_attribute26;
339   l_rec.attribute27                      := p_attribute27;
340   l_rec.attribute28                      := p_attribute28;
341   l_rec.attribute29                      := p_attribute29;
342   l_rec.attribute30                      := p_attribute30;
343   l_rec.creator_person_id                := p_creator_person_id;
344   --
345   -- Return the plsql record structure.
346   --
347   Return(l_rec);
348 --
349 End convert_args;
350 --
351 end ota_lme_shd;