[Home] [Help]
PACKAGE BODY: APPS.OTA_AVT_SHD
Source
1 Package Body ota_avt_shd as
2 /* $Header: otavtrhi.pkb 120.0 2005/05/29 07:02:16 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ota_avt_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_ACTIVITY_VERSIONS_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_activity_version_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 activity_version_id
49 ,language
50 ,source_lang
51 ,version_name
52 ,description
53 ,intended_audience
54 ,objectives
55 ,keywords
56 from ota_activity_versions_tl
57 where activity_version_id = p_activity_version_id
58 and language = p_language;
59 --
60 l_fct_ret boolean;
61 --
62 Begin
63 --
64 If (p_activity_version_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_activity_version_id
74 = ota_avt_shd.g_old_rec.activity_version_id and
75 p_language
76 = ota_avt_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
84 --
81 --
82 l_fct_ret := true;
83 Else
85 -- Select the current row into g_old_rec
86 --
87 Open C_Sel1;
88 Fetch C_Sel1 Into ota_avt_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_activity_version_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 activity_version_id
119 ,language
120 ,source_lang
121 ,version_name
122 ,description
123 ,intended_audience
124 ,objectives
125 ,keywords
126 from ota_activity_versions_tl
127 where activity_version_id = p_activity_version_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 => 'ACTIVITY_VERSION_ID'
139 ,p_argument_value => p_activity_version_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_avt_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_activity_versions_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. Only the add_language procedure added here.
182 --
183 -- ----------------------------------------------------------------------------
184 procedure ADD_LANGUAGE
185 is
186 begin
187 delete from OTA_ACTIVITY_VERSIONS_TL T
188 where not exists
189 (select NULL
190 from OTA_ACTIVITY_VERSIONS B
191 where B.ACTIVITY_VERSION_ID = T.ACTIVITY_VERSION_ID
192 );
193
194 update OTA_ACTIVITY_VERSIONS_TL T set (
195 VERSION_NAME,
196 DESCRIPTION,
197 INTENDED_AUDIENCE,
198 OBJECTIVES,
199 KEYWORDS
200 ) = (select
201 B.VERSION_NAME,
202 B.DESCRIPTION,
203 B.INTENDED_AUDIENCE,
204 B.OBJECTIVES,
205 B.KEYWORDS
206 from OTA_ACTIVITY_VERSIONS_TL B
207 where B.ACTIVITY_VERSION_ID = T.ACTIVITY_VERSION_ID
208 and B.LANGUAGE = T.SOURCE_LANG)
209 where (
210 T.ACTIVITY_VERSION_ID,
211 T.LANGUAGE
212 ) in (select
213 SUBT.ACTIVITY_VERSION_ID,
214 SUBT.LANGUAGE
215 from OTA_ACTIVITY_VERSIONS_TL SUBB, OTA_ACTIVITY_VERSIONS_TL SUBT
216 where SUBB.ACTIVITY_VERSION_ID = SUBT.ACTIVITY_VERSION_ID
217 and SUBB.LANGUAGE = SUBT.SOURCE_LANG
218 and (SUBB.VERSION_NAME <> SUBT.VERSION_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.INTENDED_AUDIENCE <> SUBT.INTENDED_AUDIENCE
223 or (SUBB.INTENDED_AUDIENCE is null and SUBT.INTENDED_AUDIENCE is not null)
224 or (SUBB.INTENDED_AUDIENCE is not null and SUBT.INTENDED_AUDIENCE is null)
225 or SUBB.OBJECTIVES <> SUBT.OBJECTIVES
226 or (SUBB.OBJECTIVES is null and SUBT.OBJECTIVES is not null)
227 or (SUBB.OBJECTIVES is not null and SUBT.OBJECTIVES 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_ACTIVITY_VERSIONS_TL (
234 ACTIVITY_VERSION_ID,
235 VERSION_NAME,
236 DESCRIPTION,
237 INTENDED_AUDIENCE,
238 OBJECTIVES,
239 KEYWORDS,
240 LAST_UPDATE_DATE,
241 LAST_UPDATED_BY,
242 LAST_UPDATE_LOGIN,
243 CREATED_BY,
244 CREATION_DATE,
245 LANGUAGE,
246 SOURCE_LANG
247 ) select
248 B.ACTIVITY_VERSION_ID,
249 B.VERSION_NAME,
250 B.DESCRIPTION,
251 B.INTENDED_AUDIENCE,
252 B.OBJECTIVES,
253 B.KEYWORDS,
254 B.LAST_UPDATE_DATE,
255 B.LAST_UPDATED_BY,
256 B.LAST_UPDATE_LOGIN,
257 B.CREATED_BY,
258 B.CREATION_DATE,
259 L.LANGUAGE_CODE,
260 B.SOURCE_LANG
261 from OTA_ACTIVITY_VERSIONS_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_ACTIVITY_VERSIONS_TL T
267 where T.ACTIVITY_VERSION_ID = B.ACTIVITY_VERSION_ID
268 and T.LANGUAGE = L.LANGUAGE_CODE);
269 end ADD_LANGUAGE;
270
271 --
272 -- ----------------------------------------------------------------------------
273 -- |-----------------------------< convert_args >-----------------------------|
274 -- ----------------------------------------------------------------------------
275 Function convert_args
276 (p_activity_version_id in number
277 ,p_language in varchar2
278 ,p_source_lang in varchar2
279 ,p_version_name in varchar2
280 ,p_description in varchar2
281 ,p_intended_audience in varchar2
282 ,p_objectives in varchar2
283 ,p_keywords in varchar2
284 )
285 Return g_rec_type is
286 --
287 l_rec g_rec_type;
288 --
289 Begin
290 --
291 -- Convert arguments into local l_rec structure.
292 --
293 l_rec.activity_version_id := p_activity_version_id;
294 l_rec.language := p_language;
295 l_rec.source_lang := p_source_lang;
296 l_rec.version_name := p_version_name;
297 l_rec.description := p_description;
298 l_rec.intended_audience := p_intended_audience;
299 l_rec.objectives := p_objectives;
300 l_rec.keywords := p_keywords;
301 --
302 -- Return the plsql record structure.
303 --
304 Return(l_rec);
305 --
306 End convert_args;
307 --
308 end ota_avt_shd;