DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_IAV_SHD

Source


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