The Drools DSL format has been updated to allow for the addition of metadata to provide for user friendly widgets when using a DSL in combination with the guided editor. The DSL sentence can now display a dropdown for an enumeration, a date selector, a checkbox, and allows for the restriction of the value that can be entered in a text field via a regular expression. The regular expression validates against the contents of the text box and displays a message to the user when an invalid value is entered.Examples of each format are shown below along with screenshots from Guvnor
Defining a dropdown driven by a Guvnor Enum:
Format:
{<variablename>:ENUM:<type.fieldname>}
Example:
[when]When the credit rating is {rating:ENUM:Applicant.creditRating} = applicant:Applicant(credit=="{rating}")
Define a date selector via DSL:
Format:
{<variablename>:DATE:<date>}
Example:
[when]When the applicant dates is after {dos:DATE:dd-MMM-YYYY}=applicant:Applicant(applicationDate>"{dos}")
Defining a checkbox via DSL:
Format:
{<variablename>:BOOLEAN:defaultValue[checked | unchecked]}
Example:
[when]When the applicant approval is {bool:BOOLEAN:checked} =applicant:Applicant(approved=={bool})
Define a restriction on a textbox via a regular Expression:
Format:
{<variablename>:<regex>}
Example:
[when]When the age is less than {num:1?[0-9]?[0-9]} = applicant:Applicant(age<{num})

Could it be that you keep on forgetting
ReplyDeletesemicolons after
>
and after
<
??
Ah yeah. It renders correctly in IE but not Firefox. I'll fix it now
ReplyDeleteI've tried using this same method to perform tests against Java enum types, to no avail. Suggestions/examples on how to do this?
ReplyDeletecamerono: For now the enumerated type has to be defined in Guvnor via the Enumerations Asset. I agree that it would make sense to extend it to imported models with Enums, but it isn't their right now.
ReplyDeleteThe boolean check box is incorrect, you need quotes around the end part like this: [when]This Security is Ratable {bool:BOOLEAN:checked}=ratable:Ratable(ratableValue=="{bool}")
ReplyDeleteIt looks very cool, thanks for the helpful information. I admire how useful the blog you have, it is a pleasure to read it. I enjoy reading the same way I enjoy playing poker. This is an incredible feeling when you win and feel like a winner, you still get a big win
ReplyDeleteOnline law research paper help services are very common nowadays since there are very many students seeking Law Research Writing Services and law essay writing services.
ReplyDeleteHi…this is abhinav here, the few months I am visiting and following you. What I really like about you is that your writing style. Please keep making such as information for us. Top CA Firm in India – AKGVG, Top CA in India.
ReplyDeleteThank you very much for giving us space to express our feeling and thoughts about above information. I think you will keep updating and changing these information time to time if there is need to change. Transaction And Valuation Services, Audit Firms In India, Business Setup Services In India, Accounting Services, Forensic Accounting and Fraud Detection.
ReplyDeleteThanks for this blog. It really provides awesome information to all readers. keep it up and keep posting these types of blogs on digital marketing services, it's really helpful.
ReplyDeletetop business consulting firms in India