DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_CRE_SHD

Source


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