Join the DZone community and get the full member experience.Join For Free
I've managed to get my hands on a copy of Luis Majano's DataBoss and wanted to post some thoughts on it.
Although DataBoss is the work of the ColdBox team - it can be run as a standalone install alongside your existing application (regardless of what framework - or lack of - you have used). If you are using ColdBox, then you can simply drop DataBoss in as a module. There are also different editions for Railo, ColdFusion 9 and ColdFusion 10. I'm not sure what the differences are, as the source code is (understandably) encrypted, I assume the different versions are due to encryption differences between the different engines rather than different functionality.
I tested out the ColdFusion 9 version on a few existing applications I have with various levels of complexity.
My first attempt to get it running was the typical impatient codemonkey approach of changing the datasource name and trying to run the application! Whilst the application loaded it couldn't find any of my persistent CFCs. At this point I watched the two minute video on the DataBoss website http://www.data-boss.com/ which is a good watch and clearly demonstrates the process of getting started. Essentially all I did was to set up a mapping to my persistent CFCs and pointed the cfclocation setting to that mapping:
this.mappings["/model"] = ExpandPath("../model/");
Once I'd done that, DataBoss magically went off and found my persistent CFCs and did some introspection on them!
The interface to DataBoss is clean and easy to use. It does use the bootstrap CSS framework, so expect so nice and bright buttons! All of your persistent CFCs are listed in a drop down, so you can easily switch between them. Selecting one of them, results in a paged list view of all the records for that entity. You can page through the records, filter them or sort, them. There are delete and edit buttons. In addition you choose to add a record or bulk delete records. There is also the option the export the data in a variety of formats (including JSON, JSONP and XML) which I thought was quite a neat idea (more on this later!).
When you edit a record, then DataBoss is clever enough to display the correct field type for the data. For example, a date appears with a date picker control and boolean fields show as "Yes/No" radio buttons. In addition, DataBoss will introspect the database to see which fields do not allow null values and makes them required on the form. By adding some extra metadata (the db_html attribute) to your properties (in your persistent CFCs) you can actually gain some more power over how the fields are rendered. For example, you can have HTML5 placeholders, or indicate you want a password input box instead of a plain text input box. There is also a db_validate attribute you can use which supports Regular Expression matching for validation.
Any relationships you have between your entities are recognised, and dropdowns are shown on the form where appropriate. There is also an additional "collections" tab for each record, so you can access the related object data in the relationship for the currently viewed entity and click through to maintain it. If that sounds confusing, it really isn't when you see it!
If you want more sophisticated validation then you can use additional annotations in your CFCs. DataBoss makes use the ColdBox Validation Engine http://wiki.coldbox.org/wiki/Validation.cfm under the hood. I haven't extensively tested this part of DataBoss out, but as it's part of the ColdBox core, I'd expect it to be rock solid.
When I first tried out DataBoss, I made some suggestions to Luis about some small tweaks and possible improvement, being Luis, he'd implemented them all in about a day which I was very impressed with! In the latest build the listing has become a bit more compact if you have lots of data, which makes navigation much easier.
At first I thought DataBoss was essentially a system for doing CRUD operations, but it has another very clever aspect that I can see being of real benefit in certain situations; it can expose your data via a RESTful interface. There are some good examples in the docs about this, here are two for getting users as JSON:
This, as you'd expect will return all the entities as JSON. Or if you just want to get a single user, then you'd retrieve if by calling:
If the entity you are retrieving has related entities, then DataBoss will fetch those and include them in the data export for you.
The only thing that concerns me about DataBoss is that by default it is not secured. This is not a failing of DataBoss, so can't be considered a criticism and Basic Authentication can be enabling simply by setting a flag to true in the config file. It is the responsibility of a developer or server admin to ensure that data is not compromised - I just can't help feeling that at least one person is going to accidentally put it in production without securing it first.
DataBoss is a commercial offering from Ortus Solutions, but I can see if saving hours of development time and will be a worthwhile investment for many. If you want to find out more about DataBoss check out the dedicated website at:
The docs can be found here:
Published at DZone with permission of John Whish , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.