I have a dilemma, and I'm not sure of a better way to start solving it.
I work with the old code base at work. Some of the domain objects (and the db tables behind them) do not make much sense. for example, deletedstored as long, agestored as Stringetc. Which I was able to work with the beautiful. In the view, I can say if (deleted == 1).... But there is a certain business logic that leads to a service problem, having it in view. Here is one example:
String title = null;
if (obj.getTitle != null) {
title = obj.getTitle();
} else {
title = obj.getName() + " - " + obj.getCategory();
}
I would really like to have a βbean viewβ where this business logic and legitimate oddities are erased and stored, so I can use it in several views, and then change it in one place. If I had ProductPOJO and then mine ProductViewBean, I would do something like:
productViewBean.setDeleted( product.getDeleted() == 1 );
productViewBean.setTitle( product.getTitle() != null ? product.getTitle() : product.getName() + " - " + product.getCategory() );
My question is: where should I do this? Do I have to have manager(with the appropriate daosone entered into it) that is entered into mine controllerand returns my "view bean"? Or am I all wrong about this and could there be a better approach?
Thanks in advance
(: , , . . db/domain ( deleted boolean ..). - - (! title, " " ), , , , /. , - , .)