DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_HAV_SHD

Source


1 Package Body hxc_hav_shd as
2 /* $Header: hxchavrhi.pkb 120.2 2005/09/23 10:41:41 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_hav_shd.';  -- Global package name
9 g_debug	boolean:=hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15   (p_constraint_name in all_constraints.constraint_name%TYPE
16   ) Is
17 --
18   l_proc 	varchar2(72) := g_package||'constraint_error';
19 --
20 Begin
21   --
22   If (p_constraint_name = 'HXC_ALIAS_VALUES_FK1') Then
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 = 'HXC_ALIAS_VALUES_PK') Then
28     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
29     fnd_message.set_token('PROCEDURE', l_proc);
30     fnd_message.set_token('STEP','10');
31     fnd_message.raise_error;
32   ElsIf (p_constraint_name = 'HXC_ALIAS_VALUES_UK2') 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','15');
36     fnd_message.raise_error;
37   Else
38     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
41     fnd_message.raise_error;
42   End If;
43   --
44 End constraint_error;
45 --
46 -- ----------------------------------------------------------------------------
47 -- |-----------------------------< api_updating >-----------------------------|
48 -- ----------------------------------------------------------------------------
49 Function api_updating
50   (p_alias_value_id                       in     number
51   ,p_object_version_number                in     number
52   )
53   Return Boolean Is
54 --
55   --
56   -- Cursor selects the 'current' row from the HR Schema
57   --
58   Cursor C_Sel1 is
59     select
60        hav.alias_value_id
61       ,havt.alias_value_name
62       ,hav.date_from
63       ,hav.date_to
64       ,alias_definition_id
65       ,enabled_flag
66       ,attribute_category
67       ,attribute1
68       ,attribute2
69       ,attribute3
70       ,attribute4
71       ,attribute5
72       ,attribute6
73       ,attribute7
74       ,attribute8
75       ,attribute9
76       ,attribute10
77       ,attribute11
78       ,attribute12
79       ,attribute13
80       ,attribute14
81       ,attribute15
82       ,attribute16
83       ,attribute17
84       ,attribute18
85       ,attribute19
86       ,attribute20
87       ,attribute21
88       ,attribute22
89       ,attribute23
90       ,attribute24
91       ,attribute25
92       ,attribute26
93       ,attribute27
94       ,attribute28
95       ,attribute29
96       ,attribute30
97       ,object_version_number
98     from	hxc_alias_values hav,
99      		hxc_alias_values_tl  havt
100     where	hav.alias_value_id = p_alias_value_id
101     and   	havt.language = USERENV('LANG')
102     and   	havt.alias_value_id = hav.alias_value_id;
103 --
104   l_fct_ret	boolean;
105 --
106 Begin
107   --
108   If (p_alias_value_id is null and
109       p_object_version_number is null
110      ) Then
111     --
112     -- One of the primary key arguments is null therefore we must
113     -- set the returning function value to false
114     --
115     l_fct_ret := false;
116   Else
117     If (p_alias_value_id
118         = hxc_hav_shd.g_old_rec.alias_value_id and
119         p_object_version_number
120         = hxc_hav_shd.g_old_rec.object_version_number
121        ) Then
122       --
123       -- The g_old_rec is current therefore we must
124       -- set the returning function to true
125       --
126       l_fct_ret := true;
127     Else
128       --
129       -- Select the current row into g_old_rec
130       --
131       Open C_Sel1;
132       Fetch C_Sel1 Into hxc_hav_shd.g_old_rec;
133       If C_Sel1%notfound Then
134         Close C_Sel1;
135         --
136         -- The primary key is invalid therefore we must error
137         --
138         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
139         fnd_message.raise_error;
140       End If;
141       Close C_Sel1;
142       If (p_object_version_number
143           <> hxc_hav_shd.g_old_rec.object_version_number) Then
144         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
145         fnd_message.raise_error;
146       End If;
147       l_fct_ret := true;
148     End If;
149   End If;
150   Return (l_fct_ret);
151 --
152 End api_updating;
153 --
154 -- ----------------------------------------------------------------------------
155 -- |---------------------------------< lck >----------------------------------|
156 -- ----------------------------------------------------------------------------
157 Procedure lck
158   (p_alias_value_id                       in     number
159   ,p_object_version_number                in     number
160   ) is
161 --
162 -- Cursor selects the 'current' row from the HR Schema
163 --
164   Cursor C_Sel1 is
165     select
166        hav.alias_value_id
167       ,havt.alias_value_name
168       ,hav.date_from
169       ,hav.date_to
170       ,alias_definition_id
171       ,enabled_flag
172       ,attribute_category
173       ,attribute1
174       ,attribute2
175       ,attribute3
176       ,attribute4
177       ,attribute5
178       ,attribute6
179       ,attribute7
180       ,attribute8
181       ,attribute9
182       ,attribute10
183       ,attribute11
184       ,attribute12
185       ,attribute13
186       ,attribute14
187       ,attribute15
188       ,attribute16
189       ,attribute17
190       ,attribute18
191       ,attribute19
192       ,attribute20
193       ,attribute21
194       ,attribute22
195       ,attribute23
196       ,attribute24
197       ,attribute25
198       ,attribute26
199       ,attribute27
200       ,attribute28
201       ,attribute29
202       ,attribute30
203       ,object_version_number
204     from	hxc_alias_values hav,
205      		hxc_alias_values_tl  havt
206     where	hav.alias_value_id = p_alias_value_id
207     and   	havt.language = USERENV('LANG')
208     and   	havt.alias_value_id = hav.alias_value_id
209     for	update nowait;
210 --
211   l_proc	varchar2(72);
212 --
213 Begin
214   g_debug:=hr_utility.debug_enabled;
215   if g_debug then
216 	l_proc := g_package||'lck';
217 	hr_utility.set_location('Entering:'||l_proc, 5);
218   end if;
219   --
220   hr_api.mandatory_arg_error
221     (p_api_name           => l_proc
222     ,p_argument           => 'ALIAS_VALUE_ID'
223     ,p_argument_value     => p_alias_value_id
224     );
225   --
226   Open  C_Sel1;
227   Fetch C_Sel1 Into hxc_hav_shd.g_old_rec;
228   If C_Sel1%notfound then
229     Close C_Sel1;
230     --
231     -- The primary key is invalid therefore we must error
232     --
233     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
234     fnd_message.raise_error;
235   End If;
236   Close C_Sel1;
237   If (p_object_version_number
238       <> hxc_hav_shd.g_old_rec.object_version_number) Then
239         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
240         fnd_message.raise_error;
241   End If;
242   --
243   if g_debug then
244 	hr_utility.set_location(' Leaving:'||l_proc, 10);
245   end if;
246   --
247   -- We need to trap the ORA LOCK exception
248   --
249 Exception
250   When HR_Api.Object_Locked then
251     --
252     -- The object is locked therefore we need to supply a meaningful
253     -- error message.
254     --
255     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
256     fnd_message.set_token('TABLE_NAME', 'hxc_alias_values');
257     fnd_message.raise_error;
258 End lck;
259 --
260 -- ----------------------------------------------------------------------------
261 -- |-----------------------------< convert_args >-----------------------------|
262 -- ----------------------------------------------------------------------------
263 Function convert_args
264   (p_alias_value_id                 in number
265   ,p_alias_value_name               in varchar2
266   ,p_date_from                      in date
267   ,p_date_to                        in date
268   ,p_alias_definition_id            in number
269   ,p_enabled_flag                   in varchar2
270   ,p_attribute_category             in varchar2
271   ,p_attribute1                     in varchar2
272   ,p_attribute2                     in varchar2
273   ,p_attribute3                     in varchar2
274   ,p_attribute4                     in varchar2
275   ,p_attribute5                     in varchar2
276   ,p_attribute6                     in varchar2
277   ,p_attribute7                     in varchar2
278   ,p_attribute8                     in varchar2
279   ,p_attribute9                     in varchar2
280   ,p_attribute10                    in varchar2
281   ,p_attribute11                    in varchar2
282   ,p_attribute12                    in varchar2
283   ,p_attribute13                    in varchar2
284   ,p_attribute14                    in varchar2
285   ,p_attribute15                    in varchar2
286   ,p_attribute16                    in varchar2
287   ,p_attribute17                    in varchar2
288   ,p_attribute18                    in varchar2
289   ,p_attribute19                    in varchar2
290   ,p_attribute20                    in varchar2
291   ,p_attribute21                    in varchar2
292   ,p_attribute22                    in varchar2
293   ,p_attribute23                    in varchar2
294   ,p_attribute24                    in varchar2
295   ,p_attribute25                    in varchar2
296   ,p_attribute26                    in varchar2
297   ,p_attribute27                    in varchar2
298   ,p_attribute28                    in varchar2
299   ,p_attribute29                    in varchar2
300   ,p_attribute30                    in varchar2
301   ,p_object_version_number          in number
302   )
303   Return g_rec_type is
304 --
305   l_rec   g_rec_type;
306 --
307 Begin
308   --
309   -- Convert arguments into local l_rec structure.
310   --
311   l_rec.alias_value_id                   := p_alias_value_id;
312   l_rec.alias_value_name                 := p_alias_value_name;
313   l_rec.date_from                        := p_date_from;
314   l_rec.date_to                          := p_date_to;
315   l_rec.alias_definition_id              := p_alias_definition_id;
316   l_rec.enabled_flag                     := p_enabled_flag;
317   l_rec.attribute_category               := p_attribute_category;
318   l_rec.attribute1                       := p_attribute1;
319   l_rec.attribute2                       := p_attribute2;
320   l_rec.attribute3                       := p_attribute3;
321   l_rec.attribute4                       := p_attribute4;
322   l_rec.attribute5                       := p_attribute5;
323   l_rec.attribute6                       := p_attribute6;
324   l_rec.attribute7                       := p_attribute7;
325   l_rec.attribute8                       := p_attribute8;
326   l_rec.attribute9                       := p_attribute9;
327   l_rec.attribute10                      := p_attribute10;
328   l_rec.attribute11                      := p_attribute11;
329   l_rec.attribute12                      := p_attribute12;
330   l_rec.attribute13                      := p_attribute13;
331   l_rec.attribute14                      := p_attribute14;
332   l_rec.attribute15                      := p_attribute15;
333   l_rec.attribute16                      := p_attribute16;
334   l_rec.attribute17                      := p_attribute17;
335   l_rec.attribute18                      := p_attribute18;
336   l_rec.attribute19                      := p_attribute19;
337   l_rec.attribute20                      := p_attribute20;
338   l_rec.attribute21                      := p_attribute21;
339   l_rec.attribute22                      := p_attribute22;
340   l_rec.attribute23                      := p_attribute23;
341   l_rec.attribute24                      := p_attribute24;
342   l_rec.attribute25                      := p_attribute25;
343   l_rec.attribute26                      := p_attribute26;
344   l_rec.attribute27                      := p_attribute27;
345   l_rec.attribute28                      := p_attribute28;
346   l_rec.attribute29                      := p_attribute29;
347   l_rec.attribute30                      := p_attribute30;
348   l_rec.object_version_number            := p_object_version_number;
349   --
350   -- Return the plsql record structure.
351   --
352   Return(l_rec);
353 --
354 End convert_args;
355 --
356 end hxc_hav_shd;