Sunday, February 12, 2006

Roma Framework: UDM in practice

I've just finished to work at the 0.6.8 beta release of Roma Framework. In the last days I've refactored much classes in Roma Framework and, above all, the plugin architecture has changed in "aspects". Current implemented aspects are:
  • view (Echo2ViewAspect),
  • i18n (ResourceBundleI18NAspect),
  • validation (interfaces and exceptions),
  • content (containing section tree structure),
  • logging (using common-logging)
Core component has improved with much features:

The UDM (Unified Development Model) has improved with:
  • Management of application flow. Each user session is tracked. UDM allows to go back and forward implementing the full MVC2 pattern at component level
  • UDM allows to change at run-time class's fields and actions features such as hiding, changing label, style, rendering, etc.
  • UDM allows tracking of attributes changed by the Model to be refreshed by the view aspect.
  • Better FormFactory management allowing caching of forms abstracting the implementation.
Below an example of UDM to search accounts. Note that some features resides in external XML files. The search() method is not yet attached to persistence aspect since it's in construction. Now data are dummy values loaded by TestApp singleton.

public class AccountSearch {
public AccountFilter filter;

@FieldInfo(embeddedType = AccountList.class)
public List result;

public AccountSearch() {
filter = new AccountFilter();
result = new ArrayList();
}

public void create() {
ObjectContext.getInstance().setNext(new AccountNew());
}

public void edit() throws ConfigurationNotFoundException {
ObjectContext.getInstance().getFieldAttribute(filter, "name").setHidden(true);
}

public void search() {
// TEMPORARY: HERE WILL BE USER PERSISTENCE ASPECT SOON...
result = TestApp.getInstance().getAccounts();
ObjectContext.getInstance().addChangedProperty(this, "result");
}
}

No comments: