These pages describe an AndroMDA feature called Manageable Entities, probably better known as CRUD. This feature is something which can optionally be applied on existing <<Entity>> elements so that it becomes very easy to manage them: creation, searching, updating and deleting.
Please NOTE that the manageable entities feature MUST use the Spring Cartridge in order to take advantage of data access object(DAO) feature of Spring.
An always recurring feature in J2EE applications is the one where it needs to be possible to directly maintain or manage the data in the database. Customers expect pages or windows which nicely integrate with the rest of the application and that allow them to apply any kind of change against the existing database content.
AndroMDA supports this, and can generate the complete set of required files and resources as to be able to manage the entities. Here's what's currently supported:
Here's the online sample: CRUD sample application
In order not to fetch thousands of records everytime you perform a search query it is possible to set an upper limit, the maximum number of records to fetch in a single call. Use the defaultMaximumListSize namespace property.
Associated entities will be represented by their identifiers, but you might want to consider using <<Unique>> entity attributes, when the CRUD feature sees such an attribute it will take that one instead of the identifier (only for displaying of course). When more than one such attribute is present, the first one found will be used.
In order to enable entities associated with a certain entity the association ends to those other entities need to be navigable. The entities are required to also be Manageable.
Todo: write the necessary OCL constraints where applicable, and make the associated entities work even when they don't have the Manageable stereotype.
Database error messages should be translated into something more readable, in the case where a record is to be deleted but there are foreign keys pointing to it HSQLDB will complain with a message saying Batch failed, which isn't exactly very indicative of the actual problem.
Input should be validated using the Struts validator plugin, this will avoid unnecessary calls to the backend.
The returned lists should be pageable with a direct link to the database, this will yield better performance and memory management as only the displayed records will be loaded and the next and previous pages will be auto-loaded on DB idle-time, such as solution scales much better than the current one which simply loads all records (it is possible to set an upper limit though).
It's extremely simple: just add a <<Manageable>> stereotype to each class carrying an <<Entity>> stereotype you wish to manage. Currently there is a restriction where you also will need to add this stereotype on the entities associated with this one.
Make sure the bpm4struts cartridge knows how to call the back-end, set this namespace property: <code><manageableServiceAccessorPattern>${pom.package}.ManageableServiceLocator.instance().get{1}()</manageableServiceAccessorPattern></code>. (when not using EJB session beans, this feature's compatibility has not yet been fully tested with EJBs enabled)
Make sure the schema in your database exists before actually calling the manageable actions, or you'll get an exception saying the operation could not be performed (obviously).