RISE to Bloome Software
Log In    
Home
RISE
Marshal
Download
 
 
Site Map Site Map
Link to Us Link to Us
r2bsoftware.se r2bsoftware.se
 
 
RISE Version 4.5RISE Version 4.5
RISE Visual ModelingRISE Visual Modeling
AJAX Code GeneratorAJAX Code Generator
 
 
Bookmark and Share
 
Click to hide navigation tree

Conditional execution

RISE composed method supports conditional execution. This allows you to specify, anywhere in a method, that the rest of the method calls are to be executed only if a condition is met. RISE implements this feature without introducing any syntax and, thus, using it will in no way tie your model to a specific programming language. 

RISE supports binary conditions only. This means, you're limited to checking if a value is true or false or if it's null or not null. To evaluate more sophisticated conditions, you need to implement a custom method doing the evaluation for you. To simplify, we provide a basic framework of comparison operators for you to use.

Composed method conditions are scope related. A condition placed at the top level scope will, if not met, cause the composed method to return whereas a condition placed inside a loop will, if not met, cause execution to continue with the next lap. Thus, you may use conditions to filter out or post-process a return set.

To illustrate, let's model a small web shop where the ICustomer interface contains the generated methods for managing the model entities and IShop contains the high-level methods available to the web shop application. The IBasics interface is the contains the basic framework.
The IShop interface has a composed method, PlaceOrder, shown below. This method starts by loading customer and shopping cart info from the database. However, actually placing the order require some criteria to be met. First, the shopping cart mustn't have been ordered already. This is verified by making sure the Ordered date isn't set (is null). Second, we need to make sure the shopping cart is owned by the customer placing the order. This requires comparing two database keys (integers) and to do this we need a custom comparison method. Luckily, the basic framework provides one for us. We pass the ID from GetCustomer and the CustomerID from GetShoppingCart to IsEqualInt and then we apply an execution conditon on its output (isEqual). Thus, we've safeguarded order process by making the composed method returning, rather than running MarkShoppingCartAsOrdered, if the conditions aren't met. 


To create or edit an execution condition right-click the method call, e.g. MarkOrderAsOrdered in the example, and select the "Edit Flow Control" option in the popup menu. This will display a simple editing dialog. To delete the condition select the "Delete Flow Control" option instead.


Note that, while you may have any number of conditions in a composed method, you're limited to one condition per sub-method call, i.e. per arrow in the drawing.