[Home] [Help]
PACKAGE BODY: APPS.AMS_PRTY_URL_ASSOC_PVT
Source
1 PACKAGE BODY AMS_Prty_Url_Assoc_PVT as
2 /* $Header: amsvpuab.pls 120.0 2005/07/01 03:52:48 appldev noship $ */
3 -- ===============================================================
4 -- Start of Comments
5 -- Package name
6 -- AMS_Prty_Url_Assoc_PVT
7 -- Purpose
8 --
9 -- History
10 --
11 -- NOTE
12 --
13 -- End of Comments
14 -- ===============================================================
15
16
17 G_PKG_NAME CONSTANT VARCHAR2(30):= 'AMS_Prty_Url_Assoc_PVT';
18 G_FILE_NAME CONSTANT VARCHAR2(12) := 'amsvpuab.pls';
19
20 G_USER_ID NUMBER := FND_GLOBAL.USER_ID;
21 G_LOGIN_ID NUMBER := FND_GLOBAL.CONC_LOGIN_ID;
22
23 -- Hint: Primary key needs to be returned.
24 PROCEDURE Create_Prty_Url_Assoc(
25 p_api_version_number IN NUMBER,
26 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
27 p_commit IN VARCHAR2 := FND_API.G_FALSE,
28 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
29
30 x_return_status OUT NOCOPY VARCHAR2,
31 x_msg_count OUT NOCOPY NUMBER,
32 x_msg_data OUT NOCOPY VARCHAR2,
33
34 p_prty_url_assoc_rec IN prty_url_assoc_rec_type := g_miss_prty_url_assoc_rec,
35 x_assoc_id OUT NOCOPY NUMBER
36 )
37
38 IS
39 L_API_NAME CONSTANT VARCHAR2(30) := 'Create_Prty_Url_Assoc';
40 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
41 l_return_status_full VARCHAR2(1);
42 l_object_version_number NUMBER := 1;
43 l_org_id NUMBER := FND_API.G_MISS_NUM;
44 l_ASSOC_ID NUMBER;
45 l_dummy NUMBER;
46
47 CURSOR c_id IS
48 SELECT AMS_PRETTY_URL_ASSOC_s.NEXTVAL
49 FROM dual;
50
51 CURSOR c_id_exists (l_id IN NUMBER) IS
52 SELECT 1
53 FROM AMS_PRETTY_URL_ASSOC
54 WHERE ASSOC_ID = l_id;
55
56 BEGIN
57 -- Standard Start of API savepoint
58 SAVEPOINT CREATE_Prty_Url_Assoc_PVT;
59
60 -- Standard call to check for call compatibility.
61 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
62 p_api_version_number,
63 l_api_name,
64 G_PKG_NAME)
65 THEN
66 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
67 END IF;
68
69 -- Initialize message list if p_init_msg_list is set to TRUE.
70 IF FND_API.to_Boolean( p_init_msg_list )
71 THEN
72 FND_MSG_PUB.initialize;
73 END IF;
74
75 -- Debug Message
76 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
77
78
79 -- Initialize API return status to SUCCESS
80 x_return_status := FND_API.G_RET_STS_SUCCESS;
81
82 -- Local variable initialization
83
84 IF p_prty_url_assoc_rec.ASSOC_ID IS NULL OR p_prty_url_assoc_rec.ASSOC_ID = FND_API.g_miss_num THEN
85 LOOP
86 l_dummy := NULL;
87 OPEN c_id;
88 FETCH c_id INTO l_ASSOC_ID;
89 CLOSE c_id;
90
91 OPEN c_id_exists(l_ASSOC_ID);
92 FETCH c_id_exists INTO l_dummy;
93 CLOSE c_id_exists;
94 EXIT WHEN l_dummy IS NULL;
95 END LOOP;
96 END IF;
97
98 -- =========================================================================
99 -- Validate Environment
100 -- =========================================================================
101
102 IF FND_GLOBAL.User_Id IS NULL
103 THEN
104 AMS_Utility_PVT.Error_Message(p_message_name => 'USER_PROFILE_MISSING');
105 RAISE FND_API.G_EXC_ERROR;
106 END IF;
107
108 IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
109 THEN
110 -- Debug message
111 AMS_UTILITY_PVT.debug_message('Private API: Validate_Prty_Url_Assoc');
112
113 -- Invoke validation procedures
114 Validate_prty_url_assoc(
115 p_api_version_number => 1.0,
116 p_init_msg_list => FND_API.G_FALSE,
117 p_validation_level => p_validation_level,
118 p_prty_url_assoc_rec => p_prty_url_assoc_rec,
119 x_return_status => x_return_status,
120 x_msg_count => x_msg_count,
121 x_msg_data => x_msg_data);
122 END IF;
123
124 IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
125 RAISE FND_API.G_EXC_ERROR;
126 END IF;
127
128
129 -- Debug Message
130 AMS_UTILITY_PVT.debug_message( 'Private API: Calling create table handler');
131
132 -- Invoke table handler(AMS_PRETTY_URL_ASSOC_PKG.Insert_Row)
133 AMS_PRETTY_URL_ASSOC_PKG.Insert_Row(
134 px_assoc_id => l_assoc_id,
135 p_creation_date => SYSDATE,
136 p_created_by => G_USER_ID,
137 p_last_update_date => SYSDATE,
138 p_last_updated_by => G_USER_ID,
139 p_last_update_login => G_LOGIN_ID,
140 px_object_version_number => l_object_version_number,
141 p_system_url_id => p_prty_url_assoc_rec.system_url_id,
142 p_used_by_obj_type => p_prty_url_assoc_rec.used_by_obj_type,
143 p_used_by_obj_id => p_prty_url_assoc_rec.used_by_obj_id);
144 IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
145 RAISE FND_API.G_EXC_ERROR;
146 END IF;
147 x_assoc_id := l_assoc_id;
148 --
149 -- End of API body
150 --
151
152 -- Standard check for p_commit
153 IF FND_API.to_Boolean( p_commit )
154 THEN
155 COMMIT WORK;
156 END IF;
157
158
159 -- Debug Message
160 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
161
162 -- Standard call to get message count and if count is 1, get message info.
163 FND_MSG_PUB.Count_And_Get
164 (p_count => x_msg_count,
165 p_data => x_msg_data
166 );
167 EXCEPTION
168
169 WHEN AMS_Utility_PVT.resource_locked THEN
170 x_return_status := FND_API.g_ret_sts_error;
171 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_API_RESOURCE_LOCKED');
172
173 WHEN FND_API.G_EXC_ERROR THEN
174 ROLLBACK TO CREATE_Prty_Url_Assoc_PVT;
175 x_return_status := FND_API.G_RET_STS_ERROR;
176 -- Standard call to get message count and if count=1, get the message
177 FND_MSG_PUB.Count_And_Get (
178 p_encoded => FND_API.G_FALSE,
179 p_count => x_msg_count,
180 p_data => x_msg_data
181 );
182
183 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
184 ROLLBACK TO CREATE_Prty_Url_Assoc_PVT;
185 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
186 -- Standard call to get message count and if count=1, get the message
187 FND_MSG_PUB.Count_And_Get (
188 p_encoded => FND_API.G_FALSE,
189 p_count => x_msg_count,
190 p_data => x_msg_data
191 );
192
193 WHEN OTHERS THEN
194 ROLLBACK TO CREATE_Prty_Url_Assoc_PVT;
195 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
196 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
197 THEN
198 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
199 END IF;
200 -- Standard call to get message count and if count=1, get the message
201 FND_MSG_PUB.Count_And_Get (
202 p_encoded => FND_API.G_FALSE,
203 p_count => x_msg_count,
204 p_data => x_msg_data
205 );
206 End Create_Prty_Url_Assoc;
207
208
209 PROCEDURE Update_Prty_Url_Assoc(
210 p_api_version_number IN NUMBER,
211 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
212 p_commit IN VARCHAR2 := FND_API.G_FALSE,
213 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
214
215 x_return_status OUT NOCOPY VARCHAR2,
216 x_msg_count OUT NOCOPY NUMBER,
217 x_msg_data OUT NOCOPY VARCHAR2,
218
219 p_prty_url_assoc_rec IN prty_url_assoc_rec_type,
220 x_object_version_number OUT NOCOPY NUMBER
221 )
222
223 IS
224 CURSOR c_get_prty_url_assoc(assoc_id NUMBER) IS
225 SELECT *
226 FROM AMS_PRETTY_URL_ASSOC;
227 -- Hint: Developer need to provide Where clause
228 L_API_NAME CONSTANT VARCHAR2(30) := 'Update_Prty_Url_Assoc';
229 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
230 -- Local Variables
231 l_object_version_number NUMBER;
232 l_ASSOC_ID NUMBER;
233 l_ref_prty_url_assoc_rec c_get_Prty_Url_Assoc%ROWTYPE ;
234 l_tar_prty_url_assoc_rec AMS_Prty_Url_Assoc_PVT.prty_url_assoc_rec_type := P_prty_url_assoc_rec;
235 l_rowid ROWID;
236
237 BEGIN
238 -- Standard Start of API savepoint
239 SAVEPOINT UPDATE_Prty_Url_Assoc_PVT;
240
241 -- Standard call to check for call compatibility.
242 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
243 p_api_version_number,
244 l_api_name,
245 G_PKG_NAME)
246 THEN
247 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
248 END IF;
249
250 -- Initialize message list if p_init_msg_list is set to TRUE.
251 IF FND_API.to_Boolean( p_init_msg_list )
252 THEN
253 FND_MSG_PUB.initialize;
254 END IF;
255
256 -- Debug Message
257 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
258
259
260 -- Initialize API return status to SUCCESS
261 x_return_status := FND_API.G_RET_STS_SUCCESS;
262
263 -- Debug Message
264 AMS_UTILITY_PVT.debug_message('Private API: - Open Cursor to Select');
265
266 /*
267 OPEN c_get_Prty_Url_Assoc( l_tar_prty_url_assoc_rec.assoc_id);
268
269 FETCH c_get_Prty_Url_Assoc INTO l_ref_prty_url_assoc_rec ;
270
271 If ( c_get_Prty_Url_Assoc%NOTFOUND) THEN
272 AMS_Utility_PVT.Error_Message(p_message_name => 'API_MISSING_UPDATE_TARGET',
273 p_token_name => 'INFO',
274 p_token_value => 'Prty_Url_Assoc') ;
275 RAISE FND_API.G_EXC_ERROR;
276 END IF;
277 -- Debug Message
278 AMS_UTILITY_PVT.debug_message('Private API: - Close Cursor');
279 CLOSE c_get_Prty_Url_Assoc;
280 */
281
282
283 If (l_tar_prty_url_assoc_rec.object_version_number is NULL or
284 l_tar_prty_url_assoc_rec.object_version_number = FND_API.G_MISS_NUM ) Then
285 AMS_Utility_PVT.Error_Message(p_message_name => 'API_VERSION_MISSING',
286 p_token_name => 'COLUMN',
287 p_token_value => 'Last_Update_Date') ;
288 raise FND_API.G_EXC_ERROR;
289 End if;
290 -- Check Whether record has been changed by someone else
291 If (l_tar_prty_url_assoc_rec.object_version_number <> l_ref_prty_url_assoc_rec.object_version_number) Then
292 AMS_Utility_PVT.Error_Message(p_message_name => 'API_RECORD_CHANGED',
293 p_token_name => 'INFO',
294 p_token_value => 'Prty_Url_Assoc') ;
295 raise FND_API.G_EXC_ERROR;
296 End if;
297 IF ( P_validation_level >= FND_API.G_VALID_LEVEL_FULL)
298 THEN
299 -- Debug message
300 AMS_UTILITY_PVT.debug_message('Private API: Validate_Prty_Url_Assoc');
301
302 -- Invoke validation procedures
303 Validate_prty_url_assoc(
304 p_api_version_number => 1.0,
305 p_init_msg_list => FND_API.G_FALSE,
306 p_validation_level => p_validation_level,
307 p_prty_url_assoc_rec => p_prty_url_assoc_rec,
308 x_return_status => x_return_status,
309 x_msg_count => x_msg_count,
310 x_msg_data => x_msg_data);
311 END IF;
312
313 IF x_return_status<>FND_API.G_RET_STS_SUCCESS THEN
314 RAISE FND_API.G_EXC_ERROR;
315 END IF;
316
317
318 -- Debug Message
319 AMS_UTILITY_PVT.debug_message(FND_MSG_PUB.G_MSG_LVL_DEBUG_LOW, 'Private API: Calling update table handler');
320
321 -- Invoke table handler(AMS_PRETTY_URL_ASSOC_PKG.Update_Row)
322 AMS_PRETTY_URL_ASSOC_PKG.Update_Row(
323 p_assoc_id => p_prty_url_assoc_rec.assoc_id,
324 p_creation_date => SYSDATE,
325 p_created_by => G_USER_ID,
326 p_last_update_date => SYSDATE,
327 p_last_updated_by => G_USER_ID,
328 p_last_update_login => G_LOGIN_ID,
329 p_object_version_number => p_prty_url_assoc_rec.object_version_number,
330 p_system_url_id => p_prty_url_assoc_rec.system_url_id,
331 p_used_by_obj_type => p_prty_url_assoc_rec.used_by_obj_type,
332 p_used_by_obj_id => p_prty_url_assoc_rec.used_by_obj_id);
333 --
334 -- End of API body.
335 --
336
337 -- Standard check for p_commit
338 IF FND_API.to_Boolean( p_commit )
339 THEN
340 COMMIT WORK;
341 END IF;
342
343
344 -- Debug Message
345 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
346
347 -- Standard call to get message count and if count is 1, get message info.
348 FND_MSG_PUB.Count_And_Get
349 (p_count => x_msg_count,
350 p_data => x_msg_data
351 );
352 EXCEPTION
353
354 WHEN AMS_Utility_PVT.resource_locked THEN
355 x_return_status := FND_API.g_ret_sts_error;
356 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_API_RESOURCE_LOCKED');
357
358 WHEN FND_API.G_EXC_ERROR THEN
359 ROLLBACK TO UPDATE_Prty_Url_Assoc_PVT;
360 x_return_status := FND_API.G_RET_STS_ERROR;
361 -- Standard call to get message count and if count=1, get the message
362 FND_MSG_PUB.Count_And_Get (
363 p_encoded => FND_API.G_FALSE,
364 p_count => x_msg_count,
365 p_data => x_msg_data
366 );
367
368 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
369 ROLLBACK TO UPDATE_Prty_Url_Assoc_PVT;
370 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
371 -- Standard call to get message count and if count=1, get the message
372 FND_MSG_PUB.Count_And_Get (
373 p_encoded => FND_API.G_FALSE,
374 p_count => x_msg_count,
375 p_data => x_msg_data
376 );
377
378 WHEN OTHERS THEN
379 ROLLBACK TO UPDATE_Prty_Url_Assoc_PVT;
380 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
381 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
382 THEN
383 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
384 END IF;
385 -- Standard call to get message count and if count=1, get the message
386 FND_MSG_PUB.Count_And_Get (
387 p_encoded => FND_API.G_FALSE,
388 p_count => x_msg_count,
389 p_data => x_msg_data
390 );
391 End Update_Prty_Url_Assoc;
392
393
394 PROCEDURE Delete_Prty_Url_Assoc(
395 p_api_version_number IN NUMBER,
396 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
397 p_commit IN VARCHAR2 := FND_API.G_FALSE,
398 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
399 x_return_status OUT NOCOPY VARCHAR2,
400 x_msg_count OUT NOCOPY NUMBER,
401 x_msg_data OUT NOCOPY VARCHAR2,
402 p_assoc_id IN NUMBER,
403 p_object_version_number IN NUMBER
404 )
405
406 IS
407 L_API_NAME CONSTANT VARCHAR2(30) := 'Delete_Prty_Url_Assoc';
408 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
409 l_object_version_number NUMBER;
410
411 BEGIN
412 -- Standard Start of API savepoint
413 SAVEPOINT DELETE_Prty_Url_Assoc_PVT;
414
415 -- Standard call to check for call compatibility.
416 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
417 p_api_version_number,
418 l_api_name,
419 G_PKG_NAME)
420 THEN
421 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
422 END IF;
423
424 -- Initialize message list if p_init_msg_list is set to TRUE.
425 IF FND_API.to_Boolean( p_init_msg_list )
426 THEN
427 FND_MSG_PUB.initialize;
428 END IF;
429
430 -- Debug Message
431 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
432
433
434 -- Initialize API return status to SUCCESS
435 x_return_status := FND_API.G_RET_STS_SUCCESS;
436
437 --
438 -- Api body
439 --
440 -- Debug Message
441 AMS_UTILITY_PVT.debug_message( 'Private API: Calling delete table handler');
442
443 -- Invoke table handler(AMS_PRETTY_URL_ASSOC_PKG.Delete_Row)
444 AMS_PRETTY_URL_ASSOC_PKG.Delete_Row(
445 p_ASSOC_ID => p_ASSOC_ID);
446 --
447 -- End of API body
448 --
449
450 -- Standard check for p_commit
451 IF FND_API.to_Boolean( p_commit )
452 THEN
453 COMMIT WORK;
454 END IF;
455
456
457 -- Debug Message
458 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
459
460 -- Standard call to get message count and if count is 1, get message info.
461 FND_MSG_PUB.Count_And_Get
462 (p_count => x_msg_count,
463 p_data => x_msg_data
464 );
465 EXCEPTION
466
467 WHEN AMS_Utility_PVT.resource_locked THEN
468 x_return_status := FND_API.g_ret_sts_error;
469 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_API_RESOURCE_LOCKED');
470
471 WHEN FND_API.G_EXC_ERROR THEN
472 ROLLBACK TO DELETE_Prty_Url_Assoc_PVT;
473 x_return_status := FND_API.G_RET_STS_ERROR;
474 -- Standard call to get message count and if count=1, get the message
475 FND_MSG_PUB.Count_And_Get (
476 p_encoded => FND_API.G_FALSE,
477 p_count => x_msg_count,
478 p_data => x_msg_data
479 );
480
481 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
482 ROLLBACK TO DELETE_Prty_Url_Assoc_PVT;
483 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
484 -- Standard call to get message count and if count=1, get the message
485 FND_MSG_PUB.Count_And_Get (
486 p_encoded => FND_API.G_FALSE,
487 p_count => x_msg_count,
488 p_data => x_msg_data
489 );
490
491 WHEN OTHERS THEN
492 ROLLBACK TO DELETE_Prty_Url_Assoc_PVT;
493 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
494 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
495 THEN
496 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
497 END IF;
498 -- Standard call to get message count and if count=1, get the message
499 FND_MSG_PUB.Count_And_Get (
500 p_encoded => FND_API.G_FALSE,
501 p_count => x_msg_count,
502 p_data => x_msg_data
503 );
504 End Delete_Prty_Url_Assoc;
505
506
507
508 -- Hint: Primary key needs to be returned.
509 PROCEDURE Lock_Prty_Url_Assoc(
510 p_api_version_number IN NUMBER,
511 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
512
513 x_return_status OUT NOCOPY VARCHAR2,
514 x_msg_count OUT NOCOPY NUMBER,
515 x_msg_data OUT NOCOPY VARCHAR2,
516
517 p_assoc_id IN NUMBER,
518 p_object_version IN NUMBER
519 )
520
521 IS
522 L_API_NAME CONSTANT VARCHAR2(30) := 'Lock_Prty_Url_Assoc';
523 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
524 L_FULL_NAME CONSTANT VARCHAR2(60) := g_pkg_name ||'.'|| l_api_name;
525 l_ASSOC_ID NUMBER;
526
527 CURSOR c_Prty_Url_Assoc IS
528 SELECT ASSOC_ID
529 FROM AMS_PRETTY_URL_ASSOC
530 WHERE ASSOC_ID = p_ASSOC_ID
531 AND object_version_number = p_object_version
532 FOR UPDATE NOWAIT;
533
534 BEGIN
535
536 -- Debug Message
537 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
538
539 -- Initialize message list if p_init_msg_list is set to TRUE.
540 IF FND_API.to_Boolean( p_init_msg_list )
541 THEN
542 FND_MSG_PUB.initialize;
543 END IF;
544
545 -- Standard call to check for call compatibility.
546 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
547 p_api_version_number,
548 l_api_name,
549 G_PKG_NAME)
550 THEN
551 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
552 END IF;
553
554
555 -- Initialize API return status to SUCCESS
556 x_return_status := FND_API.G_RET_STS_SUCCESS;
557
558
559 ------------------------ lock -------------------------
560
561 AMS_Utility_PVT.debug_message(l_full_name||': start');
562 OPEN c_Prty_Url_Assoc;
563
564 FETCH c_Prty_Url_Assoc INTO l_ASSOC_ID;
565
566 IF (c_Prty_Url_Assoc%NOTFOUND) THEN
567 CLOSE c_Prty_Url_Assoc;
568 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
569 FND_MESSAGE.set_name('AMS', 'AMS_API_RECORD_NOT_FOUND');
570 FND_MSG_PUB.add;
571 END IF;
572 RAISE FND_API.g_exc_error;
573 END IF;
574
575 CLOSE c_Prty_Url_Assoc;
576
577 -------------------- finish --------------------------
578 FND_MSG_PUB.count_and_get(
579 p_encoded => FND_API.g_false,
580 p_count => x_msg_count,
581 p_data => x_msg_data);
582 AMS_Utility_PVT.debug_message(l_full_name ||': end');
583 EXCEPTION
584
585 WHEN AMS_Utility_PVT.resource_locked THEN
586 x_return_status := FND_API.g_ret_sts_error;
587 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_API_RESOURCE_LOCKED');
588
589 WHEN FND_API.G_EXC_ERROR THEN
590 ROLLBACK TO LOCK_Prty_Url_Assoc_PVT;
591 x_return_status := FND_API.G_RET_STS_ERROR;
592 -- Standard call to get message count and if count=1, get the message
593 FND_MSG_PUB.Count_And_Get (
594 p_encoded => FND_API.G_FALSE,
595 p_count => x_msg_count,
596 p_data => x_msg_data
597 );
598
599 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
600 ROLLBACK TO LOCK_Prty_Url_Assoc_PVT;
601 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
602 -- Standard call to get message count and if count=1, get the message
603 FND_MSG_PUB.Count_And_Get (
604 p_encoded => FND_API.G_FALSE,
605 p_count => x_msg_count,
606 p_data => x_msg_data
607 );
608
609 WHEN OTHERS THEN
610 ROLLBACK TO LOCK_Prty_Url_Assoc_PVT;
611 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
612 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
613 THEN
614 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
615 END IF;
616 -- Standard call to get message count and if count=1, get the message
617 FND_MSG_PUB.Count_And_Get (
618 p_encoded => FND_API.G_FALSE,
619 p_count => x_msg_count,
620 p_data => x_msg_data
621 );
622 End Lock_Prty_Url_Assoc;
623
624
625 PROCEDURE check_prty_url_assoc_uk_items(
626 p_prty_url_assoc_rec IN prty_url_assoc_rec_type,
627 p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.g_create,
628 x_return_status OUT NOCOPY VARCHAR2)
629 IS
630 l_valid_flag VARCHAR2(1);
631
632 BEGIN
633 x_return_status := FND_API.g_ret_sts_success;
634 IF p_validation_mode = JTF_PLSQL_API.g_create THEN
635 l_valid_flag := AMS_Utility_PVT.check_uniqueness(
636 'AMS_PRETTY_URL_ASSOC',
637 'ASSOC_ID = ''' || p_prty_url_assoc_rec.ASSOC_ID ||''''
638 );
639 ELSE
640 l_valid_flag := AMS_Utility_PVT.check_uniqueness(
641 'AMS_PRETTY_URL_ASSOC',
642 'ASSOC_ID = ''' || p_prty_url_assoc_rec.ASSOC_ID ||
643 ''' AND ASSOC_ID <> ' || p_prty_url_assoc_rec.ASSOC_ID
644 );
645 END IF;
646
647 IF l_valid_flag = FND_API.g_false THEN
648 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_ASSOC_ID_DUPLICATE');
649 x_return_status := FND_API.g_ret_sts_error;
650 RETURN;
651 END IF;
652
653 END check_prty_url_assoc_uk_items;
654
655 PROCEDURE check_prty_url_assoc_req_items(
656 p_prty_url_assoc_rec IN prty_url_assoc_rec_type,
657 p_validation_mode IN VARCHAR2 := JTF_PLSQL_API.g_create,
658 x_return_status OUT NOCOPY VARCHAR2
659 )
660 IS
661 BEGIN
662 x_return_status := FND_API.g_ret_sts_success;
663
664 IF p_validation_mode = JTF_PLSQL_API.g_create THEN
665
666
667 IF p_prty_url_assoc_rec.assoc_id = FND_API.g_miss_num OR p_prty_url_assoc_rec.assoc_id IS NULL THEN
668 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_assoc_id');
669 x_return_status := FND_API.g_ret_sts_error;
670 RETURN;
671 END IF;
672
673
674 IF p_prty_url_assoc_rec.creation_date = FND_API.g_miss_date OR p_prty_url_assoc_rec.creation_date IS NULL THEN
675 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_creation_date');
676 x_return_status := FND_API.g_ret_sts_error;
677 RETURN;
678 END IF;
679
680
681 IF p_prty_url_assoc_rec.created_by = FND_API.g_miss_num OR p_prty_url_assoc_rec.created_by IS NULL THEN
682 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_created_by');
683 x_return_status := FND_API.g_ret_sts_error;
684 RETURN;
685 END IF;
686
687
688 IF p_prty_url_assoc_rec.last_update_date = FND_API.g_miss_date OR p_prty_url_assoc_rec.last_update_date IS NULL THEN
689 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_last_update_date');
690 x_return_status := FND_API.g_ret_sts_error;
691 RETURN;
692 END IF;
693
694
695 IF p_prty_url_assoc_rec.last_updated_by = FND_API.g_miss_num OR p_prty_url_assoc_rec.last_updated_by IS NULL THEN
696 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_last_updated_by');
697 x_return_status := FND_API.g_ret_sts_error;
698 RETURN;
699 END IF;
700
701
702 IF p_prty_url_assoc_rec.system_url_id = FND_API.g_miss_num OR p_prty_url_assoc_rec.system_url_id IS NULL THEN
703 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_system_url_id');
704 x_return_status := FND_API.g_ret_sts_error;
705 RETURN;
706 END IF;
707
708
709 IF p_prty_url_assoc_rec.used_by_obj_type = FND_API.g_miss_char OR p_prty_url_assoc_rec.used_by_obj_type IS NULL THEN
710 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_used_by_obj_type');
711 x_return_status := FND_API.g_ret_sts_error;
712 RETURN;
713 END IF;
714
715
716 IF p_prty_url_assoc_rec.used_by_obj_id = FND_API.g_miss_num OR p_prty_url_assoc_rec.used_by_obj_id IS NULL THEN
717 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_used_by_obj_id');
718 x_return_status := FND_API.g_ret_sts_error;
719 RETURN;
720 END IF;
721 ELSE
722
723
724 IF p_prty_url_assoc_rec.assoc_id IS NULL THEN
725 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_assoc_id');
726 x_return_status := FND_API.g_ret_sts_error;
727 RETURN;
728 END IF;
729
730
731 IF p_prty_url_assoc_rec.creation_date IS NULL THEN
732 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_creation_date');
733 x_return_status := FND_API.g_ret_sts_error;
734 RETURN;
735 END IF;
736
737
738 IF p_prty_url_assoc_rec.created_by IS NULL THEN
739 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_created_by');
740 x_return_status := FND_API.g_ret_sts_error;
741 RETURN;
742 END IF;
743
744
745 IF p_prty_url_assoc_rec.last_update_date IS NULL THEN
746 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_last_update_date');
747 x_return_status := FND_API.g_ret_sts_error;
748 RETURN;
749 END IF;
750
751
752 IF p_prty_url_assoc_rec.last_updated_by IS NULL THEN
753 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_last_updated_by');
754 x_return_status := FND_API.g_ret_sts_error;
755 RETURN;
756 END IF;
757
758
759 IF p_prty_url_assoc_rec.system_url_id IS NULL THEN
760 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_system_url_id');
761 x_return_status := FND_API.g_ret_sts_error;
762 RETURN;
763 END IF;
764
765
766 IF p_prty_url_assoc_rec.used_by_obj_type IS NULL THEN
767 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_used_by_obj_type');
768 x_return_status := FND_API.g_ret_sts_error;
769 RETURN;
770 END IF;
771
772
773 IF p_prty_url_assoc_rec.used_by_obj_id IS NULL THEN
774 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_prty_url_assoc_NO_used_by_obj_id');
775 x_return_status := FND_API.g_ret_sts_error;
776 RETURN;
777 END IF;
778 END IF;
779
780 END check_prty_url_assoc_req_items;
781
782 PROCEDURE check_prty_url_assoc_FK_items(
783 p_prty_url_assoc_rec IN prty_url_assoc_rec_type,
784 x_return_status OUT NOCOPY VARCHAR2
785 )
786 IS
787 BEGIN
788 x_return_status := FND_API.g_ret_sts_success;
789
790 -- Enter custom code here
791
792 END check_prty_url_assoc_FK_items;
793
794 PROCEDURE check_prty_url_asoc_lkup_itms(
795 p_prty_url_assoc_rec IN prty_url_assoc_rec_type,
796 x_return_status OUT NOCOPY VARCHAR2
797 )
798 IS
799 BEGIN
800 x_return_status := FND_API.g_ret_sts_success;
801
802 -- Enter custom code here
803
804 END check_prty_url_asoc_lkup_itms;
805
806 PROCEDURE Check_prty_url_assoc_Items (
807 P_prty_url_assoc_rec IN prty_url_assoc_rec_type,
808 p_validation_mode IN VARCHAR2,
809 x_return_status OUT NOCOPY VARCHAR2
810 )
811 IS
812 BEGIN
813
814 -- Check Items Uniqueness API calls
815
816 check_prty_url_assoc_uk_items(
817 p_prty_url_assoc_rec => p_prty_url_assoc_rec,
818 p_validation_mode => p_validation_mode,
819 x_return_status => x_return_status);
820 IF x_return_status <> FND_API.g_ret_sts_success THEN
821 RETURN;
822 END IF;
823
824 -- Check Items Required/NOT NULL API calls
825
826 check_prty_url_assoc_req_items(
827 p_prty_url_assoc_rec => p_prty_url_assoc_rec,
828 p_validation_mode => p_validation_mode,
829 x_return_status => x_return_status);
830 IF x_return_status <> FND_API.g_ret_sts_success THEN
831 RETURN;
832 END IF;
833 -- Check Items Foreign Keys API calls
834
835 check_prty_url_assoc_FK_items(
836 p_prty_url_assoc_rec => p_prty_url_assoc_rec,
837 x_return_status => x_return_status);
838 IF x_return_status <> FND_API.g_ret_sts_success THEN
839 RETURN;
840 END IF;
841 -- Check Items Lookups
842
843 check_prty_url_asoc_lkup_itms(
844 p_prty_url_assoc_rec => p_prty_url_assoc_rec,
845 x_return_status => x_return_status);
846 IF x_return_status <> FND_API.g_ret_sts_success THEN
847 RETURN;
848 END IF;
849
850 END Check_prty_url_assoc_Items;
851
852 PROCEDURE Complete_prty_url_assoc_Rec (
853 p_prty_url_assoc_rec IN prty_url_assoc_rec_type,
854 x_complete_rec OUT NOCOPY prty_url_assoc_rec_type)
855 IS
856 l_return_status VARCHAR2(1);
857
858 CURSOR c_complete IS
859 SELECT *
860 FROM ams_pretty_url_assoc
861 WHERE assoc_id = p_prty_url_assoc_rec.assoc_id;
862 l_prty_url_assoc_rec c_complete%ROWTYPE;
863 BEGIN
864 x_complete_rec := p_prty_url_assoc_rec;
865
866
867 OPEN c_complete;
868 FETCH c_complete INTO l_prty_url_assoc_rec;
869 CLOSE c_complete;
870
871 -- assoc_id
872 IF p_prty_url_assoc_rec.assoc_id = FND_API.g_miss_num THEN
873 x_complete_rec.assoc_id := l_prty_url_assoc_rec.assoc_id;
874 END IF;
875
876 -- creation_date
877 IF p_prty_url_assoc_rec.creation_date = FND_API.g_miss_date THEN
878 x_complete_rec.creation_date := l_prty_url_assoc_rec.creation_date;
879 END IF;
880
881 -- created_by
882 IF p_prty_url_assoc_rec.created_by = FND_API.g_miss_num THEN
883 x_complete_rec.created_by := l_prty_url_assoc_rec.created_by;
884 END IF;
885
886 -- last_update_date
887 IF p_prty_url_assoc_rec.last_update_date = FND_API.g_miss_date THEN
888 x_complete_rec.last_update_date := l_prty_url_assoc_rec.last_update_date;
889 END IF;
890
891 -- last_updated_by
892 IF p_prty_url_assoc_rec.last_updated_by = FND_API.g_miss_num THEN
893 x_complete_rec.last_updated_by := l_prty_url_assoc_rec.last_updated_by;
894 END IF;
895
896 -- last_update_login
897 IF p_prty_url_assoc_rec.last_update_login = FND_API.g_miss_num THEN
898 x_complete_rec.last_update_login := l_prty_url_assoc_rec.last_update_login;
899 END IF;
900
901 -- object_version_number
902 IF p_prty_url_assoc_rec.object_version_number = FND_API.g_miss_num THEN
903 x_complete_rec.object_version_number := l_prty_url_assoc_rec.object_version_number;
904 END IF;
905
906 -- system_url_id
907 IF p_prty_url_assoc_rec.system_url_id = FND_API.g_miss_num THEN
908 x_complete_rec.system_url_id := l_prty_url_assoc_rec.system_url_id;
909 END IF;
910
911 -- used_by_obj_type
912 IF p_prty_url_assoc_rec.used_by_obj_type = FND_API.g_miss_char THEN
913 x_complete_rec.used_by_obj_type := l_prty_url_assoc_rec.used_by_obj_type;
914 END IF;
915
916 -- used_by_obj_id
917 IF p_prty_url_assoc_rec.used_by_obj_id = FND_API.g_miss_num THEN
918 x_complete_rec.used_by_obj_id := l_prty_url_assoc_rec.used_by_obj_id;
919 END IF;
920 -- Note: Developers need to modify the procedure
921 -- to handle any business specific requirements.
922 END Complete_prty_url_assoc_Rec;
923 PROCEDURE Validate_prty_url_assoc(
924 p_api_version_number IN NUMBER,
925 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
926 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
927 p_prty_url_assoc_rec IN prty_url_assoc_rec_type,
928 x_return_status OUT NOCOPY VARCHAR2,
929 x_msg_count OUT NOCOPY NUMBER,
930 x_msg_data OUT NOCOPY VARCHAR2
931 )
932 IS
933 L_API_NAME CONSTANT VARCHAR2(30) := 'Validate_Prty_Url_Assoc';
934 L_API_VERSION_NUMBER CONSTANT NUMBER := 1.0;
935 l_object_version_number NUMBER;
936 l_prty_url_assoc_rec AMS_Prty_Url_Assoc_PVT.prty_url_assoc_rec_type;
937
938 BEGIN
939 -- Standard Start of API savepoint
940 SAVEPOINT VALIDATE_Prty_Url_Assoc_;
941
942 -- Standard call to check for call compatibility.
943 IF NOT FND_API.Compatible_API_Call ( l_api_version_number,
944 p_api_version_number,
945 l_api_name,
946 G_PKG_NAME)
947 THEN
948 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
949 END IF;
950
951 -- Initialize message list if p_init_msg_list is set to TRUE.
952 IF FND_API.to_Boolean( p_init_msg_list )
953 THEN
954 FND_MSG_PUB.initialize;
955 END IF;
956 IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
957 Check_prty_url_assoc_Items(
958 p_prty_url_assoc_rec => p_prty_url_assoc_rec,
959 p_validation_mode => JTF_PLSQL_API.g_update,
960 x_return_status => x_return_status
961 );
962
963 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
964 RAISE FND_API.G_EXC_ERROR;
965 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
966 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
967 END IF;
968 END IF;
969
970 Complete_prty_url_assoc_Rec(
971 p_prty_url_assoc_rec => p_prty_url_assoc_rec,
972 x_complete_rec => l_prty_url_assoc_rec
973 );
974
975 IF p_validation_level >= JTF_PLSQL_API.g_valid_level_item THEN
976 Validate_prty_url_assoc_Rec(
977 p_api_version_number => 1.0,
978 p_init_msg_list => FND_API.G_FALSE,
979 x_return_status => x_return_status,
980 x_msg_count => x_msg_count,
981 x_msg_data => x_msg_data,
982 p_prty_url_assoc_rec => l_prty_url_assoc_rec);
983
984 IF x_return_status = FND_API.G_RET_STS_ERROR THEN
985 RAISE FND_API.G_EXC_ERROR;
986 ELSIF x_return_status = FND_API.G_RET_STS_UNEXP_ERROR THEN
987 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
988 END IF;
989 END IF;
990
991
992 -- Debug Message
993 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'start');
994
995
996 -- Initialize API return status to SUCCESS
997 x_return_status := FND_API.G_RET_STS_SUCCESS;
998
999
1000 -- Debug Message
1001 AMS_UTILITY_PVT.debug_message('Private API: ' || l_api_name || 'end');
1002
1003 -- Standard call to get message count and if count is 1, get message info.
1004 FND_MSG_PUB.Count_And_Get
1005 (p_count => x_msg_count,
1006 p_data => x_msg_data
1007 );
1008 EXCEPTION
1009
1010 WHEN AMS_Utility_PVT.resource_locked THEN
1011 x_return_status := FND_API.g_ret_sts_error;
1012 AMS_Utility_PVT.Error_Message(p_message_name => 'AMS_API_RESOURCE_LOCKED');
1013
1014 WHEN FND_API.G_EXC_ERROR THEN
1015 ROLLBACK TO VALIDATE_Prty_Url_Assoc_;
1016 x_return_status := FND_API.G_RET_STS_ERROR;
1017 -- Standard call to get message count and if count=1, get the message
1018 FND_MSG_PUB.Count_And_Get (
1019 p_encoded => FND_API.G_FALSE,
1020 p_count => x_msg_count,
1021 p_data => x_msg_data
1022 );
1023
1024 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1025 ROLLBACK TO VALIDATE_Prty_Url_Assoc_;
1026 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1027 -- Standard call to get message count and if count=1, get the message
1028 FND_MSG_PUB.Count_And_Get (
1029 p_encoded => FND_API.G_FALSE,
1030 p_count => x_msg_count,
1031 p_data => x_msg_data
1032 );
1033
1034 WHEN OTHERS THEN
1035 ROLLBACK TO VALIDATE_Prty_Url_Assoc_;
1036 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1037 IF FND_MSG_PUB.Check_Msg_Level ( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1038 THEN
1039 FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME,l_api_name);
1040 END IF;
1041 -- Standard call to get message count and if count=1, get the message
1042 FND_MSG_PUB.Count_And_Get (
1043 p_encoded => FND_API.G_FALSE,
1044 p_count => x_msg_count,
1045 p_data => x_msg_data
1046 );
1047 End Validate_Prty_Url_Assoc;
1048
1049
1050 PROCEDURE Validate_prty_url_assoc_rec(
1051 p_api_version_number IN NUMBER,
1052 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
1053 x_return_status OUT NOCOPY VARCHAR2,
1054 x_msg_count OUT NOCOPY NUMBER,
1055 x_msg_data OUT NOCOPY VARCHAR2,
1056 p_prty_url_assoc_rec IN prty_url_assoc_rec_type
1057 )
1058 IS
1059 BEGIN
1060 -- Initialize message list if p_init_msg_list is set to TRUE.
1061 IF FND_API.to_Boolean( p_init_msg_list )
1062 THEN
1063 FND_MSG_PUB.initialize;
1064 END IF;
1065
1066 -- Initialize API return status to SUCCESS
1067 x_return_status := FND_API.G_RET_STS_SUCCESS;
1068
1069 -- Hint: Validate data
1070 -- If data not valid
1071 -- THEN
1072 -- x_return_status := FND_API.G_RET_STS_ERROR;
1073
1074 -- Debug Message
1075 AMS_UTILITY_PVT.debug_message('Private API: Validate_dm_model_rec');
1076 -- Standard call to get message count and if count is 1, get message info.
1077 FND_MSG_PUB.Count_And_Get
1078 (p_count => x_msg_count,
1079 p_data => x_msg_data
1080 );
1081 END Validate_prty_url_assoc_Rec;
1082
1083 END AMS_Prty_Url_Assoc_PVT;