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