104:
105: EXCEPTION
106: When others then
107:
108: if( FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
109: errorMessage := '[' || sqlcode || sqlerrm || ']' || ' Others';
110: FND_LOG.STRING(FND_LOG.LEVEL_EXCEPTION, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.EVALUATEAND.OTHERS', errorMessage);
111: end if;
112:
106: When others then
107:
108: if( FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
109: errorMessage := '[' || sqlcode || sqlerrm || ']' || ' Others';
110: FND_LOG.STRING(FND_LOG.LEVEL_EXCEPTION, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.EVALUATEAND.OTHERS', errorMessage);
111: end if;
112:
113: End evaluateAnd;
114:
176:
177: EXCEPTION
178: When others then
179:
180: if( FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
181: errorMessage := '[' || sqlcode || sqlerrm || ']' || ' Others';
182: FND_LOG.STRING(FND_LOG.LEVEL_EXCEPTION, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.EVALUATEOR.OTHERS', errorMessage);
183: end if;
184:
178: When others then
179:
180: if( FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL ) then
181: errorMessage := '[' || sqlcode || sqlerrm || ']' || ' Others';
182: FND_LOG.STRING(FND_LOG.LEVEL_EXCEPTION, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.EVALUATEOR.OTHERS', errorMessage);
183: end if;
184:
185: End evaluateOr;
186:
297:
298: --=================--
299: -- Begining of API --
300: --=================--
301: FND_LOG_REPOSITORY.init(null,null);
302:
303: l_log_enabled := FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL;
304:
305:
299: -- Begining of API --
300: --=================--
301: FND_LOG_REPOSITORY.init(null,null);
302:
303: l_log_enabled := FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL;
304:
305:
306: l_exception_log := FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL;
307:
302:
303: l_log_enabled := FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL;
304:
305:
306: l_exception_log := FND_LOG.LEVEL_EXCEPTION >= FND_LOG.G_CURRENT_RUNTIME_LEVEL;
307:
308:
309: IF (p_rule_type = 'AUTODELETE' ) THEN
310: l_module := 'AUTODELETE';
320: l_module := 'DOCUMENTRETRIEVAL';
321: ELSE
322: if l_log_enabled then
323: logMessage := '[Error unknown RuleType: p_rule_type= ' || p_rule_type || ' p_account_id=' || to_char(p_accountid) || ']';
324: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.START', logMessage);
325: end if;
326:
327: raise IEM_UNKNOWN_RULE_TYPE_EXP;
328: END IF;
328: END IF;
329:
330: if l_log_enabled then
331: logMessage := '[p_rule_type= ' || p_rule_type || ' p_account_id=' || to_char(p_accountid) || ']';
332: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.START', logMessage);
333: end if;
334:
335:
336: --Initialize x_result to fals
344: If p_keyVals_tbl.count > 0 then
345:
346: if l_log_enabled then
347: logMessage := '[p_keyValsCount=' || to_char(p_keyVals_tbl.count) || ']';
348: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.KEY_VALS_MORE_THAN_0', logMessage);
349: end if;
350:
351:
352: --Get all the active routes in the system
385: x_parameters(y).type := v_params.parameter_tag;
386:
387: if l_log_enabled then
388: logMessage := '[All Email is set! Emailproc_id=' || l_emailproc_id || ' action='||l_action||' parameter1='|| v_params.parameter1 ||' parameter2='|| v_params.parameter2 ||'parameter3='|| v_params.parameter3 || ']';
389: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
390: end if;
391: y := y + 1;
392: End Loop;
393:
396:
397: else --Action is AutoCreateSR, but TAG exists
398: if l_log_enabled then
399: logMessage := '[All Email is set! Emailproc_id=' || l_emailproc_id || ' action='||l_action||'. But TAG exists . So continue eval next rule.';
400: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
401: end if;
402: end if;
403: --Check if SR id is null or not
404: elsif l_action = 'UPDSERVICEREQID' then
419: x_parameters(y).type := v_params.parameter_tag;
420:
421: if l_log_enabled then
422: logMessage := '[All Email is set! Emailproc_id=' || l_emailproc_id || ' action='||l_action||' parameter1='|| v_params.parameter1 ||' parameter2='|| v_params.parameter2 || ']';
423: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
424: end if;
425: y := y + 1;
426: End Loop;
427:
430: --Action is UpdateSR, but no valid SR_id
431: else
432: if l_log_enabled then
433: logMessage := '[All Email is set! Emailproc_id=' || l_emailproc_id || ' action='||l_action||'. But ServiceRequest ID is null. So continue eval next rule.';
434: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
435: end if;
436: end if;
437:
438: else -- Action <> 'UPDSERVICEREQID'
448: x_parameters(y).type := v_params.parameter_tag;
449:
450: if l_log_enabled then
451: logMessage := '[All Email is set! Emailproc_id=' || l_emailproc_id || ' action='||l_action||' parameter1='|| v_params.parameter1 ||' parameter2='|| v_params.parameter2 || ']';
452: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
453: end if;
454: y := y + 1;
455: End Loop;
456:
511: ruleHold(x).value := v_rules.value;
512:
513: if l_log_enabled then
514: logMessage := '[' || ruleHold(x).key || ruleHold(x).operator || ruleHold(x).value || ']';
515: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.RULES', logMessage);
516: end if;
517:
518:
519: x := x + 1;
559: x_parameters(y).type := v_params.parameter_tag;
560:
561: if l_log_enabled then
562: logMessage := '[All Email is set! Emailproc_id=' || l_emailproc_id || ' action='||l_action||' parameter1='|| v_params.parameter1 ||' parameter2='|| v_params.parameter2 || ']';
563: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
564: end if;
565: y := y + 1;
566: End Loop;
567:
570:
571: else --Action is AutoCreateSR, but TAG exists
572: if l_log_enabled then
573: logMessage := '[All Email is set! Emailproc_id=' || l_emailproc_id || ' action='||l_action||'. But TAG exists . So continue eval next rule.';
574: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
575: end if;
576: end if;
577: -- end if; -- AUTOCREATESR commented by Ranjan
578:
595: x_parameters(y).type := v_params.parameter_tag;
596:
597: if l_log_enabled then
598: logMessage := '[Emailproc_id=' || l_emailproc_id || ' action='||l_action||' parameter1='|| v_params.parameter1 ||' parameter2='|| v_params.parameter2 || ']';
599: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
600: end if;
601: y := y + 1;
602: End Loop;
603:
605: exit;
606: else
607: if l_log_enabled then
608: logMessage := '[Rule satisfied for Emailproc_id=' || l_emailproc_id || ' action='||l_action||'. But ServiceRequest ID is null. So continue eval next rule.';
609: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
610: end if;
611: end if;
612: --Getting parameter, then do validation on particular action
613: else
623: x_parameters(y).type := v_params.parameter_tag;
624:
625: if l_log_enabled then
626: logMessage := '[Emailproc_id=' || l_emailproc_id || ' action='||l_action||' parameter1='|| v_params.parameter1 ||' parameter2='|| v_params.parameter2 || ']';
627: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
628: end if;
629: y := y + 1;
630: End Loop;
631:
707: x_parameters(y).type := v_params.parameter_tag;
708:
709: if l_log_enabled then
710: logMessage := '[All Email is set! Emailproc_id=' || l_emailproc_id || ' action='||l_action||' parameter1='|| v_params.parameter1 ||' parameter2='|| v_params.parameter2 || ']';
711: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
712: end if;
713: y := y + 1;
714: End Loop;
715:
718:
719: else --Action is AutoCreateSR, but TAG exists
720: if l_log_enabled then
721: logMessage := '[All Email is set! Emailproc_id=' || l_emailproc_id || ' action='||l_action||'. But TAG exists . So continue eval next rule.';
722: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
723: end if;
724: end if;
725:
726: --Check if SR id is null or not
742: x_parameters(y).type := v_params.parameter_tag;
743:
744: if l_log_enabled then
745: logMessage := '[No key-val passed in but ALL Email is set! Emailproc_id=' || l_emailproc_id || ' action='||l_action||' parameter1='|| v_params.parameter1 ||' parameter2='|| v_params.parameter2 || ']';
746: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
747: end if;
748: y := y + 1;
749: End Loop;
750:
753: --Action is UpdateSR, but no valid SR_id
754: else
755: if l_log_enabled then
756: logMessage := '[All Email is set! Emailproc_id=' || l_emailproc_id || ' action='||l_action||'. But ServiceRequest ID is null. So continue eval next rule.';
757: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
758: end if;
759: end if;
760: else
761: --Getting parameter, then do validation on particular action
771: x_parameters(y).type := v_params.parameter_tag;
772:
773: if l_log_enabled then
774: logMessage := '[No key-val passed in but ALL Email is set! Emailproc_id=' || l_emailproc_id || ' action='||l_action||' parameter1='|| v_params.parameter1 ||' parameter2='|| v_params.parameter2 || ']';
775: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.'||l_module||'.PARAMS', logMessage);
776: end if;
777: y := y + 1;
778: End Loop;
779:
842: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
843:
844: if l_exception_log then
845: errorMessage := '[There is no action in iem_actions corresponding to the email_proc_id' ||l_emailproc_id||']' ;
846: FND_LOG.STRING(FND_LOG.LEVEL_EXCEPTION, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL', errorMessage);
847: end if;
848:
849: WHEN IEM_UNKNOWN_RULE_TYPE_EXP THEN
850: Rollback to Auto_Process_Email_PUB;
854: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
855:
856: if l_exception_log then
857: errorMessage := '[Unknown Rule type... p_rule_type=' || p_rule_type ||']' ;
858: FND_LOG.STRING(FND_LOG.LEVEL_EXCEPTION, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL', errorMessage);
859: end if;
860:
861: WHEN FND_API.G_EXC_ERROR THEN
862: Rollback to Auto_Process_Email_PUB;
864: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
865:
866: if l_exception_log then
867: errorMessage := '[' || sqlcode || sqlerrm || ']' || ' Execution Error';
868: FND_LOG.STRING(FND_LOG.LEVEL_EXCEPTION, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.EXEC_ERROR', errorMessage);
869: end if;
870:
871: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
872: Rollback to Auto_Process_Email_PUB;
874: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
875:
876: if l_exception_log then
877: errorMessage := '[' || sqlcode || sqlerrm || ']' || ' Unexpected Execution Error';
878: FND_LOG.STRING(FND_LOG.LEVEL_EXCEPTION, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.UNEXP_EXEC_ERROR', errorMessage);
879: end if;
880:
881: WHEN OTHERS THEN
882: Rollback to Auto_Process_Email_PUB;
887: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count, p_data => x_msg_data);
888:
889: if l_exception_log then
890: errorMessage := '[' || sqlcode || sqlerrm || ']' || ' Others';
891: FND_LOG.STRING(FND_LOG.LEVEL_EXCEPTION, 'IEM.PLSQL.IEM_RULES_ENGINE_PUB.AUTO_PROCESS_EMAIL.OTHERS', errorMessage);
892: end if;
893:
894: END auto_process_email;
895: