Sunday, February 21, 2010

Bonus Material

For my customer's project I created a small addition to Sculptor, that might be useful for you also. The domain model is important for communication, and we need to document it. The difficult thing with documentation is to keep it up to date with changes. Placing the descriptions close to the code makes it easier to do the changes to the documentation at the same time as when you change the code. Since we use Sculptor it was a natural choice to write the descriptions in the model file and generated the documentation.

"A location is our model is stops on a journey, such as cargo
origin or destination, or carrier movement endpoints."
Entity Location {
not optimisticLocking
- @UnLocode unLocode key
'Actual name of this location, e.g. "Stockholm"'
String name not changeable

Repository LocationRepository {
@Location find(@UnLocode unLocode) throws LocationNotFoundException;
findAll;
protected findByKeys;
}
}



From the model we generate HTML documentation of all domain objects including their attributes and associations.



Try it if you like. It is easy to understand and adjust to fit your needs.

Download this generation template and place it in src/main/resources/templates/
In SpecialCases.xpt you add

«AROUND templates::Root::Root FOR Application»
«targetDef.proceed()»
«EXPAND DomainModelDoc::start»
«ENDAROUND»


The generated result is located in src/generated/resources/DomainModelDoc.html

No comments:

Post a Comment