DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_ULT_SHD

Source


1 Package Body hxc_ult_shd as
2 /* $Header: hxcultrhi.pkb 120.2 2005/09/23 06:33:16 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_ult_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 
23   If (p_constraint_name = 'HXC_LAYOUTS_TL_FK1') Then
24     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
25     fnd_message.set_token('PROCEDURE', l_proc);
26     fnd_message.set_token('STEP','5');
27     fnd_message.raise_error;
28   ElsIf (p_constraint_name = 'HXC_LAYOUTS_TL_PK') Then
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 = 'HXC_LAYOUTS_TL_UK1') Then
34     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
35     fnd_message.set_token('PROCEDURE', l_proc);
36     fnd_message.set_token('STEP','15');
37     fnd_message.raise_error;
38   Else
39     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
40     fnd_message.set_token('PROCEDURE', l_proc);
41     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
42     fnd_message.raise_error;
43   End If;
44   --
45 End constraint_error;
46 --
47 -- ----------------------------------------------------------------------------
48 -- |-----------------------------< api_updating >-----------------------------|
49 -- ----------------------------------------------------------------------------
50 Function api_updating
51   (p_layout_id                            in     number
52   ,p_language                             in     varchar2
53   )      Return Boolean Is
54 --
55   --
56   -- Cursor selects the 'current' row from the HXC Schema
57   --
58   Cursor C_Sel1 is
59     select
60        layout_id
61       ,display_layout_name
62       ,language
63       ,source_lang
64     from  hxc_layouts_tl
65     where layout_id = p_layout_id
66       AND language = p_language;
67 --
68   l_fct_ret	boolean;
69 --
70 Begin
71   --
72   If (p_layout_id is null OR p_language is null
73      ) Then
74     --
75     -- One of the primary key arguments is null therefore we must
76     -- set the returning function value to false
77     --
78     l_fct_ret := false;
79   Else
80     If (p_layout_id = hxc_ult_shd.g_old_rec.layout_id
81     AND p_language = hxc_ult_shd.g_old_rec.language
82        ) Then
83       --
84       -- The g_old_rec is current therefore we must
85       -- set the returning function to true
86       --
87       l_fct_ret := true;
88     Else
89       --
90       -- Select the current row into g_old_rec
91       --
92       Open C_Sel1;
93       Fetch C_Sel1 Into hxc_ult_shd.g_old_rec;
94       If C_Sel1%notfound Then
95         Close C_Sel1;
96         --
97         -- The primary key is invalid therefore we must error
98         --
99         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
100         fnd_message.raise_error;
101       End If;
102       Close C_Sel1;
103       --
104       l_fct_ret := true;
105     End If;
106   End If;
107   Return (l_fct_ret);
108 --
109 End api_updating;
110 --
111 -- ----------------------------------------------------------------------------
112 -- |---------------------------------< lck >----------------------------------|
113 -- ----------------------------------------------------------------------------
114 Procedure lck
115   (p_layout_id                            in     number
116   ,p_language                             in     varchar2
117   ) is
118 --
119 -- Cursor selects the 'current' row from the HXC Schema
120 --
121   Cursor C_Sel1 is
122     select
123        layout_id
124       ,display_layout_name
125       ,language
126       ,source_lang
127     from	hxc_layouts_tl
128     WHERE layout_id = p_layout_id
129       AND language = p_language
130     for	update nowait;
131 --
132   l_proc	varchar2(72) ;
133 --
134 Begin
135   g_debug :=hr_utility.debug_enabled;
136   if g_debug then
137   	l_proc := g_package||'lck';
138   	hr_utility.set_location('Entering:'||l_proc, 5);
139   end if;
140   --
141   hr_api.mandatory_arg_error
142     (p_api_name           => l_proc
143     ,p_argument           => 'LAYOUT_ID'
144     ,p_argument_value     => p_layout_id
145     );
146   if g_debug then
147   	hr_utility.set_location(l_proc,6);
148   end if;
149   hr_api.mandatory_arg_error
150     (p_api_name           => l_proc
151     ,p_argument           => 'LANGUAGE'
152     ,p_argument_value     => p_language
153     );
154   --
155   Open  C_Sel1;
156   Fetch C_Sel1 Into hxc_ult_shd.g_old_rec;
157   If C_Sel1%notfound then
158     Close C_Sel1;
159     --
160     -- The primary key is invalid therefore we must error
161     --
162     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
163     fnd_message.raise_error;
164   End If;
165   Close C_Sel1;
166   --
167   --
168   if g_debug then
169   	hr_utility.set_location(' Leaving:'||l_proc, 10);
170   end if;
171   --
172   -- We need to trap the ORA LOCK exception
173   --
174 Exception
175   When HR_Api.Object_Locked then
176     --
177     -- The object is locked therefore we need to supply a meaningful
178     -- error message.
179     --
180     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
181     fnd_message.set_token('TABLE_NAME', 'hxc_layouts_tl');
182     fnd_message.raise_error;
183 End lck;
184 --
185 -- ----------------------------------------------------------------------------
186 -- |----------------------------< add_language >------------------------------|
187 -- ----------------------------------------------------------------------------
188 --
189 -- EDIT_HERE:  Execute AOL's tltblgen(UNIX) program to generate the
190 --             ADD_LANGUAGE procedure.  Only the add_language procedure
191 --             should be added here.  Remove the following skeleton
192 --             procedure.
193 --
194 -- ----------------------------------------------------------------------------
195 PROCEDURE add_language IS
196 Begin
197   --
198   delete from hxc_layouts_tl t
199    where not exists
200       (select null
201          from hxc_layouts b
202         where b.layout_id = t.layout_id
203       );
204   --
205   update hxc_layouts_tl t
206   set (display_layout_name) =
207       (select b.display_layout_name
208          from hxc_layouts_tl b
209         where b.layout_id = t.layout_id
210           and b.language = t.source_lang)
211   where (t.layout_id
212         ,t.language)
213      in (select subt.layout_id
214                ,subt.language
215            from hxc_layouts_tl subb
216                ,hxc_layouts_tl subt
217           where subb.layout_id = subt.layout_id
218             and subb.language = subt.source_lang
219             and subb.display_layout_name <> subt.display_layout_name
220         );
221   --
222   insert into hxc_layouts_tl
223    (layout_id
224    ,display_layout_name
225    ,language
226    ,source_lang
227    ,last_update_date
228    ,last_updated_by
229    ,last_update_login
230    ,created_by
231    ,creation_date
232    )
233    select b.layout_id
234          ,b.display_layout_name
235          ,l.language_code
236          ,b.source_lang
237          ,b.last_update_date
238          ,b.last_updated_by
239          ,b.last_update_login
240          ,b.created_by
241          ,b.creation_date
242     from hxc_layouts_tl b
243         ,fnd_languages l
244    where l.installed_flag in ('I', 'B')
245      and b.language = userenv('LANG')
246      and not exists
247         (select null
248            from hxc_layouts_tl t
249           where t.layout_id = b.layout_id
250             and t.language = l.language_code
251         );
252   --
253 End;
254 --
255 -- ----------------------------------------------------------------------------
256 -- |-----------------------------< convert_args >-----------------------------|
257 -- ----------------------------------------------------------------------------
258 Function convert_args
259   (p_layout_id                      in number
260   ,p_display_layout_name            in varchar2
261   ,p_language                       in varchar2
262   ,p_source_lang                    in varchar2
263   )
264   Return g_rec_type is
265 --
266   l_rec   g_rec_type;
267 --
268 Begin
269   --
270   -- Convert arguments into local l_rec structure.
271   --
272   l_rec.layout_id                        := p_layout_id;
273   l_rec.display_layout_name              := p_display_layout_name;
274   l_rec.language                         := p_language;
275   l_rec.source_lang                      := p_source_lang;
276   --
277   -- Return the plsql record structure.
278   --
279   Return(l_rec);
280 --
281 End convert_args;
282 --
283 end hxc_ult_shd;