DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_CNP_SHD

Source


1 Package Body hr_cnp_shd as
2 /* $Header: hrcnprhi.pkb 115.3 2003/09/01 03:40:09 bsubrama noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_cnp_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 = 'HR_CANVAS_PROPERTIES_B_PK') Then
22     -- Primary key constraint validated (canvas_property_id)
23     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
24     fnd_message.set_token('PROCEDURE', l_proc);
25     fnd_message.set_token('STEP','5');
26     fnd_message.raise_error;
27   ElsIf (p_constraint_name = 'HR_CANVAS_PROPERTIES_B_UK') Then
28     -- Unique key constraint violated (form_canvas_id, template_canvas_id)
29     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
30     fnd_message.set_token('PROCEDURE', l_proc);
31     fnd_message.set_token('STEP','10');
32     fnd_message.raise_error;
33   ElsIf (p_constraint_name = 'HR_CANVAS_PROPERTIES_FK1') Then
34     -- Foreign key (parent) constraint violated (form_canvas_id)
35     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
36     fnd_message.set_token('PROCEDURE', l_proc);
37     fnd_message.set_token('STEP','15');
38     fnd_message.raise_error;
39   ElsIf (p_constraint_name = 'HR_CANVAS_PROPERTIES_FK2') Then
40     -- Foreign key (parent) constraint violated (template_canvas_id)
41     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
42     fnd_message.set_token('PROCEDURE', l_proc);
43     fnd_message.set_token('STEP','20');
44     fnd_message.raise_error;
45   Else
46     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
47     fnd_message.set_token('PROCEDURE', l_proc);
48     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
49     fnd_message.raise_error;
50   End If;
51   --
52 End constraint_error;
53 --
54 -- ----------------------------------------------------------------------------
55 -- |-----------------------------< api_updating >-----------------------------|
56 -- ----------------------------------------------------------------------------
57 Function api_updating
58   (p_canvas_property_id                   in     number,
59    p_object_version_number                in     number
60   )
61   Return Boolean Is
62 --
63   --
64   -- Cursor selects the 'current' row from the HR Schema
65   --
66   Cursor C_Sel1 is
67     select
68        canvas_property_id
69       ,object_version_number
70       ,form_canvas_id
71       ,template_canvas_id
72       ,height
73       ,visible
74       ,width
75       ,x_position
76       ,y_position
77       ,information_category
78       ,information1
79       ,information2
80       ,information3
81       ,information4
82       ,information5
83       ,information6
84       ,information7
85       ,information8
86       ,information9
87       ,information10
88       ,information11
89       ,information12
90       ,information13
91       ,information14
92       ,information15
93       ,information16
94       ,information17
95       ,information18
96       ,information19
97       ,information20
98       ,information21
99       ,information22
100       ,information23
101       ,information24
102       ,information25
103       ,information26
104       ,information27
105       ,information28
106       ,information29
107       ,information30
108     from  hr_canvas_properties
109     where canvas_property_id = p_canvas_property_id;
110 --
111   l_fct_ret boolean;
112 --
113 Begin
114   --
115   If (p_canvas_property_id is null and
116       p_object_version_number is null
117      ) Then
118     --
119     -- One of the primary key arguments is null therefore we must
120     -- set the returning function value to false
121     --
122     l_fct_ret := false;
123   Else
124     If (p_canvas_property_id
125         = hr_cnp_shd.g_old_rec.canvas_property_id and
126         p_object_version_number
127         = hr_tdg_shd.g_old_rec.object_version_number
128        ) Then
129       --
130       -- The g_old_rec is current therefore we must
131       -- set the returning function to true
132       --
133       l_fct_ret := true;
134     Else
135       --
136       -- Select the current row into g_old_rec
137       --
138       Open C_Sel1;
139       Fetch C_Sel1 Into hr_cnp_shd.g_old_rec;
140       If C_Sel1%notfound Then
141         Close C_Sel1;
142         --
143         -- The primary key is invalid therefore we must error
144         --
145         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
146         fnd_message.raise_error;
147       End If;
148       Close C_Sel1;
149       --
150       If (p_object_version_number
151           <> hr_tdg_shd.g_old_rec.object_version_number) Then
152         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
153         fnd_message.raise_error;
154       End If;
155       l_fct_ret := true;
156     End If;
157   End If;
158   Return (l_fct_ret);
159 --
160 End api_updating;
161 --
162 -- ----------------------------------------------------------------------------
163 -- |---------------------------------< lck >----------------------------------|
164 -- ----------------------------------------------------------------------------
165 Procedure lck
166   (p_canvas_property_id                   in     number
167   ,p_object_version_number                in     number
168   ) is
169 --
170 -- Cursor selects the 'current' row from the HR Schema
171 --
172   Cursor C_Sel1 is
173     select
174        canvas_property_id
175       ,object_version_number
176       ,form_canvas_id
177       ,template_canvas_id
178       ,height
179       ,visible
180       ,width
181       ,x_position
182       ,y_position
183       ,information_category
184       ,information1
185       ,information2
186       ,information3
187       ,information4
188       ,information5
189       ,information6
190       ,information7
191       ,information8
192       ,information9
193       ,information10
194       ,information11
195       ,information12
196       ,information13
197       ,information14
198       ,information15
199       ,information16
200       ,information17
201       ,information18
202       ,information19
203       ,information20
204       ,information21
205       ,information22
206       ,information23
207       ,information24
208       ,information25
209       ,information26
210       ,information27
211       ,information28
212       ,information29
213       ,information30
214     from  hr_canvas_properties
215     where canvas_property_id = p_canvas_property_id
216     for update nowait;
217 --
218   l_proc  varchar2(72) := g_package||'lck';
219 --
220 Begin
221   hr_utility.set_location('Entering:'||l_proc, 5);
222   --
223   hr_api.mandatory_arg_error
224     (p_api_name           => l_proc
225     ,p_argument           => 'CANVAS_PROPERTY_ID'
226     ,p_argument_value     => p_canvas_property_id
227     );
228   --
229   hr_api.mandatory_arg_error
230     (p_api_name           => l_proc
231     ,p_argument           => 'OBJECT_VERSION_NUMBER'
232     ,p_argument_value     => p_object_version_number
233     );
234   Open  C_Sel1;
235   Fetch C_Sel1 Into hr_cnp_shd.g_old_rec;
236   If C_Sel1%notfound then
237     Close C_Sel1;
238     --
239     -- The primary key is invalid therefore we must error
240     --
241     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
242     fnd_message.raise_error;
243   End If;
244   Close C_Sel1;
245   --
246   If (p_object_version_number
247       <> hr_tdg_shd.g_old_rec.object_version_number) Then
248         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
249         fnd_message.raise_error;
250   End If;
251   --
252   hr_utility.set_location(' Leaving:'||l_proc, 10);
253   --
254   -- We need to trap the ORA LOCK exception
255   --
256 Exception
257   When HR_Api.Object_Locked then
258     --
259     -- The object is locked therefore we need to supply a meaningful
260     -- error message.
261     --
262     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
263     fnd_message.set_token('TABLE_NAME', 'hr_canvas_properties');
264     fnd_message.raise_error;
265 End lck;
266 --
267 -- ----------------------------------------------------------------------------
268 -- |-----------------------------< convert_args >-----------------------------|
269 -- ----------------------------------------------------------------------------
270 Function convert_args
271   (p_canvas_property_id             in number
272   ,p_object_version_number          in number
273   ,p_form_canvas_id                 in number
274   ,p_template_canvas_id             in number
275   ,p_height                         in number
276   ,p_visible                        in number
277   ,p_width                          in number
278   ,p_x_position                     in number
279   ,p_y_position                     in number
280   ,p_information_category           in varchar2
281   ,p_information1                   in varchar2
282   ,p_information2                   in varchar2
283   ,p_information3                   in varchar2
284   ,p_information4                   in varchar2
285   ,p_information5                   in varchar2
286   ,p_information6                   in varchar2
287   ,p_information7                   in varchar2
288   ,p_information8                   in varchar2
289   ,p_information9                   in varchar2
290   ,p_information10                  in varchar2
291   ,p_information11                  in varchar2
292   ,p_information12                  in varchar2
293   ,p_information13                  in varchar2
294   ,p_information14                  in varchar2
295   ,p_information15                  in varchar2
296   ,p_information16                  in varchar2
297   ,p_information17                  in varchar2
298   ,p_information18                  in varchar2
299   ,p_information19                  in varchar2
300   ,p_information20                  in varchar2
301   ,p_information21                  in varchar2
302   ,p_information22                  in varchar2
303   ,p_information23                  in varchar2
304   ,p_information24                  in varchar2
305   ,p_information25                  in varchar2
306   ,p_information26                  in varchar2
307   ,p_information27                  in varchar2
308   ,p_information28                  in varchar2
309   ,p_information29                  in varchar2
310   ,p_information30                  in varchar2
311   )
312   Return g_rec_type is
313 --
314   l_rec   g_rec_type;
315 --
316 Begin
317   --
318   -- Convert arguments into local l_rec structure.
319   --
320   l_rec.canvas_property_id               := p_canvas_property_id;
321   l_rec.object_version_number            := p_object_version_number;
322   l_rec.form_canvas_id                   := p_form_canvas_id;
323   l_rec.template_canvas_id               := p_template_canvas_id;
324   l_rec.height                           := p_height;
325   l_rec.visible                          := p_visible;
326   l_rec.width                            := p_width;
327   l_rec.x_position                       := p_x_position;
328   l_rec.y_position                       := p_y_position;
329   l_rec.information_category             := p_information_category;
330   l_rec.information1                     := p_information1;
331   l_rec.information2                     := p_information2;
332   l_rec.information3                     := p_information3;
333   l_rec.information4                     := p_information4;
334   l_rec.information5                     := p_information5;
335   l_rec.information6                     := p_information6;
336   l_rec.information7                     := p_information7;
337   l_rec.information8                     := p_information8;
338   l_rec.information9                     := p_information9;
339   l_rec.information10                    := p_information10;
340   l_rec.information11                    := p_information11;
341   l_rec.information12                    := p_information12;
342   l_rec.information13                    := p_information13;
343   l_rec.information14                    := p_information14;
344   l_rec.information15                    := p_information15;
345   l_rec.information16                    := p_information16;
346   l_rec.information17                    := p_information17;
347   l_rec.information18                    := p_information18;
348   l_rec.information19                    := p_information19;
349   l_rec.information20                    := p_information20;
350   l_rec.information21                    := p_information21;
351   l_rec.information22                    := p_information22;
352   l_rec.information23                    := p_information23;
353   l_rec.information24                    := p_information24;
354   l_rec.information25                    := p_information25;
355   l_rec.information26                    := p_information26;
356   l_rec.information27                    := p_information27;
357   l_rec.information28                    := p_information28;
358   l_rec.information29                    := p_information29;
359   l_rec.information30                    := p_information30;
360   --
361   -- Return the plsql record structure.
362   --
363   Return(l_rec);
364 --
365 End convert_args;
366 --
367 end hr_cnp_shd;