Changes between Version 10 and Version 11 of Grits_ProjectPreferenceStore
- Timestamp:
- 03/09/2017 05:13:02 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Grits_ProjectPreferenceStore
v10 v11 1 = Project Preference Store (Local Preference Store for Project)= 2 ---- 1 = Project Preference Store = 3 2 4 ''ProjectPreferenceStore'' is a local storefor storing preference values related to project, e.g. preference for project's Task information. This local store caches the preference values in maps (map key is the id of the preference variable). It calls ''GritsPreferenceStore'' only if the value is not found in its map.3 ''ProjectPreferenceStore'' is a '''local preference store''' for storing preference values related to project, e.g. preference for project's Task information. This local store caches the preference values in maps (map key is the id of the preference variable). It calls ''GritsPreferenceStore'' only if the value is not found in its map. 5 4 6 5 __Major Advantages:__ … … 9 8 2. Currently preference values are stored as string in the preference file. Each time a preference is read, a generic ''PreferenceEntity'' object is created by ''GritsPreference'' store. This ''PreferenceEntity'' object is later converted to more specific preference object for getting preference values. ''ProjectPreferenceStore'' reduces multiple unnecessary de-serialization of preference values from strings stored in file. [[BR]]For example, if there were four tasks, ''ProjectPreferenceStore'' would cache a list of four tasks (along with its default information) which would be otherwise each time read as string from file, unmarshalled to PreferenceEntity object and then converted to list of tasks. 10 9 11 These advantages are general for any similar local preference store in GRITS. Plugins that would use preferences are recommended to maintain a local preference store.10 These advantages are general for any similar cached-local preference store in GRITS. Plugins that would use preferences are recommended to maintain a local preference store. 12 11 13 12 == Implementation == … … 17 16 === Preferences in Project Preference store === 18 17 [[BR]] 19 [[Image(project_preference_store.jpg, 800)]]18 [[Image(project_preference_store.jpg, 700)]][[BR]] 20 19 Class diagram for project preferences 21 20 [[BR]] 22 21 23 __Preferences in Project Preference store:__24 22 25 Currently there are four types of preferences for projects. 23 Currently there are four types of preferences for projects. Each of these preference is an enum object and has all the information needed to get a preference value. 26 24 27 - ''StringPreference'' - Simplest type of preference that has a '''string''' value. All other information related to it is available in the enum object.25 - ''StringPreference'' - Simplest type of preference that has a '''string''' value. All information related to it is available in the enum object 28 26 29 - ''Preference'' - Types of preference whose values are a '''list of string''' .27 - ''Preference'' - Types of preference whose values are a '''list of string''' 30 28 31 - ''ParameterizedPreference'' - Types of preference whose values are a '''list of particular class object'''.29 - ''ParameterizedPreference'' - Types of preference whose values are a '''list of objects of a particular class''' 32 30 33 - ''IntegerPreference'' - A special case of ''ParameterizedPreference'' whose values are a '''list of integer''' .31 - ''IntegerPreference'' - A special case of ''ParameterizedPreference'' whose values are a '''list of integer''' 34 32 35 By using the above enum objects as parameter, the need of knowing the preference variable name or the need of knowing filename for default values (when a preference is not found in the preference file) is removed. When one of the above enum is passed as a parameter then user can get a generic SingleChoicePreference or MultiChoicePreference (or its special case MultiChoiceInteger) enum object.33 By using the above enum objects as parameter, the need of knowing the preference variable name or the need of knowing filename for default values (when a preference is not found in the preference file) is removed. When one of the above enum is passed as a parameter then user can get a generic ''SingleChoicePreference'' or ''MultiChoicePreference'' (or its special case ''MultiChoiceInteger'') enum object. 36 34 37 A ''SingleChoicePreference'' is characterized by - a list of values and one default value (currently it only supports string values) 35 - ''SingleChoicePreference'' 36 - characterized by a list of values and one default value (currently it only supports string values) 38 37 39 A ''MultiChoicePreference'' is characterized by - a list of selected values and a list of unselected values. 38 - ''MultiChoicePreference'' 39 - characterized by a list of selected values and a list of unselected values 40 40 41 A ''MultiChoiceInteger'' is a special case of MultiChoicePreference and is characterized by - a list of selected integers and a list of unselected integers. 41 - ''MultiChoiceInteger'' 42 - characterized by a list of selected integers and a list of unselected integers 43 - a special case of MultiChoicePreference 42 44 43 __Note:__ The simplest ''StringPreference'' is self-contained and has a single string value that can be directly accessed from the enum object. 44 45 == Class Diagram for entire Project Preference store== 45 __Note:__ The simplest ''StringPreference'' is self-contained. It has a single string value that can be directly accessed from the enum object. 46 == Project Preference store== 46 47 [[BR]] 47 [[Image(project_preference_all.png, 1 300)]]48 [[Image(project_preference_all.png, 1000)]][[BR]] 48 49 Class diagram for project preference store 49 50 [[BR]] 51 52 53 == Preference and their values == 54 Currently it happens to be the case that certain preference types have certain preference values. Here is the mapping of current preference type and their values: 55 56 ||= Preference type =||= Preference values =|| 57 || StringPreference || - || 58 || Preference || SingleChoicePreference || 59 || ParameterizedPreference || MultiChoicePreference || 60 || IntegerPreference || MultiChoiceInteger || 61 62 63 __Note:__ Currently ''SingleChoicePreference'' is not generic and only supports string preference values. If later some ''ParameterizedPreference'' have ''SingleChoicePreference'' values then ''SingleChoicePreference'' should be made a generic class. 50 64 51 65 == Code Snippet ==