1: PACKAGE BODY jtf_rs_group_usages_pvt AS
2: /* $Header: jtfrsvab.pls 120.0 2005/05/11 08:22:52 appldev ship $ */
3:
4: /*****************************************************************************************
5: This private package body defines the procedures for managing resource group usages,
13:
14:
15: /* Package variables. */
16:
17: G_PKG_NAME VARCHAR2(30) := 'JTF_RS_GROUP_USAGES_PVT';
18:
19:
20: /* Procedure to create the resource group usage
21: based on input values passed by calling routines. */
23: PROCEDURE create_group_usage
24: (P_API_VERSION IN NUMBER,
25: P_INIT_MSG_LIST IN VARCHAR2,
26: P_COMMIT IN VARCHAR2,
27: P_GROUP_ID IN JTF_RS_GROUP_USAGES.GROUP_ID%TYPE,
28: P_USAGE IN JTF_RS_GROUP_USAGES.USAGE%TYPE,
29: P_ATTRIBUTE1 IN JTF_RS_GROUP_MEMBERS.ATTRIBUTE1%TYPE,
30: P_ATTRIBUTE2 IN JTF_RS_GROUP_MEMBERS.ATTRIBUTE2%TYPE,
31: P_ATTRIBUTE3 IN JTF_RS_GROUP_MEMBERS.ATTRIBUTE3%TYPE,
24: (P_API_VERSION IN NUMBER,
25: P_INIT_MSG_LIST IN VARCHAR2,
26: P_COMMIT IN VARCHAR2,
27: P_GROUP_ID IN JTF_RS_GROUP_USAGES.GROUP_ID%TYPE,
28: P_USAGE IN JTF_RS_GROUP_USAGES.USAGE%TYPE,
29: P_ATTRIBUTE1 IN JTF_RS_GROUP_MEMBERS.ATTRIBUTE1%TYPE,
30: P_ATTRIBUTE2 IN JTF_RS_GROUP_MEMBERS.ATTRIBUTE2%TYPE,
31: P_ATTRIBUTE3 IN JTF_RS_GROUP_MEMBERS.ATTRIBUTE3%TYPE,
32: P_ATTRIBUTE4 IN JTF_RS_GROUP_MEMBERS.ATTRIBUTE4%TYPE,
44: P_ATTRIBUTE_CATEGORY IN JTF_RS_GROUP_MEMBERS.ATTRIBUTE_CATEGORY%TYPE,
45: X_RETURN_STATUS OUT NOCOPY VARCHAR2,
46: X_MSG_COUNT OUT NOCOPY NUMBER,
47: X_MSG_DATA OUT NOCOPY VARCHAR2,
48: X_GROUP_USAGE_ID OUT NOCOPY JTF_RS_GROUP_USAGES.GROUP_USAGE_ID%TYPE
49: ) IS
50:
51: l_api_version CONSTANT NUMBER := 1.0;
52: l_api_name CONSTANT VARCHAR2(30) := 'CREATE_GROUP_USAGE';
49: ) IS
50:
51: l_api_version CONSTANT NUMBER := 1.0;
52: l_api_name CONSTANT VARCHAR2(30) := 'CREATE_GROUP_USAGE';
53: l_group_id jtf_rs_group_usages.group_id%TYPE := p_group_id;
54: l_usage jtf_rs_group_usages.usage%TYPE := upper(p_usage);
55:
56: l_rowid ROWID;
57: l_group_usage_id jtf_rs_group_usages.group_usage_id%TYPE;
50:
51: l_api_version CONSTANT NUMBER := 1.0;
52: l_api_name CONSTANT VARCHAR2(30) := 'CREATE_GROUP_USAGE';
53: l_group_id jtf_rs_group_usages.group_id%TYPE := p_group_id;
54: l_usage jtf_rs_group_usages.usage%TYPE := upper(p_usage);
55:
56: l_rowid ROWID;
57: l_group_usage_id jtf_rs_group_usages.group_usage_id%TYPE;
58: l_check_char VARCHAR2(1);
53: l_group_id jtf_rs_group_usages.group_id%TYPE := p_group_id;
54: l_usage jtf_rs_group_usages.usage%TYPE := upper(p_usage);
55:
56: l_rowid ROWID;
57: l_group_usage_id jtf_rs_group_usages.group_usage_id%TYPE;
58: l_check_char VARCHAR2(1);
59: l_check_count NUMBER;
60: l_bind_data_id NUMBER;
61:
68: FROM jtf_rs_groups_vl G1,
69: jtf_rs_groups_vl G2,
70: jtf_rs_group_members GM1,
71: jtf_rs_group_members GM2,
72: jtf_rs_group_usages GU2,
73: jtf_rs_role_relations RR1,
74: jtf_rs_role_relations RR2
75: WHERE G1.group_id = GM1.group_id
76: AND G2.group_id = GM2.group_id
100: AND G1.group_id = l_group_id
101: AND nvl(G1.exclusive_flag,'N') = 'Y';
102:
103:
104: CURSOR c_jtf_rs_group_usages( l_rowid IN ROWID ) IS
105: SELECT 'Y'
106: FROM jtf_rs_group_usages
107: WHERE ROWID = l_rowid;
108:
102:
103:
104: CURSOR c_jtf_rs_group_usages( l_rowid IN ROWID ) IS
105: SELECT 'Y'
106: FROM jtf_rs_group_usages
107: WHERE ROWID = l_rowid;
108:
109:
110: BEGIN
135:
136: /* Pre Call to the Customer Type User Hook */
137:
138: IF jtf_resource_utl.ok_to_execute(
139: 'JTF_RS_GROUP_USAGES_PVT',
140: 'CREATE_GROUP_USAGE',
141: 'B',
142: 'C')
143: THEN
141: 'B',
142: 'C')
143: THEN
144: IF jtf_usr_hks.ok_to_execute(
145: 'JTF_RS_GROUP_USAGES_PVT',
146: 'CREATE_GROUP_USAGE',
147: 'B',
148: 'C')
149: THEN
172:
173: /* Pre Call to the Vertical Type User Hook */
174:
175: IF jtf_resource_utl.ok_to_execute(
176: 'JTF_RS_GROUP_USAGES_PVT',
177: 'CREATE_GROUP_USAGE',
178: 'B',
179: 'V')
180: THEN
178: 'B',
179: 'V')
180: THEN
181: IF jtf_usr_hks.ok_to_execute(
182: 'JTF_RS_GROUP_USAGES_PVT',
183: 'CREATE_GROUP_USAGE',
184: 'B',
185: 'V')
186: THEN
209:
210: /* Pre Call to the Internal Type User Hook */
211:
212: IF jtf_resource_utl.ok_to_execute(
213: 'JTF_RS_GROUP_USAGES_PVT',
214: 'CREATE_GROUP_USAGE',
215: 'B',
216: 'I')
217: THEN
215: 'B',
216: 'I')
217: THEN
218: IF jtf_usr_hks.ok_to_execute(
219: 'JTF_RS_GROUP_USAGES_PVT',
220: 'CREATE_GROUP_USAGE',
221: 'B',
222: 'I')
223: THEN
247: l_check_count := 0;
248:
249: SELECT count(*)
250: INTO l_check_count
251: FROM jtf_rs_group_usages
252: WHERE group_id = l_group_id
253: AND usage = l_usage;
254:
255: IF l_check_count > 0 THEN
309:
310:
311: /* Get the next value of the Group_usage_id from the sequence. */
312:
313: SELECT jtf_rs_group_usages_s.nextval
314: INTO l_group_usage_id
315: FROM dual;
316:
317:
316:
317:
318: /* Insert the row into the table by calling the table handler. */
319:
320: jtf_rs_group_usages_pkg.insert_row(
321: x_rowid => l_rowid,
322: x_group_usage_id => l_group_usage_id,
323: x_group_id => l_group_id,
324: x_usage => l_usage,
347:
348:
349: -- dbms_output.put_line('Inserted Row');
350:
351: OPEN c_jtf_rs_group_usages(l_rowid);
352:
353: FETCH c_jtf_rs_group_usages INTO l_check_char;
354:
355:
349: -- dbms_output.put_line('Inserted Row');
350:
351: OPEN c_jtf_rs_group_usages(l_rowid);
352:
353: FETCH c_jtf_rs_group_usages INTO l_check_char;
354:
355:
356: IF c_jtf_rs_group_usages%NOTFOUND THEN
357:
352:
353: FETCH c_jtf_rs_group_usages INTO l_check_char;
354:
355:
356: IF c_jtf_rs_group_usages%NOTFOUND THEN
357:
358: -- dbms_output.put_line('Error in Table Handler');
359:
360: x_return_status := fnd_api.g_ret_sts_unexp_error;
361:
362: fnd_message.set_name('JTF', 'JTF_RS_TABLE_HANDLER_ERROR');
363: fnd_msg_pub.add;
364:
365: IF c_jtf_rs_group_usages%ISOPEN THEN
366:
367: CLOSE c_jtf_rs_group_usages;
368:
369: END IF;
363: fnd_msg_pub.add;
364:
365: IF c_jtf_rs_group_usages%ISOPEN THEN
366:
367: CLOSE c_jtf_rs_group_usages;
368:
369: END IF;
370:
371: RAISE fnd_api.g_exc_unexpected_error;
380:
381:
382: /* Close the cursors */
383:
384: IF c_jtf_rs_group_usages%ISOPEN THEN
385:
386: CLOSE c_jtf_rs_group_usages;
387:
388: END IF;
382: /* Close the cursors */
383:
384: IF c_jtf_rs_group_usages%ISOPEN THEN
385:
386: CLOSE c_jtf_rs_group_usages;
387:
388: END IF;
389:
390:
393:
394: /* Post Call to the Customer Type User Hook */
395:
396: IF jtf_resource_utl.ok_to_execute(
397: 'JTF_RS_GROUP_USAGES_PVT',
398: 'CREATE_GROUP_USAGE',
399: 'A',
400: 'C')
401: THEN
399: 'A',
400: 'C')
401: THEN
402: IF jtf_usr_hks.ok_to_execute(
403: 'JTF_RS_GROUP_USAGES_PVT',
404: 'CREATE_GROUP_USAGE',
405: 'A',
406: 'C')
407: THEN
431:
432: /* Post Call to the Vertical Type User Hook */
433:
434: IF jtf_resource_utl.ok_to_execute(
435: 'JTF_RS_GROUP_USAGES_PVT',
436: 'CREATE_GROUP_USAGE',
437: 'A',
438: 'V')
439: THEN
437: 'A',
438: 'V')
439: THEN
440: IF jtf_usr_hks.ok_to_execute(
441: 'JTF_RS_GROUP_USAGES_PVT',
442: 'CREATE_GROUP_USAGE',
443: 'A',
444: 'V')
445: THEN
469:
470: /* Post Call to the Internal Type User Hook */
471:
472: IF jtf_resource_utl.ok_to_execute(
473: 'JTF_RS_GROUP_USAGES_PVT',
474: 'CREATE_GROUP_USAGE',
475: 'A',
476: 'I')
477: THEN
475: 'A',
476: 'I')
477: THEN
478: IF jtf_usr_hks.ok_to_execute(
479: 'JTF_RS_GROUP_USAGES_PVT',
480: 'CREATE_GROUP_USAGE',
481: 'A',
482: 'I')
483: THEN
505:
506: /* Standard call for Message Generation */
507:
508: IF jtf_resource_utl.ok_to_execute(
509: 'JTF_RS_GROUP_USAGES_PVT',
510: 'CREATE_GROUP_USAGE',
511: 'M',
512: 'M')
513: THEN
511: 'M',
512: 'M')
513: THEN
514: IF jtf_usr_hks.ok_to_execute(
515: 'JTF_RS_GROUP_USAGES_PVT',
516: 'CREATE_GROUP_USAGE',
517: 'M',
518: 'M')
519: THEN
618: PROCEDURE delete_group_usage
619: (P_API_VERSION IN NUMBER,
620: P_INIT_MSG_LIST IN VARCHAR2,
621: P_COMMIT IN VARCHAR2,
622: P_GROUP_ID IN JTF_RS_GROUP_USAGES.GROUP_ID%TYPE,
623: P_USAGE IN JTF_RS_GROUP_USAGES.USAGE%TYPE,
624: P_OBJECT_VERSION_NUM IN JTF_RS_GROUP_USAGES.OBJECT_VERSION_NUMBER%TYPE,
625: X_RETURN_STATUS OUT NOCOPY VARCHAR2,
626: X_MSG_COUNT OUT NOCOPY NUMBER,
619: (P_API_VERSION IN NUMBER,
620: P_INIT_MSG_LIST IN VARCHAR2,
621: P_COMMIT IN VARCHAR2,
622: P_GROUP_ID IN JTF_RS_GROUP_USAGES.GROUP_ID%TYPE,
623: P_USAGE IN JTF_RS_GROUP_USAGES.USAGE%TYPE,
624: P_OBJECT_VERSION_NUM IN JTF_RS_GROUP_USAGES.OBJECT_VERSION_NUMBER%TYPE,
625: X_RETURN_STATUS OUT NOCOPY VARCHAR2,
626: X_MSG_COUNT OUT NOCOPY NUMBER,
627: X_MSG_DATA OUT NOCOPY VARCHAR2
620: P_INIT_MSG_LIST IN VARCHAR2,
621: P_COMMIT IN VARCHAR2,
622: P_GROUP_ID IN JTF_RS_GROUP_USAGES.GROUP_ID%TYPE,
623: P_USAGE IN JTF_RS_GROUP_USAGES.USAGE%TYPE,
624: P_OBJECT_VERSION_NUM IN JTF_RS_GROUP_USAGES.OBJECT_VERSION_NUMBER%TYPE,
625: X_RETURN_STATUS OUT NOCOPY VARCHAR2,
626: X_MSG_COUNT OUT NOCOPY NUMBER,
627: X_MSG_DATA OUT NOCOPY VARCHAR2
628: ) IS
628: ) IS
629:
630: l_api_version CONSTANT NUMBER := 1.0;
631: l_api_name CONSTANT VARCHAR2(30) := 'DELETE_GROUP_USAGE';
632: l_group_id jtf_rs_group_usages.group_id%TYPE := p_group_id;
633: l_usage jtf_rs_group_usages.usage%TYPE := upper(p_usage);
634:
635: l_check_char VARCHAR2(1);
636: l_group_usage_id jtf_rs_group_usages.group_usage_id%TYPE;
629:
630: l_api_version CONSTANT NUMBER := 1.0;
631: l_api_name CONSTANT VARCHAR2(30) := 'DELETE_GROUP_USAGE';
632: l_group_id jtf_rs_group_usages.group_id%TYPE := p_group_id;
633: l_usage jtf_rs_group_usages.usage%TYPE := upper(p_usage);
634:
635: l_check_char VARCHAR2(1);
636: l_group_usage_id jtf_rs_group_usages.group_usage_id%TYPE;
637: l_bind_data_id NUMBER;
632: l_group_id jtf_rs_group_usages.group_id%TYPE := p_group_id;
633: l_usage jtf_rs_group_usages.usage%TYPE := upper(p_usage);
634:
635: l_check_char VARCHAR2(1);
636: l_group_usage_id jtf_rs_group_usages.group_usage_id%TYPE;
637: l_bind_data_id NUMBER;
638:
639:
640: CURSOR c_group_usage_id(
641: l_group_id IN NUMBER,
642: l_usage IN VARCHAR2 )
643: IS
644: SELECT group_usage_id
645: FROM jtf_rs_group_usages
646: WHERE group_id = l_group_id
647: AND usage = l_usage;
648:
649: -- Added the below cursor to get the meaning of the usage code passed.
686:
687: /* Pre Call to the Customer Type User Hook */
688:
689: IF jtf_resource_utl.ok_to_execute(
690: 'JTF_RS_GROUP_USAGES_PVT',
691: 'DELETE_GROUP_USAGE',
692: 'B',
693: 'C')
694: THEN
692: 'B',
693: 'C')
694: THEN
695: IF jtf_usr_hks.ok_to_execute(
696: 'JTF_RS_GROUP_USAGES_PVT',
697: 'DELETE_GROUP_USAGE',
698: 'B',
699: 'C')
700: THEN
723:
724: /* Pre Call to the Vertical Type User Hook */
725:
726: IF jtf_resource_utl.ok_to_execute(
727: 'JTF_RS_GROUP_USAGES_PVT',
728: 'DELETE_GROUP_USAGE',
729: 'B',
730: 'V')
731: THEN
729: 'B',
730: 'V')
731: THEN
732: IF jtf_usr_hks.ok_to_execute(
733: 'JTF_RS_GROUP_USAGES_PVT',
734: 'DELETE_GROUP_USAGE',
735: 'B',
736: 'V')
737: THEN
760:
761: /* Pre Call to the Internal Type User Hook */
762:
763: IF jtf_resource_utl.ok_to_execute(
764: 'JTF_RS_GROUP_USAGES_PVT',
765: 'DELETE_GROUP_USAGE',
766: 'B',
767: 'I')
768: THEN
766: 'B',
767: 'I')
768: THEN
769: IF jtf_usr_hks.ok_to_execute(
770: 'JTF_RS_GROUP_USAGES_PVT',
771: 'DELETE_GROUP_USAGE',
772: 'B',
773: 'I')
774: THEN
855: is still valid. */
856:
857: BEGIN
858:
859: jtf_rs_group_usages_pkg.lock_row(
860: x_group_usage_id => l_group_usage_id,
861: x_object_version_number => p_object_version_num
862: );
863:
883: BEGIN
884:
885: /* Delete the row into the table by calling the table handler. */
886:
887: jtf_rs_group_usages_pkg.delete_row(
888: x_group_usage_id => l_group_usage_id
889: );
890:
891: EXCEPTION
909:
910: /* Post Call to the Customer Type User Hook */
911:
912: IF jtf_resource_utl.ok_to_execute(
913: 'JTF_RS_GROUP_USAGES_PVT',
914: 'DELETE_GROUP_USAGE',
915: 'A',
916: 'C')
917: THEN
915: 'A',
916: 'C')
917: THEN
918: IF jtf_usr_hks.ok_to_execute(
919: 'JTF_RS_GROUP_USAGES_PVT',
920: 'DELETE_GROUP_USAGE',
921: 'A',
922: 'C')
923: THEN
946:
947: /* Post Call to the Vertical Type User Hook */
948:
949: IF jtf_resource_utl.ok_to_execute(
950: 'JTF_RS_GROUP_USAGES_PVT',
951: 'DELETE_GROUP_USAGE',
952: 'A',
953: 'V')
954: THEN
952: 'A',
953: 'V')
954: THEN
955: IF jtf_usr_hks.ok_to_execute(
956: 'JTF_RS_GROUP_USAGES_PVT',
957: 'DELETE_GROUP_USAGE',
958: 'A',
959: 'V')
960: THEN
983:
984: /* Post Call to the Internal Type User Hook */
985:
986: IF jtf_resource_utl.ok_to_execute(
987: 'JTF_RS_GROUP_USAGES_PVT',
988: 'DELETE_GROUP_USAGE',
989: 'A',
990: 'I')
991: THEN
989: 'A',
990: 'I')
991: THEN
992: IF jtf_usr_hks.ok_to_execute(
993: 'JTF_RS_GROUP_USAGES_PVT',
994: 'DELETE_GROUP_USAGE',
995: 'A',
996: 'I')
997: THEN
1018:
1019: /* Standard call for Message Generation */
1020:
1021: IF jtf_resource_utl.ok_to_execute(
1022: 'JTF_RS_GROUP_USAGES_PVT',
1023: 'DELETE_GROUP_USAGE',
1024: 'M',
1025: 'M')
1026: THEN
1024: 'M',
1025: 'M')
1026: THEN
1027: IF jtf_usr_hks.ok_to_execute(
1028: 'JTF_RS_GROUP_USAGES_PVT',
1029: 'DELETE_GROUP_USAGE',
1030: 'M',
1031: 'M')
1032: THEN
1129:
1130: END delete_group_usage;
1131:
1132:
1133: END jtf_rs_group_usages_pvt;