Set methods
RISE provides a method sterotype called Set for setting (changing) the attributes of an instance of an entity. It should be noted that an entity may have many different Set methods each updating a single or a subset of the attributes of the entity.
The method is named Set<entity name> by default.
Rules for the Set method sterotype:
- The method returns nothing
-
The method requires the ID, of the instance to modify, as an argument
-
The method accepts a user defined set of attributes and foreign keys as arguments
By default - for automatically generated Set methods - the arguments contain:
When creating a custom set method, to set a single or a few attributes, create a new New method. Then delete the arguments you don't want to set and rename the method to clearly reflect what it updates, e.g. SetUserName. Finally, don't forget to to set the UserManaged property of the method to True. This avoids having future refresh operations set "missing" attributes as arguments, see User managed methods.
The IDocument example
We examplify Set methods with the method SetDocument and custom set method SetDocumentFolder in the interface IDocument in the model below.
This will result in the following SetDocument method viewed using the RISE method editor. Note that this method requires the programmer to pass all attributes to method.
To simplify programming we have also added a custom set method, SetDocumentFolder, to be used when moving the document in the folder structure.
In order to assure that method isn't updated when refreshing the interface we've set it to UserManaged in the lower right property pane.