DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_ORI_SHD

Source


1 Package Body hr_ori_shd as
2 /* $Header: hrorirhi.pkb 120.3.12010000.2 2008/08/06 08:45:57 ubhat ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_ori_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16   --
17   Return (nvl(g_api_dml, false));
18   --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25   (p_constraint_name in all_constraints.constraint_name%TYPE
26   ) Is
27 --
28   l_proc    varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31   --
32   If (p_constraint_name = 'HR_ORGANIZATION_INFORMATIO_FK1') Then
33     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('STEP','5');
36     fnd_message.raise_error;
37   ElsIf (p_constraint_name = 'HR_ORGANIZATION_INFORMATIO_FK2') Then
38     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('STEP','10');
41     fnd_message.raise_error;
42   ElsIf (p_constraint_name = 'HR_ORGANIZATION_INFORMATIO_PK') Then
43     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('STEP','15');
46     fnd_message.raise_error;
47   Else
48     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
49     fnd_message.set_token('PROCEDURE', l_proc);
50     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
51     fnd_message.raise_error;
52   End If;
53   --
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60   (p_org_information_id                   in     number
61   ,p_object_version_number                in     number
62   )
63   Return Boolean Is
64 --
65   --
66   -- Cursor selects the 'current' row from the HR Schema
67   --
68   Cursor C_Sel1 is
69     select
70        org_information_id
71       ,org_information_context
72       ,organization_id
73       ,org_information1
74       ,org_information10
75       ,org_information11
76       ,org_information12
77       ,org_information13
78       ,org_information14
79       ,org_information15
80       ,org_information16
81       ,org_information17
82       ,org_information18
83       ,org_information19
84       ,org_information2
85       ,org_information20
86       ,org_information3
87       ,org_information4
88       ,org_information5
89       ,org_information6
90       ,org_information7
91       ,org_information8
92       ,org_information9
93       ,request_id
94       ,program_application_id
95       ,program_id
96       ,program_update_date
97       ,attribute_category
98       ,attribute1
99       ,attribute2
100       ,attribute3
101       ,attribute4
102       ,attribute5
103       ,attribute6
104       ,attribute7
105       ,attribute8
106       ,attribute9
107       ,attribute10
108       ,attribute11
109       ,attribute12
110       ,attribute13
111       ,attribute14
112       ,attribute15
113       ,attribute16
114       ,attribute17
115       ,attribute18
116       ,attribute19
117       ,attribute20
118       ,object_version_number
119     from hr_organization_information
120     where   org_information_id = p_org_information_id;
121 --
122   l_fct_ret boolean;
123 --
124 Begin
125   --
126   If (p_org_information_id is null and
127       p_object_version_number is null
128      ) Then
129     --
130     -- One of the primary key arguments is null therefore we must
131     -- set the returning function value to false
132     --
133     l_fct_ret := false;
134   Else
135     If (p_org_information_id
136         = hr_ori_shd.g_old_rec.org_information_id and
137         p_object_version_number
138         = hr_ori_shd.g_old_rec.object_version_number
139        ) Then
140       --
141       -- The g_old_rec is current therefore we must
142       -- set the returning function to true
143       --
144       l_fct_ret := true;
145     Else
146       --
147       -- Select the current row into g_old_rec
148       --
149       Open C_Sel1;
150       Fetch C_Sel1 Into hr_ori_shd.g_old_rec;
151       If C_Sel1%notfound Then
152         Close C_Sel1;
153         --
154         -- The primary key is invalid therefore we must error
155         --
156         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
157         fnd_message.raise_error;
158       End If;
159       Close C_Sel1;
160       If (p_object_version_number
161           <> hr_ori_shd.g_old_rec.object_version_number) Then
162         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
163         fnd_message.raise_error;
164       End If;
165       l_fct_ret := true;
166     End If;
167   End If;
168   Return (l_fct_ret);
169 --
170 End api_updating;
171 --
172 -- ----------------------------------------------------------------------------
173 -- |---------------------------------< lck >----------------------------------|
174 -- ----------------------------------------------------------------------------
175 Procedure lck
176   (p_org_information_id                   in     number
177   ,p_object_version_number                in     number
178   ) is
179 --
180 -- Cursor selects the 'current' row from the HR Schema
181 --
182   Cursor C_Sel1 is
183     select
184        org_information_id
185       ,org_information_context
186       ,organization_id
187       ,org_information1
188       ,org_information10
189       ,org_information11
190       ,org_information12
191       ,org_information13
192       ,org_information14
193       ,org_information15
194       ,org_information16
195       ,org_information17
196       ,org_information18
197       ,org_information19
198       ,org_information2
199       ,org_information20
200       ,org_information3
201       ,org_information4
202       ,org_information5
203       ,org_information6
204       ,org_information7
205       ,org_information8
206       ,org_information9
207       ,request_id
208       ,program_application_id
209       ,program_id
210       ,program_update_date
211       ,attribute_category
212       ,attribute1
213       ,attribute2
214       ,attribute3
215       ,attribute4
216       ,attribute5
217       ,attribute6
218       ,attribute7
219       ,attribute8
220       ,attribute9
221       ,attribute10
222       ,attribute11
223       ,attribute12
224       ,attribute13
225       ,attribute14
226       ,attribute15
227       ,attribute16
228       ,attribute17
229       ,attribute18
230       ,attribute19
231       ,attribute20
232       ,object_version_number
233     from hr_organization_information
234     where   org_information_id = p_org_information_id
235     for  update nowait;
236 --
237   l_proc varchar2(72) := g_package||'lck';
238 --
239 Begin
240   hr_utility.set_location('Entering:'||l_proc, 5);
241   --
242   hr_api.mandatory_arg_error
243     (p_api_name           => l_proc
244     ,p_argument           => 'ORG_INFORMATION_ID'
245     ,p_argument_value     => p_org_information_id
246     );
247   --Bug:1790746 fix Start
248   hr_api.mandatory_arg_error
249     (p_api_name      => l_proc
250     ,p_argument   => 'object_version_number'
251     ,p_argument_value   => p_object_version_number
252      );
253   --Bug:1790746 fix End
254   Open  C_Sel1;
255   Fetch C_Sel1 Into hr_ori_shd.g_old_rec;
256   If C_Sel1%notfound then
257     Close C_Sel1;
258     --
259     -- The primary key is invalid therefore we must error
260     --
261     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
262     fnd_message.raise_error;
263   End If;
264   Close C_Sel1;
265   If (p_object_version_number
266       <> hr_ori_shd.g_old_rec.object_version_number) Then
267         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
268         fnd_message.raise_error;
269   End If;
270   --
271   hr_utility.set_location(' Leaving:'||l_proc, 10);
272   --
273   -- We need to trap the ORA LOCK exception
274   --
275 Exception
276   When HR_Api.Object_Locked then
277     --
278     -- The object is locked therefore we need to supply a meaningful
279     -- error message.
280     --
281     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
282     fnd_message.set_token('TABLE_NAME', 'hr_organization_information');
283     fnd_message.raise_error;
284 End lck;
285 --
286 -- ----------------------------------------------------------------------------
287 -- |-----------------------------< convert_args >-----------------------------|
288 -- ----------------------------------------------------------------------------
289 Function convert_args
290   (p_org_information_id             in number
291   ,p_org_information_context        in varchar2
292   ,p_organization_id                in number
293   ,p_org_information1               in varchar2
294   ,p_org_information10              in varchar2
295   ,p_org_information11              in varchar2
296   ,p_org_information12              in varchar2
297   ,p_org_information13              in varchar2
298   ,p_org_information14              in varchar2
299   ,p_org_information15              in varchar2
300   ,p_org_information16              in varchar2
301   ,p_org_information17              in varchar2
302   ,p_org_information18              in varchar2
303   ,p_org_information19              in varchar2
304   ,p_org_information2               in varchar2
305   ,p_org_information20              in varchar2
306   ,p_org_information3               in varchar2
307   ,p_org_information4               in varchar2
308   ,p_org_information5               in varchar2
309   ,p_org_information6               in varchar2
310   ,p_org_information7               in varchar2
311   ,p_org_information8               in varchar2
312   ,p_org_information9               in varchar2
313   ,p_request_id                     in number
314   ,p_program_application_id         in number
315   ,p_program_id                     in number
316   ,p_program_update_date            in date
317   ,p_attribute_category             in varchar2
318   ,p_attribute1                     in varchar2
319   ,p_attribute2                     in varchar2
320   ,p_attribute3                     in varchar2
321   ,p_attribute4                     in varchar2
322   ,p_attribute5                     in varchar2
323   ,p_attribute6                     in varchar2
324   ,p_attribute7                     in varchar2
325   ,p_attribute8                     in varchar2
326   ,p_attribute9                     in varchar2
327   ,p_attribute10                    in varchar2
328   ,p_attribute11                    in varchar2
329   ,p_attribute12                    in varchar2
330   ,p_attribute13                    in varchar2
331   ,p_attribute14                    in varchar2
332   ,p_attribute15                    in varchar2
333   ,p_attribute16                    in varchar2
334   ,p_attribute17                    in varchar2
335   ,p_attribute18                    in varchar2
336   ,p_attribute19                    in varchar2
337   ,p_attribute20                    in varchar2
338   ,p_object_version_number          in number
339   )
340   Return g_rec_type is
341 --
342   l_rec   g_rec_type;
343 --
344 Begin
345   --
346   -- Convert arguments into local l_rec structure.
347   --
348   l_rec.org_information_id               := p_org_information_id;
349   l_rec.org_information_context          := p_org_information_context;
350   l_rec.organization_id                  := p_organization_id;
351   l_rec.org_information1                 := p_org_information1;
352   l_rec.org_information10                := p_org_information10;
353   l_rec.org_information11                := p_org_information11;
354   l_rec.org_information12                := p_org_information12;
355   l_rec.org_information13                := p_org_information13;
356   l_rec.org_information14                := p_org_information14;
357   l_rec.org_information15                := p_org_information15;
358   l_rec.org_information16                := p_org_information16;
359   l_rec.org_information17                := p_org_information17;
360   l_rec.org_information18                := p_org_information18;
361   l_rec.org_information19                := p_org_information19;
362   l_rec.org_information2                 := p_org_information2;
363   l_rec.org_information20                := p_org_information20;
364   l_rec.org_information3                 := p_org_information3;
365   l_rec.org_information4                 := p_org_information4;
366   l_rec.org_information5                 := p_org_information5;
367   l_rec.org_information6                 := p_org_information6;
368   l_rec.org_information7                 := p_org_information7;
369   l_rec.org_information8                 := p_org_information8;
370   l_rec.org_information9                 := p_org_information9;
371   l_rec.request_id                       := p_request_id;
372   l_rec.program_application_id           := p_program_application_id;
373   l_rec.program_id                       := p_program_id;
374   l_rec.program_update_date              := p_program_update_date;
375   l_rec.attribute_category               := p_attribute_category;
376   l_rec.attribute1                       := p_attribute1;
377   l_rec.attribute2                       := p_attribute2;
378   l_rec.attribute3                       := p_attribute3;
379   l_rec.attribute4                       := p_attribute4;
380   l_rec.attribute5                       := p_attribute5;
381   l_rec.attribute6                       := p_attribute6;
382   l_rec.attribute7                       := p_attribute7;
383   l_rec.attribute8                       := p_attribute8;
384   l_rec.attribute9                       := p_attribute9;
385   l_rec.attribute10                      := p_attribute10;
386   l_rec.attribute11                      := p_attribute11;
387   l_rec.attribute12                      := p_attribute12;
388   l_rec.attribute13                      := p_attribute13;
389   l_rec.attribute14                      := p_attribute14;
390   l_rec.attribute15                      := p_attribute15;
391   l_rec.attribute16                      := p_attribute16;
392   l_rec.attribute17                      := p_attribute17;
393   l_rec.attribute18                      := p_attribute18;
394   l_rec.attribute19                      := p_attribute19;
395   l_rec.attribute20                      := p_attribute20;
396   l_rec.object_version_number            := p_object_version_number;
397   --
398   -- Return the plsql record structure.
399   --
400   Return(l_rec);
401 --
402 End convert_args;
403 --
404 end hr_ori_shd;