The exception handler and the automatic exception handling are ruleset properties in the rule project info.
You can modify then with the API as illustrated in this method
private void updateProject(IlrSession dataProvider, IlrBaseline baseline, String useAEH, String exceptionHandlerClass) throws IlrApplicationException {
IlrProjectInfo info = baseline.getProjectInfo();
IlrCommitableObject co = new IlrCommitableObject((IlrElementHandle)info);
co.setRootDetails((IlrElementDetails)info);
IlrBrmPackage brm = dataProvider.getBrmPackage();
List<IlrRulesetProperty> properties = info.getRulesetProperties();
// delete existing properties
for (IlrRulesetProperty ilrRulesetProperty : properties) {
if (ilrRulesetProperty.getKey().equals("AutomaticExceptionHandler"))
co.addDeletedElement(brm.getProjectInfo_RulesetProperties(), (IlrElementDetails)ilrRulesetProperty);
if (ilrRulesetProperty.getKey().equals("CustomExceptionHandler"))
co.addDeletedElement(brm.getProjectInfo_RulesetProperties(), (IlrElementDetails)ilrRulesetProperty);
}
// add automatic exception handling
if ("true".equals(useAEH)) {
IlrRulesetProperty aProp = (IlrRulesetProperty)((IlrSessionEx)dataProvider).createElementDetails(brm.getRulesetProperty());
aProp.setRawValue((EStructuralFeature)brm.getRulesetProperty_Key(), "AutomaticExceptionHandler");
aProp.setRawValue((EStructuralFeature)brm.getRulesetProperty_Value(), "true");
co.addModifiedElement(brm.getProjectInfo_RulesetProperties(), (IlrElementDetails)aProp);
}
// add a custom exception handler
if (exceptionHandlerClass != null) {
IlrRulesetProperty aProp = (IlrRulesetProperty)((IlrSessionEx)dataProvider).createElementDetails(brm.getRulesetProperty());
aProp.setRawValue((EStructuralFeature)brm.getRulesetProperty_Key(), "CustomExceptionHandler");
aProp.setRawValue((EStructuralFeature)brm.getRulesetProperty_Value(), exceptionHandlerClass);
co.addModifiedElement(brm.getProjectInfo_RulesetProperties(), (IlrElementDetails)aProp);
}
// save in the repository
dataProvider.commit(co);
}
Hope this helps
------------------------------
Alain Robert
------------------------------
Original Message:
Sent: Tue October 18, 2022 03:44 AM
From: Maria del Rosario Alvarez Martinez
Subject: How to add a CustomExceptionHandler to a rule project through the Decision Center API (ODM 8.11)
Hi experts!
Is there any way to add a CustomExceptionHandler to a rule project through the Decision Center API in ODM 8.11?
From RuleDesigner I can do this by updating the Custom Exception Handler field when I select the DE rule engine.
But when I create a rule project through the Decision Center API I don't see a way to do it.
------------------------------
Charo Álvarez Martínez
Automation Architect
DECIDE
Madrid
------------------------------