DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_DTL_SHD

Source


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