Re: Dev - configurable custom views take 2

Posted by Adrian Crum on
URL: http://ofbiz.116.s1.nabble.com/Dev-configurable-custom-views-take-2-tp167983p167984.html

Leon,

This looks great!

One suggestion though - maybe refer to what the preference controls as a
"preference context" instead of "coordinate." It might help newcomers understand
its role better.

What is the purpose of ViewPreference.viewPreferenceId? It seems to me that you
could just look up the preference with a userLoginId and a viewPrefTypeId.

-Adrian


Leon Torres wrote:

> After attempting to implement ViewPreferences, we found a few issues that
> suggested overdesign.  Upon reconsidering the model, we came up with a much
> better one,
>
> ViewPreference
> - viewPreferenceId*  (serial ID)
> - userLoginId*
> - viewPrefTypeId*    (see ViewPrefType)
> - fromDate
> - thruDate
> - viewPrefItemTypeId (Whether the value is Enum or a String)
> - viewPrefEnumId     (Stores Enum value)
> - viewPrefValue      (Stores String value)
>
> ViewPrefType
> - viewPrefTypeId*
> - application        (e.g., OFBIZ, CRMSFA, etc.)
> - applicationSection (e.g., ORDERMGR)
> - screenName
> - formName
>
> Essentially, the ViewPreference is key-value data tied to a specific
> userLoginId.  The key is simply the viewPrefTypeId, which contains
> information about the "coordinates" of where in the applicatin the
> preference applies.  That way one can select all keys (preferences)
> for a given form, screen, etc.
>
> An example of usage:  Suppose we want to let the user select from several
> possible views of the order list in ordermgr,
>
> * Sales Orders Only
> * Purchase Orders Only
> * All Orders
>
> We define a ViewPrefType for this preference (global cooridnate for simplicity):
>
> <ViewPrefType viewPrefTypeId="ORDER_LIST_PREF" application="OFBIZ" />
>
> And the options are by enumeration,
>
> <Enumeration enumId="ORDER_LIST_PREF_ALL" ... />
> <Enumeration enumId="ORDER_LIST_PREF_SALES" ... />
> <Enumeration enumId="ORDER_LIST_PREF_PURCH" ... />
>
> Then the value is determined by a ViewPreference entry,
>
> <ViewPreference viewPreferenceId="1000" userLoginId="admin"
>      viewPrefTypeId="ORDER_LIST_PREF" fromDate="..."
>      viewPrefItemTypeId="ENUMERATION" viewPrefEnumId="ORDER_LIST_PREF_ALL" />
>
> So now the admin will see all orders.  If the admin changes it to list
> sales orders, the viewPrefEnumId is updated to "ORDER_LIST_PREF_SALES".
> Next time the admin comes to the order list, he'll see sales orders.
>
> Later on, if we want to group them, we can have ViewPrefGroup.
>
> - Leon
>
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev