How to create a Violation-message within a servicecallout

Posted by Bartel Dodeman on 21-Dec-2016 05:00

Hello,

In my servicecallout i'm trying to create a Violation-message after caching a null-pointer exception. I'm using Corticon 5.5.2.14.

I tried the following code in my catch-block, but my decisionservice completes without a violation-message :

Writer sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
dataObjectManager.logViolation(sw.toString(), "Magi_FilingUnit_SCO");

By means of a log4j-message i've already checked that the code within the catch-block is really executed.

Does anybody know the right approach?

Thank you,

Bartel

Posted by James Arsenault on 23-Dec-2016 08:40

I stand corrected,

ICcDataObjectManager.postMessage(java.lang.String astrSeverity, java.lang.String astrMsg, ICcDataObject aEntity)

seems like what you want

All Replies

Posted by James Arsenault on 23-Dec-2016 00:18

Bartel,

The method you're calling is write to the log file, not to create a rule message. I don't think we expose an API for doing that form a SCO.

Jim

Posted by mparish on 23-Dec-2016 02:48

Right - you cannot create a Corticon Rule message from the APIs. Though that would be really convenient if you could.

However you can define an entity in your vocabulary (called Exception) then you can create it and populate it from your API.

eg

catch (Throwable e)

{

ICcDataObject msg = aDataObjMgr.createEntity("Exception");

msg.setAttributeValue("text", e.getMessage());

e.printStackTrace();

} // End of try importRulesheets

Posted by mjoosen on 23-Dec-2016 08:04

Hmm. It is a pity that it isn’t possible to create Corticon Rule message from the APIs. When working with large sets, you would want to reduce your return messages and set the setting to return entities to false. The violation rule messages are the only elements in the return message and thus it would be convenient if you could set those using a SCO.
 

Maarten Joosen
informatie analist

  Straatweg 2
3604 BB Maarssen
 mjoosen@benuapotheek.nl Postbus 75
  3600 AB Maarssen




Important notice: The information contained in this email is intended solely for the use of the individual or entity to whom it is addressed and others authorised to receive it. It may contain confidential or legally privileged information. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this information in error, please notify us immediately by responding to this email and then delete it from your system. Brocacef Groep NV and its subsidiaries are neither liable for the proper and complete transmission of the information contained in this email nor for any delay in its receipt.


Van: mparish [mailto:bounce-mparish@community.progress.com]
Verzonden: vrijdag 23 december 2016 9:50
Aan: TU.Corticon@community.progress.com
Onderwerp: RE: [Technical Users - Corticon] How to create a Violation-message within a servicecallout
 
Update from Progress Community
 

Right - you cannot create a Corticon Rule message from the APIs. Though that would be really convenient if you could.

However you can define an entity in your vocabulary (called Exception) then you can create it and populate it from your API.

eg

catch (Throwable e)

{

ICcDataObject msg = aDataObjMgr.createEntity("Exception");

msg.setAttributeValue("text", e.getMessage());

e.printStackTrace();

} // End of try importRulesheets

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.

 

Posted by Harold-Jan Verlee on 23-Dec-2016 08:26

But this is possible. Per decision service you can set a flag what messages you want to be returned in the response payload by Corticon Server.
 
These properties can be set in the request payload:
 
PROPERTY_EXECUTION_RESTRICT_RULEMESSAGES_INFO
PROPERTY_EXECUTION_RESTRICT_RULEMESSAGES_WARNING
PROPERTY_EXECUTION_RESTRICT_RULEMESSAGES_VIOLATION
PROPERTY_EXECUTION_RESTRICT_ RESPONSE_TO_RULEMESSAGES_ONLY
 
Or set in the Server Web Console by Decision Service. Or set in Studio when testing a ruleflow.
 
Also messages created inside a SCO (so programmatically) can be NOW added to working memory. This was a fix (indeed this was an outstanding issue) that was added to Corticon 5.6 as per specific client request.
 

Posted by James Arsenault on 23-Dec-2016 08:40

I stand corrected,

ICcDataObjectManager.postMessage(java.lang.String astrSeverity, java.lang.String astrMsg, ICcDataObject aEntity)

seems like what you want

Posted by Bartel Dodeman on 23-Dec-2016 10:16

Thank you James,

Works like a charm!

Greetings,

Bartel

Posted by mparish on 23-Dec-2016 15:44

Particularly on the idea of making rule statements first class citizens – i.e. real business objects that can operated on by the rules.
This would then give you the ability to filter the rules by any criteria you wish (not just by severity) and you could add more attributes to the message as required.
You could even write rules that aggregate similar messages or look for conflicting messages.
 
If this is a feature you’d like to see in the product cast your vote in the ideas pages.
 

This thread is closed