Was working on something today and came up with an approach -- looking for
feedback.

Requirement
Part of our usability review resulted in the StatusItem entities description
value not being very informative.  The trouble was that ORDER_HOLD would
mean something different (contextually) for a Sales Order vs. a Purchase
Order.  Need to be able to dictate how the value is resolved from the UI.

Initial Approach
Give the UI the ability to override an entities default resource name.  This
was done by enhancing the "display" element to have a "entity-resource-name"
attribute that could be set.  ModelFormField and UelUtil were enhanced to
get this and provide it (ultimately) to GenericEntity.  Minor change to
LocalizedMap interface to expose the "resource" overload of get so UelUtil
can do this without knowledge of the specific interface (GenericEntity in
this case).

My Thoughts
- This is not a very frequent occurrence - in general you want to set what
various entities attributes mean and be consistent throughout the
application.
- There are several elements that this would make sense on (Display and
EntityOptions are the ones I had to hit).
- It occurred to me that there may be a better way to get the resource name
through the stack to the GenericEntity; but I could not find it.  :)
- There likely would be more value in being able to do an entity-extend and
provide a replacement resource-name at that level (maybe you can?).  I could
not think of a reasonable way to do resource extensions, but we strive to
leave the Ofbiz files alone and use extension / overriding mechanisms in
general.  This is one spot where we do not have a best practices and often
we manipulate the entity labels file directly.

Lastly, does anyone see value of contributing this back or should I keep it
as custom work?
-- 
View this message in context: 
http://www.nabble.com/Overriding-entity%27s-default-resource-name-in-the-UI-tp25051945p25051945.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Reply via email to