99:
100: FUNCTION handle_miss_num(p_value NUMBER, p_default_value NUMBER)
101: RETURN NUMBER IS
102: BEGIN
103: IF p_value = fnd_api.g_miss_num THEN
104: RETURN NULL;
105: ELSE
106: RETURN NVL(p_value, p_default_value);
107: END IF;
109:
110: FUNCTION handle_miss_char(p_value VARCHAR2, p_default_value VARCHAR2)
111: RETURN VARCHAR2 IS
112: BEGIN
113: IF p_value = fnd_api.g_miss_char THEN
114: RETURN NULL;
115: ELSE
116: RETURN NVL(p_value, p_default_value);
117: END IF;
430:
431: IF p_rule_name IS NULL THEN
432: fnd_message.set_name('CSR', 'CSR_RULE_NAME_NOT_GIVEN');
433: fnd_msg_pub.ADD;
434: RAISE fnd_api.g_exc_error;
435: END IF;
436:
437: IF p_rule_doc IS NULL THEN
438: fnd_message.set_name('CSR', 'CSR_RULE_DOC_NOT_GIVEN');
436:
437: IF p_rule_doc IS NULL THEN
438: fnd_message.set_name('CSR', 'CSR_RULE_DOC_NOT_GIVEN');
439: fnd_msg_pub.ADD;
440: RAISE fnd_api.g_exc_error;
441: END IF;
442:
443: IF NVL(p_resource_id, -9999) <> -9999 AND NVL(p_resource_type, '-') = '-'
444: OR NVL(p_resource_id, -9999) = -9999 AND NVL(p_resource_type, '-') <> '-'
448: ELSE
449: fnd_message.set_name ('JTF', 'JTF_RS_RESOURCE_CATEGORY_NULL');
450: END IF;
451: fnd_msg_pub.ADD;
452: RAISE fnd_api.g_exc_error;
453: END IF;
454:
455: IF l_debug = 'Y' THEN
456: debug('Checking for Eligibility', l_api_name, fnd_log.level_statement);
464: AND (p_resource_id IS NULL OR p_resource_id = g_not_specified)
465: THEN
466: fnd_message.set_name('CSR', 'CSR_RULE_ELIGIBILITY_NOT_GIVEN');
467: fnd_msg_pub.ADD;
468: RAISE fnd_api.g_exc_error;
469: END IF;
470:
471: IF l_debug = 'Y' THEN
472: debug('Checking for Duplicates', l_api_name, fnd_log.level_statement);
480: IF l_duplicate_rule.rule_id IS NOT NULL THEN
481: fnd_message.set_name('CSR', 'CSR_RULE_DUPLICATION');
482: fnd_message.set_token ('RULE_NAME', l_duplicate_rule.rule_name);
483: fnd_msg_pub.ADD;
484: RAISE fnd_api.g_exc_error;
485: END IF;
486:
487: IF p_rule_rank NOT IN (0, 2, 4, 8, 16, 32) THEN
488: IF l_debug = 'Y' THEN
869: BEGIN
870: SAVEPOINT csr_rule_create;
871:
872: -- Check for API Compatibility
873: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
874: RAISE fnd_api.g_exc_unexpected_error;
875: END IF;
876:
877: -- Initialize Message Stack if required
870: SAVEPOINT csr_rule_create;
871:
872: -- Check for API Compatibility
873: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
874: RAISE fnd_api.g_exc_unexpected_error;
875: END IF;
876:
877: -- Initialize Message Stack if required
878: IF fnd_api.to_boolean(p_init_msg_list) THEN
874: RAISE fnd_api.g_exc_unexpected_error;
875: END IF;
876:
877: -- Initialize Message Stack if required
878: IF fnd_api.to_boolean(p_init_msg_list) THEN
879: fnd_msg_pub.initialize;
880: END IF;
881:
882: -- Initialize Return Status
879: fnd_msg_pub.initialize;
880: END IF;
881:
882: -- Initialize Return Status
883: x_return_status := fnd_api.g_ret_sts_success;
884:
885: IF l_debug = 'Y' THEN
886: debug('Creating Rule', l_api_name, fnd_log.level_event);
887: debug(' --> Rule Name = ' || p_rule_name, l_api_name, fnd_log.level_event);
945: );
946:
947: x_new_rule_doc := l_rule_doc.getClobVal();
948:
949: IF fnd_api.to_boolean(p_commit) THEN
950: COMMIT;
951: END IF;
952:
953: EXCEPTION
950: COMMIT;
951: END IF;
952:
953: EXCEPTION
954: WHEN fnd_api.g_exc_error THEN
955: ROLLBACK TO csr_rule_create;
956: x_return_status := fnd_api.g_ret_sts_error;
957: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
958: IF l_debug = 'Y' THEN
952:
953: EXCEPTION
954: WHEN fnd_api.g_exc_error THEN
955: ROLLBACK TO csr_rule_create;
956: x_return_status := fnd_api.g_ret_sts_error;
957: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
958: IF l_debug = 'Y' THEN
959: debug('Create Rule Errored with ' || x_msg_data, l_api_name, fnd_log.level_error);
960: END IF;
957: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
958: IF l_debug = 'Y' THEN
959: debug('Create Rule Errored with ' || x_msg_data, l_api_name, fnd_log.level_error);
960: END IF;
961: WHEN fnd_api.g_exc_unexpected_error THEN
962: ROLLBACK TO csr_rule_create;
963: x_return_status := fnd_api.g_ret_sts_unexp_error;
964: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
965: IF l_debug = 'Y' THEN
959: debug('Create Rule Errored with ' || x_msg_data, l_api_name, fnd_log.level_error);
960: END IF;
961: WHEN fnd_api.g_exc_unexpected_error THEN
962: ROLLBACK TO csr_rule_create;
963: x_return_status := fnd_api.g_ret_sts_unexp_error;
964: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
965: IF l_debug = 'Y' THEN
966: debug('Create Rule Errored with ' || x_msg_data, l_api_name, fnd_log.level_error);
967: END IF;
965: IF l_debug = 'Y' THEN
966: debug('Create Rule Errored with ' || x_msg_data, l_api_name, fnd_log.level_error);
967: END IF;
968: WHEN OTHERS THEN
969: x_return_status := fnd_api.g_ret_sts_unexp_error;
970: IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_unexp_error) THEN
971: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
972: END IF;
973: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1039: BEGIN
1040: SAVEPOINT csr_rule_update;
1041:
1042: -- Check for API Compatibility
1043: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1044: RAISE fnd_api.g_exc_unexpected_error;
1045: END IF;
1046:
1047: -- Initialize Message Stack if required
1040: SAVEPOINT csr_rule_update;
1041:
1042: -- Check for API Compatibility
1043: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1044: RAISE fnd_api.g_exc_unexpected_error;
1045: END IF;
1046:
1047: -- Initialize Message Stack if required
1048: IF fnd_api.to_boolean(p_init_msg_list) THEN
1044: RAISE fnd_api.g_exc_unexpected_error;
1045: END IF;
1046:
1047: -- Initialize Message Stack if required
1048: IF fnd_api.to_boolean(p_init_msg_list) THEN
1049: fnd_msg_pub.initialize;
1050: END IF;
1051:
1052: -- Initialize Return Status
1049: fnd_msg_pub.initialize;
1050: END IF;
1051:
1052: -- Initialize Return Status
1053: x_return_status := fnd_api.g_ret_sts_success;
1054:
1055: IF l_debug = 'Y' THEN
1056: debug('Updating Rule#' || p_rule_id, l_api_name, fnd_log.level_event);
1057: debug(' --> Rule Name = ' || p_rule_name, l_api_name, fnd_log.level_statement);
1079: IF l_rule.rule_id IS NULL THEN
1080: fnd_message.set_name('CSR', 'CSR_RULE_NOT_FOUND');
1081: fnd_message.set_token('RULE_ID', p_rule_id);
1082: fnd_msg_pub.ADD;
1083: RAISE fnd_api.g_exc_error;
1084: END IF;
1085:
1086: IF l_rule.object_version_number <> p_object_version_number THEN
1087: fnd_message.set_name ('JTF', 'JTF_API_RECORD_NOT_FOUND');
1085:
1086: IF l_rule.object_version_number <> p_object_version_number THEN
1087: fnd_message.set_name ('JTF', 'JTF_API_RECORD_NOT_FOUND');
1088: fnd_msg_pub.ADD;
1089: RAISE fnd_api.g_exc_error;
1090: END IF;
1091:
1092: l_old_rule_doc := l_rule.rule_doc;
1093: p_object_version_number := p_object_version_number + 1;
1189: END IF;
1190:
1191: x_new_rule_doc := l_rule.rule_doc.getClobVal();
1192:
1193: IF fnd_api.to_boolean(p_commit) THEN
1194: COMMIT;
1195: END IF;
1196:
1197: EXCEPTION
1194: COMMIT;
1195: END IF;
1196:
1197: EXCEPTION
1198: WHEN fnd_api.g_exc_error THEN
1199: ROLLBACK TO csr_rule_update;
1200: x_return_status := fnd_api.g_ret_sts_error;
1201: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1202: IF l_debug = 'Y' THEN
1196:
1197: EXCEPTION
1198: WHEN fnd_api.g_exc_error THEN
1199: ROLLBACK TO csr_rule_update;
1200: x_return_status := fnd_api.g_ret_sts_error;
1201: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1202: IF l_debug = 'Y' THEN
1203: debug('Update Rule Errored with ' || x_msg_data, l_api_name, fnd_log.level_error);
1204: END IF;
1201: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1202: IF l_debug = 'Y' THEN
1203: debug('Update Rule Errored with ' || x_msg_data, l_api_name, fnd_log.level_error);
1204: END IF;
1205: WHEN fnd_api.g_exc_unexpected_error THEN
1206: ROLLBACK TO csr_rule_update;
1207: x_return_status := fnd_api.g_ret_sts_unexp_error;
1208: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1209: IF l_debug = 'Y' THEN
1203: debug('Update Rule Errored with ' || x_msg_data, l_api_name, fnd_log.level_error);
1204: END IF;
1205: WHEN fnd_api.g_exc_unexpected_error THEN
1206: ROLLBACK TO csr_rule_update;
1207: x_return_status := fnd_api.g_ret_sts_unexp_error;
1208: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1209: IF l_debug = 'Y' THEN
1210: debug('Update Rule Errored with ' || x_msg_data, l_api_name, fnd_log.level_error);
1211: END IF;
1209: IF l_debug = 'Y' THEN
1210: debug('Update Rule Errored with ' || x_msg_data, l_api_name, fnd_log.level_error);
1211: END IF;
1212: WHEN OTHERS THEN
1213: x_return_status := fnd_api.g_ret_sts_unexp_error;
1214: IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1215: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1216: END IF;
1217: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1250: BEGIN
1251: SAVEPOINT csr_rule_delete;
1252:
1253: -- Check for API Compatibility
1254: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1255: RAISE fnd_api.g_exc_unexpected_error;
1256: END IF;
1257:
1258: -- Initialize Message Stack if required
1251: SAVEPOINT csr_rule_delete;
1252:
1253: -- Check for API Compatibility
1254: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1255: RAISE fnd_api.g_exc_unexpected_error;
1256: END IF;
1257:
1258: -- Initialize Message Stack if required
1259: IF fnd_api.to_boolean(p_init_msg_list) THEN
1255: RAISE fnd_api.g_exc_unexpected_error;
1256: END IF;
1257:
1258: -- Initialize Message Stack if required
1259: IF fnd_api.to_boolean(p_init_msg_list) THEN
1260: fnd_msg_pub.initialize;
1261: END IF;
1262:
1263: -- Initialize Return Status
1260: fnd_msg_pub.initialize;
1261: END IF;
1262:
1263: -- Initialize Return Status
1264: x_return_status := fnd_api.g_ret_sts_success;
1265:
1266: IF l_debug = 'Y' THEN
1267: debug('Deleting Rule#' || p_rule_id || ' and the entire hierarchy', l_api_name, fnd_log.level_event);
1268: END IF;
1283: , x_return_status => x_return_status
1284: , x_msg_count => x_msg_count
1285: , x_msg_data => x_msg_data
1286: , p_jtf_note_id => v_note.jtf_note_id
1287: , p_use_AOL_security => fnd_api.g_false
1288: );
1289:
1290: IF x_return_status <> fnd_api.g_ret_sts_success THEN
1291: RAISE fnd_api.g_exc_error;
1286: , p_jtf_note_id => v_note.jtf_note_id
1287: , p_use_AOL_security => fnd_api.g_false
1288: );
1289:
1290: IF x_return_status <> fnd_api.g_ret_sts_success THEN
1291: RAISE fnd_api.g_exc_error;
1292: END IF;
1293: END LOOP;
1294:
1287: , p_use_AOL_security => fnd_api.g_false
1288: );
1289:
1290: IF x_return_status <> fnd_api.g_ret_sts_success THEN
1291: RAISE fnd_api.g_exc_error;
1292: END IF;
1293: END LOOP;
1294:
1295: DELETE csr_rules_tl WHERE rule_id = v_child_rule.rule_id;
1295: DELETE csr_rules_tl WHERE rule_id = v_child_rule.rule_id;
1296: DELETE csr_rules_b WHERE rule_id = v_child_rule.rule_id;
1297: END LOOP;
1298:
1299: IF fnd_api.to_boolean(p_commit) THEN
1300: COMMIT;
1301: END IF;
1302:
1303: EXCEPTION
1300: COMMIT;
1301: END IF;
1302:
1303: EXCEPTION
1304: WHEN fnd_api.g_exc_error THEN
1305: ROLLBACK TO csr_rule_delete;
1306: x_return_status := fnd_api.g_ret_sts_error;
1307: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1308: WHEN fnd_api.g_exc_unexpected_error THEN
1302:
1303: EXCEPTION
1304: WHEN fnd_api.g_exc_error THEN
1305: ROLLBACK TO csr_rule_delete;
1306: x_return_status := fnd_api.g_ret_sts_error;
1307: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1308: WHEN fnd_api.g_exc_unexpected_error THEN
1309: ROLLBACK TO csr_rule_delete;
1310: x_return_status := fnd_api.g_ret_sts_unexp_error;
1304: WHEN fnd_api.g_exc_error THEN
1305: ROLLBACK TO csr_rule_delete;
1306: x_return_status := fnd_api.g_ret_sts_error;
1307: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1308: WHEN fnd_api.g_exc_unexpected_error THEN
1309: ROLLBACK TO csr_rule_delete;
1310: x_return_status := fnd_api.g_ret_sts_unexp_error;
1311: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1312: WHEN OTHERS THEN
1306: x_return_status := fnd_api.g_ret_sts_error;
1307: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1308: WHEN fnd_api.g_exc_unexpected_error THEN
1309: ROLLBACK TO csr_rule_delete;
1310: x_return_status := fnd_api.g_ret_sts_unexp_error;
1311: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1312: WHEN OTHERS THEN
1313: x_return_status := fnd_api.g_ret_sts_unexp_error;
1314: IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1309: ROLLBACK TO csr_rule_delete;
1310: x_return_status := fnd_api.g_ret_sts_unexp_error;
1311: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1312: WHEN OTHERS THEN
1313: x_return_status := fnd_api.g_ret_sts_unexp_error;
1314: IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1315: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1316: END IF;
1317: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1472: l_rule csr_rules_vl%ROWTYPE;
1473: l_rule_tbl csr_rule_tbl;
1474: BEGIN
1475: -- Check for API Compatibility
1476: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1477: RAISE fnd_api.g_exc_unexpected_error;
1478: END IF;
1479:
1480: -- Initialize Message Stack if required
1473: l_rule_tbl csr_rule_tbl;
1474: BEGIN
1475: -- Check for API Compatibility
1476: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1477: RAISE fnd_api.g_exc_unexpected_error;
1478: END IF;
1479:
1480: -- Initialize Message Stack if required
1481: IF fnd_api.to_boolean(p_init_msg_list) THEN
1477: RAISE fnd_api.g_exc_unexpected_error;
1478: END IF;
1479:
1480: -- Initialize Message Stack if required
1481: IF fnd_api.to_boolean(p_init_msg_list) THEN
1482: fnd_msg_pub.initialize;
1483: END IF;
1484:
1485: -- Initialize Return Status
1482: fnd_msg_pub.initialize;
1483: END IF;
1484:
1485: -- Initialize Return Status
1486: x_return_status := fnd_api.g_ret_sts_success;
1487:
1488: IF l_debug = 'Y' THEN
1489: debug('Getting Rules for given eligibility', l_api_name, fnd_log.level_event);
1490: debug(' --> Appl ID = ' || p_appl_id, l_api_name, fnd_log.level_event);
1582: x_res_rules_tbl.EXTEND;
1583: x_res_rules_tbl(x_res_rules_tbl.COUNT) := l_rule_tbl;
1584: END IF;
1585: EXCEPTION
1586: WHEN fnd_api.g_exc_error THEN
1587: x_return_status := fnd_api.g_ret_sts_error;
1588: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1589: WHEN fnd_api.g_exc_unexpected_error THEN
1590: x_return_status := fnd_api.g_ret_sts_unexp_error;
1583: x_res_rules_tbl(x_res_rules_tbl.COUNT) := l_rule_tbl;
1584: END IF;
1585: EXCEPTION
1586: WHEN fnd_api.g_exc_error THEN
1587: x_return_status := fnd_api.g_ret_sts_error;
1588: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1589: WHEN fnd_api.g_exc_unexpected_error THEN
1590: x_return_status := fnd_api.g_ret_sts_unexp_error;
1591: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1585: EXCEPTION
1586: WHEN fnd_api.g_exc_error THEN
1587: x_return_status := fnd_api.g_ret_sts_error;
1588: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1589: WHEN fnd_api.g_exc_unexpected_error THEN
1590: x_return_status := fnd_api.g_ret_sts_unexp_error;
1591: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1592: WHEN OTHERS THEN
1593: x_return_status := fnd_api.g_ret_sts_unexp_error;
1586: WHEN fnd_api.g_exc_error THEN
1587: x_return_status := fnd_api.g_ret_sts_error;
1588: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1589: WHEN fnd_api.g_exc_unexpected_error THEN
1590: x_return_status := fnd_api.g_ret_sts_unexp_error;
1591: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1592: WHEN OTHERS THEN
1593: x_return_status := fnd_api.g_ret_sts_unexp_error;
1594: IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1589: WHEN fnd_api.g_exc_unexpected_error THEN
1590: x_return_status := fnd_api.g_ret_sts_unexp_error;
1591: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1592: WHEN OTHERS THEN
1593: x_return_status := fnd_api.g_ret_sts_unexp_error;
1594: IF fnd_msg_pub.check_msg_level (fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1595: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1596: END IF;
1597: fnd_msg_pub.count_and_get (p_count => x_msg_count, p_data => x_msg_data);
1856: l_object_version_num := p_object_version_number;
1857:
1858: update_rule(
1859: p_api_version => 1.0
1860: , p_init_msg_list => fnd_api.g_true
1861: , p_commit => fnd_api.g_true
1862: , x_return_status => l_return_status
1863: , x_msg_data => l_msg_data
1864: , x_msg_count => l_msg_count
1857:
1858: update_rule(
1859: p_api_version => 1.0
1860: , p_init_msg_list => fnd_api.g_true
1861: , p_commit => fnd_api.g_true
1862: , x_return_status => l_return_status
1863: , x_msg_data => l_msg_data
1864: , x_msg_count => l_msg_count
1865: , p_rule_id => p_rule_id
1871: , p_version_msgs => NULL
1872: , x_new_rule_doc => l_new_rule_doc
1873: );
1874:
1875: IF l_return_status <> fnd_api.g_ret_sts_success THEN
1876: IF l_debug = 'Y' THEN
1877: debug('Process WebADI Action Errored out. Message Count = ' || l_msg_count || ' : Message Data = ' || l_msg_data, l_api_name, fnd_log.level_error);
1878: END IF;
1879: