Scripted Business Object demonstration
http://metastorm.processmapping.com.au/post/Scripted-Business-Object-demonstration-6126348
As several people have asked about this, and in particular how to prevent a refresh, we had a go at making this work. The result is in our Admin Tool procedure.
Points to note, we have created an abstract class that does most of what you need. This is in the PM Library. This makes the class you have to build fairly straightforward:
- The constructor: As I understand it, this can be empty unless you want to use a created connection (ie not the default). As any Semi-colonist will know, this must be the same name as the class itself.
- Parameter definitions: Just add an abstract 'get' for each parameter. They can be used any way you wish in the code.
- add a virtual get function for every column. This must be of the correct type.
- Add a Read() function that fills your DataSet object. The simplest is just using SQL, otherwise you do have to faff about creating and filling the DataSet object 'manually'.
In the Folder Query BO in the linked solution, I cache the dataset on performing the Read() and before returning the data. If the 'Refesh' parameter is true, I read the data from the database. If it is false, I read from the cache (if null, ie the first time, I read the data).
On the form, when I select a Process, I want to refresh the Stage list, but not the grid. To do this, I set the Refresh variable to false. When you press the 'Refresh' button, it is set to true.
It is a fairly trivial example, but it shows the mechanism. In addition, it shows how you can have dynamic (building SQL 'on the fly', but properly parametrised and safe) SQL once again, and also how we can create an 'IN' clause for our Business Objects.
All other approaches to these problem involve using the 'execute' function or similar, and that exposes you to a massive risk of "SQL Injection". Such an approach is not only dangerous, it should be expressly forbidden where any level of security is wanted, let alone required. This approach allows it to be managed safely.
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 152 General Questions
- 148 Thrust Services
- 57 Developer Hackathon
- 37 Thrust Studio
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 190 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 10 XM Fax
- Follow Categories