DBA Data[Home] [Help]

PACKAGE BODY: APPS.OTA_CPE_SHD

Source


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