Project

General

Profile

Revision b74a2730

IDb74a2730b3ce8c7215357058adf0a6d31ad55fc6
Parent 605d9128
Child a4f3f99c

Added by Katja Luther over 2 years ago

ref #7920: fix delete of preferences

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java
675 675
            }else{
676 676
                isEditorActivated = PreferencesUtil.getBooleanValue(PreferencePredicate.DistributionEditorActivated.getKey(), true);
677 677
            }
678
            //distributionEditorPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DistributionEditorActivated, PreferencePredicate.DistributionEditorActivated.getDefaultValue() != null ?  PreferencePredicate.DistributionEditorActivated.getDefaultValue().toString(): null);
678
            distributionEditorPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DistributionEditorActivated, PreferencePredicate.DistributionEditorActivated.getDefaultValue() != null ?  PreferencePredicate.DistributionEditorActivated.getDefaultValue().toString(): null);
679 679
        }
680 680

  
681 681
        prefAreaVoc = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
581 581
        try{
582 582
            if(CdmStore.isActive()){
583 583
                controller = CdmStore.getCurrentApplicationConfiguration();
584
                controller.getPreferenceService().set(preference);
584
                if (preference.getValue() == null && preference.isAllowOverride()){
585
                    controller.getPreferenceService().remove(preference.getKey());
586
                }else{
587
                    controller.getPreferenceService().set(preference);
588
                }
585 589
                CdmPreferenceCache.instance().put(preference);
586 590
            }
587 591
        }catch(Exception e){
......
1711 1715
            if(CdmStore.isActive()){
1712 1716
                controller = CdmStore.getCurrentApplicationConfiguration();
1713 1717
                for (CdmPreference preference: preferences){
1714
                    controller.getPreferenceService().set(preference);
1718
                    if (preference.getValue() == null && preference.isAllowOverride()){
1719
                        controller.getPreferenceService().remove(preference.getKey());
1720
                    }else{
1721
                        controller.getPreferenceService().set(preference);
1722
                    }
1715 1723
                    CdmPreferenceCache.instance().put(preference);
1716 1724
                }
1717 1725
            }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AbstractTermSelectionWizardPage.java
128 128
            }
129 129
        }
130 130
        if (listValue.isEmpty()){
131
            List<DefinedTermBase> terms = CdmStore.getTermManager().getPreferredTerms(type);
131
            List<DefinedTermBase> terms = CdmStore.getTermManager().getAllTerms(type, null);
132 132
            for (DefinedTermBase term: terms){
133 133
                termlist.add(TermDto.fromTerm(term, true));
134 134
            }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableDistributionPerAreaStatusPage.java
52 52
public class AvailableDistributionPerAreaStatusPage extends AvailableDistributionStatusPage implements IPropertyChangeListener{
53 53

  
54 54
    List<CdmPreference> perAreaPreferences = new ArrayList();
55
    List<CdmPreference> perAreaPreferencesDeleteList = new ArrayList();
55 56
    List<TermVocabularyDto> vocs;
56 57
    NamedArea actualArea;
57 58
    CdmPreference actualPref;
......
155 156
            @Override
156 157
            public void widgetSelected(SelectionEvent e) {
157 158

  
158

  
159 159
                PrefKey key = newAreaSpecificStatusPreference();
160 160
                actualPref = PreferenceResolver.resolve(perAreaPreferences, key);
161 161
                actualPref = CdmPreference.NewInstance(key, null);
......
163 163
                perAreaPreferences.add(actualPref);
164 164
                status.setText("Preference for area " + actualArea.getLabel() + " removed.");
165 165
                status.setVisible(true);
166

  
166 167
                actualArea = null;
168

  
167 169
                areaText.setText("");
168 170
                rememberCheckedValues(getCheckedValuesFromPreferences());
169 171

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableDistributionPerAreaStatusWizard.java
39 39
        // TODO if preferenceStore has elements checked load elements in wizard
40 40
        CdmPreferenceCache cache = CdmPreferenceCache.instance();
41 41
        prefs = new ArrayList<>();
42
        cache.getAllTaxEditorDBPreferences();
42 43
        List<CdmPreference> distrPrefs = cache.getAllForPredicate(PreferencePredicate.AvailableDistributionStatus.getKey());
43 44
        if (distrPrefs != null){
44 45
            prefs.addAll(distrPrefs);
......
91 92
        aPage.refreshActualPrefernce();
92 93
        PreferencesUtil.setPreferencesToDB(aPage.perAreaPreferences);
93 94
        PreferencesUtil.setPreferenceToDB(aPage.pref);
95

  
94 96
       // PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableDistributionStatus.getKey()), aPage.override);
95 97
        PreferencesUtil.firePreferencesChanged(this.getClass());
96 98
        return true;
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermManager.java
56 56
	 */
57 57
	public <T extends DefinedTermBase> List<T> getPreferredTerms(TermType termType){
58 58
	    List terms = cachedTermMap.get(termType);
59
	    if(terms==null){
59
	    if(terms==null || terms.isEmpty()){
60 60
	        terms = getFilteredTerms(TermStore.<T>getTerms(termType, null));
61 61
	        cachedTermMap.put(termType, terms);
62 62
	    }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)