[Home] [Help]
PACKAGE BODY: APPS.OTA_LPT_SHD
Source
1 Package Body ota_lpt_shd as
2 /* $Header: otlptrhi.pkb 120.0 2005/05/29 07:24:49 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_lpt_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 = 'OTA_LEARNING_PATHS_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_learning_path_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 learning_path_id
49 ,language
50 ,name
51 ,description
52 ,objectives
53 ,purpose
54 ,keywords
55 ,source_lang
56 from ota_learning_paths_tl
57 where learning_path_id = p_learning_path_id
58 and language = p_language;
59 --
60 l_fct_ret boolean;
61 --
62 Begin
63 --
64 If (p_learning_path_id is null or
65 p_language is null
66 ) Then
67 --
68 -- One of the primary key arguments is null therefore we must
69 -- set the returning function value to false
70 --
71 l_fct_ret := false;
72 Else
73 If (p_learning_path_id
74 = ota_lpt_shd.g_old_rec.learning_path_id and
75 p_language
76 = ota_lpt_shd.g_old_rec.language
77 ) Then
78 --
79 -- The g_old_rec is current therefore we must
80 -- set the returning function to true
81 --
82 l_fct_ret := true;
83 Else
84 --
85 -- Select the current row into g_old_rec
86 --
87 Open C_Sel1;
88 Fetch C_Sel1 Into ota_lpt_shd.g_old_rec;
89 If C_Sel1%notfound Then
90 Close C_Sel1;
91 --
92 -- The primary key is invalid therefore we must error
93 --
94 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
95 fnd_message.raise_error;
96 End If;
97 Close C_Sel1;
98 --
99 l_fct_ret := true;
100 End If;
101 End If;
102 Return (l_fct_ret);
103 --
104 End api_updating;
105 --
106 -- ----------------------------------------------------------------------------
107 -- |---------------------------------< lck >----------------------------------|
108 -- ----------------------------------------------------------------------------
109 Procedure lck
110 (p_learning_path_id in number
111 ,p_language in varchar2
112 ) is
113 --
114 -- Cursor selects the 'current' row from the HR Schema
115 --
116 Cursor C_Sel1 is
117 select
118 learning_path_id
119 ,language
120 ,name
121 ,description
122 ,objectives
123 ,purpose
124 ,keywords
125 ,source_lang
126 from ota_learning_paths_tl
127 where learning_path_id = p_learning_path_id
128 and language = p_language
129 for update nowait;
130 --
131 l_proc varchar2(72) := g_package||'lck';
132 --
133 Begin
134 hr_utility.set_location('Entering:'||l_proc, 5);
135 --
136 hr_api.mandatory_arg_error
137 (p_api_name => l_proc
138 ,p_argument => 'LEARNING_PATH_ID'
139 ,p_argument_value => p_learning_path_id
140 );
141 hr_utility.set_location(l_proc,6);
142 hr_api.mandatory_arg_error
143 (p_api_name => l_proc
144 ,p_argument => 'LANGUAGE'
145 ,p_argument_value => p_language
146 );
147 --
148 Open C_Sel1;
149 Fetch C_Sel1 Into ota_lpt_shd.g_old_rec;
150 If C_Sel1%notfound then
151 Close C_Sel1;
152 --
153 -- The primary key is invalid therefore we must error
154 --
155 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
156 fnd_message.raise_error;
157 End If;
158 Close C_Sel1;
159 --
160 --
161 hr_utility.set_location(' Leaving:'||l_proc, 10);
162 --
163 -- We need to trap the ORA LOCK exception
164 --
165 Exception
166 When HR_Api.Object_Locked then
167 --
168 -- The object is locked therefore we need to supply a meaningful
169 -- error message.
170 --
171 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
172 fnd_message.set_token('TABLE_NAME', 'ota_learning_paths_tl');
173 fnd_message.raise_error;
174 End lck;
175 --
176 -- ----------------------------------------------------------------------------
177 -- |----------------------------< add_language >------------------------------|
178 -- ----------------------------------------------------------------------------
179 --
180 -- Executed AOL's tltblgen(UNIX) program to generate the
181 -- ADD_LANGUAGE procedure.
182 --
183 -- ----------------------------------------------------------------------------
184 procedure ADD_LANGUAGE
185 is
186 begin
187 delete from OTA_LEARNING_PATHS_TL T
188 where not exists
189 (select NULL
190 from OTA_LEARNING_PATHS B
191 where B.LEARNING_PATH_ID = T.LEARNING_PATH_ID
192 );
193
194 update OTA_LEARNING_PATHS_TL T set (
195 NAME,
196 DESCRIPTION,
197 OBJECTIVES,
198 PURPOSE,
199 KEYWORDS
200 ) = (select
201 B.NAME,
202 B.DESCRIPTION,
203 B.OBJECTIVES,
204 B.PURPOSE,
205 B.KEYWORDS
206 from OTA_LEARNING_PATHS_TL B
207 where B.LEARNING_PATH_ID = T.LEARNING_PATH_ID
208 and B.LANGUAGE = T.SOURCE_LANG)
209 where (
210 T.LEARNING_PATH_ID,
211 T.LANGUAGE
212 ) in (select
213 SUBT.LEARNING_PATH_ID,
214 SUBT.LANGUAGE
215 from OTA_LEARNING_PATHS_TL SUBB, OTA_LEARNING_PATHS_TL SUBT
216 where SUBB.LEARNING_PATH_ID = SUBT.LEARNING_PATH_ID
217 and SUBB.LANGUAGE = SUBT.SOURCE_LANG
218 and (SUBB.NAME <> SUBT.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 or SUBB.OBJECTIVES <> SUBT.OBJECTIVES
223 or (SUBB.OBJECTIVES is null and SUBT.OBJECTIVES is not null)
224 or (SUBB.OBJECTIVES is not null and SUBT.OBJECTIVES is null)
225 or SUBB.PURPOSE <> SUBT.PURPOSE
226 or (SUBB.PURPOSE is null and SUBT.PURPOSE is not null)
227 or (SUBB.PURPOSE is not null and SUBT.PURPOSE is null)
228 or SUBB.KEYWORDS <> SUBT.KEYWORDS
229 or (SUBB.KEYWORDS is null and SUBT.KEYWORDS is not null)
230 or (SUBB.KEYWORDS is not null and SUBT.KEYWORDS is null)
231 ));
232
233 insert into OTA_LEARNING_PATHS_TL (
234 LEARNING_PATH_ID,
235 NAME,
236 DESCRIPTION,
237 OBJECTIVES,
238 PURPOSE,
239 KEYWORDS,
240 CREATED_BY,
241 CREATION_DATE,
242 LAST_UPDATE_DATE,
243 LAST_UPDATED_BY,
244 LAST_UPDATE_LOGIN,
245 LANGUAGE,
246 SOURCE_LANG
247 ) select
248 B.LEARNING_PATH_ID,
249 B.NAME,
250 B.DESCRIPTION,
251 B.OBJECTIVES,
252 B.PURPOSE,
253 B.KEYWORDS,
254 B.CREATED_BY,
255 B.CREATION_DATE,
256 B.LAST_UPDATE_DATE,
257 B.LAST_UPDATED_BY,
258 B.LAST_UPDATE_LOGIN,
259 L.LANGUAGE_CODE,
260 B.SOURCE_LANG
261 from OTA_LEARNING_PATHS_TL B, FND_LANGUAGES L
262 where L.INSTALLED_FLAG in ('I', 'B')
263 and B.LANGUAGE = userenv('LANG')
264 and not exists
265 (select NULL
266 from OTA_LEARNING_PATHS_TL T
267 where T.LEARNING_PATH_ID = B.LEARNING_PATH_ID
268 and T.LANGUAGE = L.LANGUAGE_CODE);
269 end ADD_LANGUAGE;
270 --
271 -- ----------------------------------------------------------------------------
272 -- |-----------------------------< convert_args >-----------------------------|
273 -- ----------------------------------------------------------------------------
274 Function convert_args
275 (p_learning_path_id in number
276 ,p_language in varchar2
277 ,p_name in varchar2
278 ,p_description in varchar2
279 ,p_objectives in varchar2
280 ,p_purpose in varchar2
281 ,p_keywords in varchar2
282 ,p_source_lang in varchar2
283 )
284 Return g_rec_type is
285 --
286 l_rec g_rec_type;
287 --
288 Begin
289 --
290 -- Convert arguments into local l_rec structure.
291 --
292 l_rec.learning_path_id := p_learning_path_id;
293 l_rec.language := p_language;
294 l_rec.name := p_name;
295 l_rec.description := p_description;
296 l_rec.objectives := p_objectives;
297 l_rec.purpose := p_purpose;
298 l_rec.keywords := p_keywords;
299 l_rec.source_lang := p_source_lang;
300 --
301 -- Return the plsql record structure.
302 --
303 Return(l_rec);
304 --
305 End convert_args;
306 --
307 end ota_lpt_shd;