Wednesday, August 28, 2013

working with updatable code in mp4ox

Minuteproject promotes updatable code as one integration technic.
What it means is that you can change the generated code AND your modifications will be kept if you generate again (ex when your model change).

So this as the interesting effect, that minuteproject is not only for bootstrap time (the early age of your project) BUT throughout the lifecycle of your project.

Things change: code and model but it's OK you can still keep the power of reverse-engineering without losing your code.

Concretely, what does it mean when working with Minuteproject 4 Openxava?

The early age of your project - bootstrap time


You have a idea, model it! the DB way (do not lose the power of your RDBMS)!
  • smart reverse-engineering (your model value more that just storing information, hunt the hidden concepts, enrich it!)
  • virtualization (use views as alternate models or graphs of views)
  • SDD (jdbc statements are sometimes enough)
  • Transient definition (DTO are welcome back for any purpose UC linked or not or partially to some persisted entities)


By default when you pick-up the target with catalog-entry="OpenXava" the resulting code will go to ../output//OpenXava

Create your OpenXava project and test your idea

If you open a prompt on your generated code directory and set/export your 2 environment variables MP_HOME and OX_HOME then you can call build-.
This will create an OX project; build it, deploy it and open your browser to a menu to access your model.

This is fine and described to create OX project.

Maturity age

Now your OpenXava project is up and running, you can extend your model, and sometimes you want to alter the generated code

Enabling updatable code

Enable your minuteproject to work and merge updated code.
You have to add
            <target-convention type="enable-updatable-code-feature" />

Working with updatable code

You can check your OX classes and xml, they contain comments.
Some comments are for extension MP-MANAGED-ADDED-AREA-BEGINNING
Some comments are for modification MP-MANAGED-UPDATABLE-BEGINNING-DISABLE to change to MP-MANAGED-UPDATABLE-BEGINNING-ENABLE when modifying the area.
If your artifact (java class, xml file) is final and you do not want to generate it again add MP-MANAGED-STOP-GENERATING

3 possibilities to alter your code are discribed here

Now you just have point Minuteproject 4 Openxava generation towards you Openxava workspace project.

Add the outputdir-root of the node targets and set the directory of your Openxava workspace project

And that's it!


This feature allows you to goes for continuous generation and continuous modification.
Both approach are not longer exclusive BUT complementary.
You got a development methodology to use the power of both approach:

No comments:

Post a Comment