[Home] [Help]
PACKAGE BODY: APPS.OKC_K_ARTICLE_PVT
Source
1 package body OKC_K_ARTICLE_PVT as
2 /* $Header: OKCCCATB.pls 120.0 2005/05/25 19:13:43 appldev noship $ */
3
4 l_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
5
6 G_APP_NAME CONSTANT VARCHAR2(3) := OKC_API.G_APP_NAME;
7 G_PKG_NAME CONSTANT VARCHAR2(200) := 'OKC_K_ARTICLE_PVT';
8 G_CHILD_RECORD_FOUND CONSTANT varchar2(200) := 'OKC_CHILD_RECORD_FOUND';
9 G_PARENT_TABLE_TOKEN CONSTANT VARCHAR2(200) := OKC_API.G_PARENT_TABLE_TOKEN;
10 G_CHILD_TABLE_TOKEN CONSTANT VARCHAR2(200) := OKC_API.G_CHILD_TABLE_TOKEN;
11
12 -- Start of comments
13 --
14 -- Procedure Name : add_language_k_article
15 -- Description :
16 -- Business Rules :
17 -- Parameters :
18 -- Version : 1.0
19 -- End of comments
20 procedure add_language_k_article is
21 begin
22 okc_cat_pvt.add_language;
23 end add_language_k_article;
24
25 -- Start of comments
26 --
27 -- Procedure Name : create_k_article
28 -- Description :
29 -- Business Rules :
30 -- Parameters :
31 -- Version : 1.0
32 -- End of comments
33 procedure create_k_article(p_api_version IN NUMBER,
34 p_init_msg_list IN VARCHAR2 ,
35 x_return_status OUT NOCOPY VARCHAR2,
36 x_msg_count OUT NOCOPY NUMBER,
37 x_msg_data OUT NOCOPY VARCHAR2,
38 p_catv_rec IN catv_rec_type,
39 x_catv_rec OUT NOCOPY catv_rec_type) is
40 l_catv_rec catv_rec_type := p_catv_rec;
41 --V
42 l_cvmv_rec OKC_CVM_PVT.cvmv_rec_type;
43 x_out_rec OKC_CVM_PVT.cvmv_rec_type;
44 --V
45 cursor l_std_art_exists_csr is
46 select STA.NAME
47 from OKC_K_ARTICLES_B CAT,
48 OKC_STD_ARTICLES_V STA
49 where CAT.chr_id = p_catv_rec.chr_id
50 and CAT.sav_sae_id = p_catv_rec.sav_sae_id
51 and STA.ID = CAT.sav_sae_id
52 ;
53 l_dummy varchar2(150):='?';
54 begin
55 if (l_catv_rec.CAT_TYPE = 'STA') then
56 open l_std_art_exists_csr;
57 fetch l_std_art_exists_csr into l_dummy;
58 close l_std_art_exists_csr;
59 if (l_dummy <> '?') then
60 OKC_API.SET_MESSAGE(p_app_name => 'OKC',
61 p_msg_name => 'OKC_ARTICLE_EXISTS',
62 p_token1 => 'VALUE1',
63 p_token1_value => l_dummy);
64 x_return_status := OKC_API.G_RET_STS_ERROR;
65 return;
66 end if;
67 l_catv_rec.NAME := NULL;
68 l_catv_rec.SBT_CODE := NULL;
69 elsif (l_catv_rec.CAT_TYPE = 'NSD') then
70 l_catv_rec.FULLTEXT_YN := NULL;
71 l_catv_rec.VARIATION_DESCRIPTION := NULL;
72 l_catv_rec.SAV_SAE_ID := NULL;
73 l_catv_rec.SAV_SAV_RELEASE := NULL;
74 end if;
75 okc_cat_pvt.insert_row(p_api_version => p_api_version,
76 p_init_msg_list => p_init_msg_list,
77 x_msg_count => x_msg_count,
78 x_msg_data => x_msg_data,
79 x_return_status => x_return_status,
80 p_catv_rec => l_catv_rec,
81 x_catv_rec => x_catv_rec);
82 --V
83 if (x_return_status <> OKC_API.G_RET_STS_SUCCESS) then
84 return;
85 end if;
86 l_cvmv_rec.chr_id := p_catv_rec.DNZ_CHR_ID;
87 OKC_CVM_PVT.update_contract_version(
88 p_api_version => p_api_version,
89 p_init_msg_list => OKC_API.G_FALSE,
90 x_return_status => x_return_status,
91 x_msg_count => x_msg_count,
92 x_msg_data => x_msg_data,
93 p_cvmv_rec => l_cvmv_rec,
94 x_cvmv_rec => x_out_rec);
95 --V
96 end create_k_article;
97
98 -- Start of comments
99 --
100 -- Procedure Name : lock_k_article
101 -- Description :
102 -- Business Rules :
103 -- Parameters :
104 -- Version : 1.0
105 -- End of comments
106 procedure lock_k_article(p_api_version IN NUMBER,
107 p_init_msg_list IN VARCHAR2 ,
108 x_return_status OUT NOCOPY VARCHAR2,
109 x_msg_count OUT NOCOPY NUMBER,
110 x_msg_data OUT NOCOPY VARCHAR2,
111 p_catv_rec IN catv_rec_type) is
112 begin
113 okc_cat_pvt.lock_row(p_api_version => p_api_version,
114 p_init_msg_list => p_init_msg_list,
115 x_msg_count => x_msg_count,
116 x_msg_data => x_msg_data,
117 x_return_status => x_return_status,
118 p_catv_rec => p_catv_rec);
119 end lock_k_article;
120
121 -- Start of comments
122 --
123 -- Procedure Name : update_k_article
124 -- Description :
125 -- Business Rules :
126 -- Parameters :
127 -- Version : 1.0
128 -- End of comments
129 procedure update_k_article(p_api_version IN NUMBER,
130 p_init_msg_list IN VARCHAR2 ,
131 x_return_status OUT NOCOPY VARCHAR2,
132 x_msg_count OUT NOCOPY NUMBER,
133 x_msg_data OUT NOCOPY VARCHAR2,
134 p_catv_rec IN catv_rec_type,
135 x_catv_rec OUT NOCOPY catv_rec_type) is
136 l_catv_rec catv_rec_type := p_catv_rec;
137 --V
138 l_cvmv_rec OKC_CVM_PVT.cvmv_rec_type;
139 x_out_rec OKC_CVM_PVT.cvmv_rec_type;
140 cursor dnz_csr is
141 select dnz_chr_id
142 from OKC_K_ARTICLES_B
143 where id = p_catv_rec.id;
144 --V
145 begin
146 if (l_catv_rec.CAT_TYPE = 'STA') then
147 l_catv_rec.NAME := NULL;
148 l_catv_rec.SBT_CODE := NULL;
149 elsif (l_catv_rec.CAT_TYPE = 'NSD') then
150 l_catv_rec.FULLTEXT_YN := NULL;
151 l_catv_rec.VARIATION_DESCRIPTION := NULL;
152 l_catv_rec.SAV_SAE_ID := NULL;
153 l_catv_rec.SAV_SAV_RELEASE := NULL;
154 end if;
155 okc_cat_pvt.update_row(p_api_version => p_api_version,
156 p_init_msg_list => p_init_msg_list,
157 x_msg_count => x_msg_count,
158 x_msg_data => x_msg_data,
159 x_return_status => x_return_status,
160 p_catv_rec => l_catv_rec,
161 x_catv_rec => x_catv_rec);
162 --V
163 if (x_return_status <> OKC_API.G_RET_STS_SUCCESS) then
164 return;
165 end if;
166 open dnz_csr;
167 fetch dnz_csr into l_cvmv_rec.chr_id;
168 close dnz_csr;
169 OKC_CVM_PVT.update_contract_version(
170 p_api_version => p_api_version,
171 p_init_msg_list => OKC_API.G_FALSE,
172 x_return_status => x_return_status,
173 x_msg_count => x_msg_count,
174 x_msg_data => x_msg_data,
175 p_cvmv_rec => l_cvmv_rec,
176 x_cvmv_rec => x_out_rec);
177 --V
178 end update_k_article;
179
180 -- Start of comments
181 --
182 -- Procedure Name : delete_k_article
183 -- Description :
184 -- Business Rules :
185 -- Parameters :
186 -- Version : 1.0
187 -- End of comments
188 procedure delete_k_article(p_api_version IN NUMBER,
189 p_init_msg_list IN VARCHAR2 ,
190 x_return_status OUT NOCOPY VARCHAR2,
191 x_msg_count OUT NOCOPY NUMBER,
192 x_msg_data OUT NOCOPY VARCHAR2,
193 p_catv_rec IN catv_rec_type) is
194 l_dummy varchar2(1);
195
196 l_scc_id okc_section_contents.id%TYPE;
197 l_sccv_rec okc_sections_pub.sccv_rec_type;
198
199
200 cursor l_cat_csr is
201 select '!'
202 from OKC_K_ARTICLES_B
203 where cat_id = p_catv_rec.id;
204 CURSOR l_atn_csr IS
205 SELECT '!'
206 FROM Okc_Article_Trans_V
207 WHERE cat_id = p_catv_rec.id;
208 --V
209 l_cvmv_rec OKC_CVM_PVT.cvmv_rec_type;
210 x_out_rec OKC_CVM_PVT.cvmv_rec_type;
211 cursor dnz_csr is
212 select dnz_chr_id
213 from OKC_K_ARTICLES_B
214 where id = p_catv_rec.id;
215 --V
216
217 cursor section_csr is
218 select id
219 from OKC_SECTION_CONTENTS
220 where cat_id = p_catv_rec.id;
221
222 begin
223 --
224 l_dummy := '?';
225 open l_cat_csr;
226 fetch l_cat_csr into l_dummy;
227 close l_cat_csr;
228 if (l_dummy = '!') then
229 OKC_API.SET_MESSAGE(p_app_name => G_APP_NAME,
230 p_msg_name => G_CHILD_RECORD_FOUND,
231 p_token1 => G_PARENT_TABLE_TOKEN,
232 p_token1_value => 'OKC_K_ARTICLES_V',
233 p_token2 => G_CHILD_TABLE_TOKEN,
234 p_token2_value => 'OKC_K_ARTICLES_V');
235 x_return_status := OKC_API.G_RET_STS_ERROR;
236 return;
237 end if;
238 --
239 l_dummy := '?';
240 open l_atn_csr;
241 fetch l_atn_csr into l_dummy;
242 close l_atn_csr;
243 if (l_dummy = '!') then
244 OKC_API.SET_MESSAGE(p_app_name => G_APP_NAME,
245 p_msg_name => G_CHILD_RECORD_FOUND,
246 p_token1 => G_PARENT_TABLE_TOKEN,
247 p_token1_value => 'OKC_K_ARTICLES_V',
248 p_token2 => G_CHILD_TABLE_TOKEN,
249 p_token2_value => 'OKC_ARTICLE_TRANS_V');
250 x_return_status := OKC_API.G_RET_STS_ERROR;
251 return;
252 end if;
253 --V
254 open dnz_csr;
255 fetch dnz_csr into l_cvmv_rec.chr_id;
256 close dnz_csr;
257 if (l_cvmv_rec.chr_id is NULL) then
258 x_return_status := OKC_API.G_RET_STS_SUCCESS;
259 return;
260 end if;
261 --V
262 okc_cat_pvt.delete_row(p_api_version => p_api_version,
263 p_init_msg_list => p_init_msg_list,
264 x_msg_count => x_msg_count,
265 x_msg_data => x_msg_data,
266 x_return_status => x_return_status,
267 p_catv_rec => p_catv_rec);
268 --V
269 if (x_return_status <> OKC_API.G_RET_STS_SUCCESS) then
270 return;
271 else
272 open section_csr;
273 fetch section_csr into l_scc_id;
274 close section_csr;
275
276 if l_scc_id IS NOT NULL then
277 l_sccv_rec.id :=l_scc_id;
278 OKC_SECTIONS_PUB.delete_section_content(
279 p_api_version => p_api_version,
280 p_init_msg_list => p_init_msg_list,
281 x_msg_count => x_msg_count,
282 x_msg_data => x_msg_data,
283 x_return_status => x_return_status,
284 p_sccv_rec => l_sccv_rec);
285 end if;
286 end if;
287 OKC_CVM_PVT.update_contract_version(
288 p_api_version => p_api_version,
289 p_init_msg_list => OKC_API.G_FALSE,
290 x_return_status => x_return_status,
291 x_msg_count => x_msg_count,
292 x_msg_data => x_msg_data,
293 p_cvmv_rec => l_cvmv_rec,
294 x_cvmv_rec => x_out_rec);
295
296 end delete_k_article;
297
298 -- Start of comments
299 --
300 -- Procedure Name : validate_k_article
301 -- Description :
302 -- Business Rules :
303 -- Parameters :
304 -- Version : 1.0
305 -- End of comments
306 procedure validate_k_article(p_api_version IN NUMBER,
307 p_init_msg_list IN VARCHAR2 ,
308 x_return_status OUT NOCOPY VARCHAR2,
309 x_msg_count OUT NOCOPY NUMBER,
310 x_msg_data OUT NOCOPY VARCHAR2,
311 p_catv_rec IN catv_rec_type) is
312 begin
313 okc_cat_pvt.validate_row(p_api_version => p_api_version,
314 p_init_msg_list => p_init_msg_list,
315 x_msg_count => x_msg_count,
316 x_msg_data => x_msg_data,
317 x_return_status => x_return_status,
318 p_catv_rec => p_catv_rec);
319 end validate_k_article;
320
321 -- Start of comments
322 --
323 -- Procedure Name : create_article_translation
324 -- Description :
325 -- Business Rules :
326 -- Parameters :
327 -- Version : 1.0
328 -- End of comments
329 procedure create_article_translation(p_api_version IN NUMBER,
330 p_init_msg_list IN VARCHAR2 ,
331 x_return_status OUT NOCOPY VARCHAR2,
332 x_msg_count OUT NOCOPY NUMBER,
333 x_msg_data OUT NOCOPY VARCHAR2,
334 p_atnv_rec IN atnv_rec_type,
335 x_atnv_rec OUT NOCOPY atnv_rec_type) is
336 --V
337 l_cvmv_rec OKC_CVM_PVT.cvmv_rec_type;
338 x_out_rec OKC_CVM_PVT.cvmv_rec_type;
339 --V
340 begin
341 okc_atn_pvt.insert_row(p_api_version => p_api_version,
342 p_init_msg_list => p_init_msg_list,
343 x_msg_count => x_msg_count,
344 x_msg_data => x_msg_data,
345 x_return_status => x_return_status,
346 p_atnv_rec => p_atnv_rec,
347 x_atnv_rec => x_atnv_rec);
348 --V
349 if (x_return_status <> OKC_API.G_RET_STS_SUCCESS) then
350 return;
351 end if;
352 l_cvmv_rec.chr_id := p_atnv_rec.DNZ_CHR_ID;
353 OKC_CVM_PVT.update_contract_version(
354 p_api_version => p_api_version,
355 p_init_msg_list => OKC_API.G_FALSE,
356 x_return_status => x_return_status,
357 x_msg_count => x_msg_count,
358 x_msg_data => x_msg_data,
359 p_cvmv_rec => l_cvmv_rec,
360 x_cvmv_rec => x_out_rec);
361 --V
362 end create_article_translation;
363
364 -- Start of comments
365 --
366 -- Procedure Name : lock_article_translation
367 -- Description :
368 -- Business Rules :
369 -- Parameters :
370 -- Version : 1.0
371 -- End of comments
372 procedure lock_article_translation(p_api_version IN NUMBER,
373 p_init_msg_list IN VARCHAR2 ,
374 x_return_status OUT NOCOPY VARCHAR2,
375 x_msg_count OUT NOCOPY NUMBER,
376 x_msg_data OUT NOCOPY VARCHAR2,
377 p_atnv_rec IN atnv_rec_type) is
378 begin
379 okc_atn_pvt.lock_row(p_api_version => p_api_version,
380 p_init_msg_list => p_init_msg_list,
381 x_msg_count => x_msg_count,
382 x_msg_data => x_msg_data,
383 x_return_status => x_return_status,
384 p_atnv_rec => p_atnv_rec);
385 end lock_article_translation;
386
387 -- Start of comments
388 --
389 -- Procedure Name : delete_article_translation
390 -- Description :
391 -- Business Rules :
392 -- Parameters :
393 -- Version : 1.0
394 -- End of comments
395 procedure delete_article_translation(p_api_version IN NUMBER,
396 p_init_msg_list IN VARCHAR2 ,
397 x_return_status OUT NOCOPY VARCHAR2,
398 x_msg_count OUT NOCOPY NUMBER,
399 x_msg_data OUT NOCOPY VARCHAR2,
400 p_atnv_rec IN atnv_rec_type) is
401 --V
402 l_cvmv_rec OKC_CVM_PVT.cvmv_rec_type;
403 x_out_rec OKC_CVM_PVT.cvmv_rec_type;
404 cursor dnz_csr is
405 select dnz_chr_id
406 from OKC_ARTICLE_TRANS_V
407 where id = p_atnv_rec.id;
408 --V
409 begin
410 --V
411 open dnz_csr;
412 fetch dnz_csr into l_cvmv_rec.chr_id;
413 close dnz_csr;
414 if (l_cvmv_rec.chr_id is NULL) then
415 x_return_status := OKC_API.G_RET_STS_SUCCESS;
416 return;
417 end if;
418 --V
419 okc_atn_pvt.delete_row(p_api_version => p_api_version,
420 p_init_msg_list => p_init_msg_list,
421 x_msg_count => x_msg_count,
422 x_msg_data => x_msg_data,
423 x_return_status => x_return_status,
424 p_atnv_rec => p_atnv_rec);
425 --V
426 if (x_return_status <> OKC_API.G_RET_STS_SUCCESS) then
427 return;
428 end if;
429 OKC_CVM_PVT.update_contract_version(
430 p_api_version => p_api_version,
431 p_init_msg_list => OKC_API.G_FALSE,
432 x_return_status => x_return_status,
433 x_msg_count => x_msg_count,
434 x_msg_data => x_msg_data,
435 p_cvmv_rec => l_cvmv_rec,
436 x_cvmv_rec => x_out_rec);
437 --V
438 end delete_article_translation;
439
440 -- Start of comments
441 --
442 -- Procedure Name : validate_article_translation
443 -- Description :
444 -- Business Rules :
445 -- Parameters :
446 -- Version : 1.0
447 -- End of comments
448 procedure validate_article_translation(p_api_version IN NUMBER,
449 p_init_msg_list IN VARCHAR2 ,
450 x_return_status OUT NOCOPY VARCHAR2,
451 x_msg_count OUT NOCOPY NUMBER,
452 x_msg_data OUT NOCOPY VARCHAR2,
453 p_atnv_rec IN atnv_rec_type) is
454 begin
455 okc_atn_pvt.validate_row(p_api_version => p_api_version,
456 p_init_msg_list => p_init_msg_list,
457 x_msg_count => x_msg_count,
458 x_msg_data => x_msg_data,
459 x_return_status => x_return_status,
460 p_atnv_rec => p_atnv_rec);
461 end validate_article_translation;
462
463 end OKC_K_ARTICLE_PVT;