Revision 9b8d1a1c
Added by Katja Luther about 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/SpecimenAdminPreferences.java | ||
---|---|---|
14 | 14 |
import eu.etaxonomy.cdm.api.service.IPreferenceService; |
15 | 15 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference; |
16 | 16 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey; |
17 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
|
17 | 18 |
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject; |
18 |
import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate; |
|
19 | 19 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
20 | 20 |
import eu.etaxonomy.taxeditor.preference.SpecimenOrObservationPreferences; |
21 | 21 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
47 | 47 |
ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration(); |
48 | 48 |
if (controller != null){ |
49 | 49 |
IPreferenceService service = controller.getPreferenceService(); |
50 |
PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowSpecimen);
|
|
50 |
PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowSpecimen); |
|
51 | 51 |
showSpecimenPref = service.find(key); |
52 | 52 |
if (showSpecimenPref != null){ |
53 | 53 |
this.isShowSpecimenRelatedIssues = Boolean.valueOf(showSpecimenPref.getValue()); |
54 | 54 |
this.allowOverrideShowSpecimenRelatedIssues = showSpecimenPref.isAllowOverride(); |
55 | 55 |
}else{ |
56 |
showSpecimenPref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowSpecimen, Boolean.toString(true));
|
|
56 |
showSpecimenPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowSpecimen, Boolean.toString(true)); |
|
57 | 57 |
this.isShowSpecimenRelatedIssues = true; |
58 | 58 |
this.allowOverrideShowSpecimenRelatedIssues = true; |
59 | 59 |
} |
60 | 60 |
|
61 |
key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowCollectingAreasInGeneralSection);
|
|
61 |
key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection); |
|
62 | 62 |
CdmPreference isShowCollectingAreaInGeneralSectionPref = service.find(key); |
63 | 63 |
if (isShowCollectingAreaInGeneralSectionPref != null){ |
64 | 64 |
this.isShowCollectingAreaInGeneralSection = Boolean.valueOf(isShowCollectingAreaInGeneralSectionPref.getValue()); |
65 | 65 |
this.allowOverrideShowCollectingAreaInGeneralSection = isShowCollectingAreaInGeneralSectionPref.isAllowOverride(); |
66 | 66 |
}else{ |
67 |
this.isShowCollectingAreaInGeneralSection = (Boolean) EditorPreferencePredicate.ShowCollectingAreasInGeneralSection.getDefaultValue();
|
|
67 |
this.isShowCollectingAreaInGeneralSection = (Boolean) PreferencePredicate.ShowCollectingAreasInGeneralSection.getDefaultValue(); |
|
68 | 68 |
this.allowOverrideShowCollectingAreaInGeneralSection = true; |
69 | 69 |
} |
70 | 70 |
|
71 |
key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.DeterminationOnlyForFieldUnits);
|
|
71 |
key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.DeterminationOnlyForFieldUnits); |
|
72 | 72 |
CdmPreference isDeterminationOnlyForFieldUnitsPref = service.find(key); |
73 | 73 |
if (isDeterminationOnlyForFieldUnitsPref != null){ |
74 | 74 |
this.isDeterminationOnlyForFieldUnits = Boolean.valueOf(isDeterminationOnlyForFieldUnitsPref.getValue()); |
75 | 75 |
this.allowOverrideDeterminationOnlyForFieldUnits = isDeterminationOnlyForFieldUnitsPref.isAllowOverride(); |
76 | 76 |
}else{ |
77 |
this.isDeterminationOnlyForFieldUnits =(Boolean)EditorPreferencePredicate.DeterminationOnlyForFieldUnits.getDefaultValue();
|
|
77 |
this.isDeterminationOnlyForFieldUnits =(Boolean)PreferencePredicate.DeterminationOnlyForFieldUnits.getDefaultValue(); |
|
78 | 78 |
this.allowOverrideDeterminationOnlyForFieldUnits = true; |
79 | 79 |
} |
80 |
key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowTaxonAssociations);
|
|
80 |
key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowTaxonAssociations); |
|
81 | 81 |
CdmPreference isShowTaxonAssociationPref = service.find(key); |
82 | 82 |
if (isShowTaxonAssociationPref != null){ |
83 | 83 |
this.isShowTaxonAssociation = Boolean.valueOf(isShowTaxonAssociationPref.getValue()); |
84 | 84 |
this.allowOverrideShowTaxonAssociation = isShowTaxonAssociationPref.isAllowOverride(); |
85 | 85 |
}else{ |
86 |
this.isShowTaxonAssociation = (Boolean)EditorPreferencePredicate.ShowTaxonAssociations.getDefaultValue();
|
|
86 |
this.isShowTaxonAssociation = (Boolean)PreferencePredicate.ShowTaxonAssociations.getDefaultValue(); |
|
87 | 87 |
this.allowOverrideShowTaxonAssociation = true; |
88 | 88 |
} |
89 | 89 |
|
90 |
key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.ShowLifeForm);
|
|
90 |
key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowLifeForm); |
|
91 | 91 |
CdmPreference isShowLifeFormPref = service.find(key); |
92 | 92 |
if (isShowLifeFormPref != null){ |
93 | 93 |
this.isShowLifeForm = Boolean.valueOf(isShowLifeFormPref.getValue()); |
94 | 94 |
this.allowOverrideShowLifeForm = isShowLifeFormPref.isAllowOverride(); |
95 | 95 |
} else{ |
96 |
this.isShowLifeForm = (Boolean)EditorPreferencePredicate.ShowLifeForm.getDefaultValue();
|
|
96 |
this.isShowLifeForm = (Boolean)PreferencePredicate.ShowLifeForm.getDefaultValue(); |
|
97 | 97 |
this.allowOverrideShowLifeForm = true; |
98 | 98 |
} |
99 | 99 |
|
... | ... | |
109 | 109 |
if (controller != null){ |
110 | 110 |
IPreferenceService service = controller.getPreferenceService(); |
111 | 111 |
|
112 |
CdmPreference pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowCollectingAreasInGeneralSection, Boolean.toString(this.isShowCollectingAreaInGeneralSection));
|
|
112 |
CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowCollectingAreasInGeneralSection, Boolean.toString(this.isShowCollectingAreaInGeneralSection)); |
|
113 | 113 |
pref.setAllowOverride(allowOverrideShowCollectingAreaInGeneralSection); |
114 | 114 |
service.set(pref); |
115 |
pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowSpecimen, Boolean.toString(this.isShowSpecimenRelatedIssues));
|
|
115 |
pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowSpecimen, Boolean.toString(this.isShowSpecimenRelatedIssues)); |
|
116 | 116 |
pref.setAllowOverride(allowOverrideShowSpecimenRelatedIssues); |
117 | 117 |
service.set(pref); |
118 | 118 |
|
119 |
pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.DeterminationOnlyForFieldUnits, Boolean.toString(this.isDeterminationOnlyForFieldUnits));
|
|
119 |
pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DeterminationOnlyForFieldUnits, Boolean.toString(this.isDeterminationOnlyForFieldUnits)); |
|
120 | 120 |
pref.setAllowOverride(allowOverrideDeterminationOnlyForFieldUnits); |
121 | 121 |
service.set(pref); |
122 | 122 |
|
123 |
pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowTaxonAssociations, Boolean.toString(this.isShowTaxonAssociation));
|
|
123 |
pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowTaxonAssociations, Boolean.toString(this.isShowTaxonAssociation)); |
|
124 | 124 |
pref.setAllowOverride(allowOverrideShowTaxonAssociation); |
125 | 125 |
service.set(pref); |
126 | 126 |
|
127 |
pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.ShowLifeForm, Boolean.toString(this.isShowLifeForm));
|
|
127 |
pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowLifeForm, Boolean.toString(this.isShowLifeForm)); |
|
128 | 128 |
pref.setAllowOverride(allowOverrideShowLifeForm); |
129 | 129 |
service.set(pref); |
130 | 130 |
PreferencesUtil.updateDBPreferences(); |
Also available in: Unified diff
ref #8078: move editorPreferencePredicates to cdmlib