Project

General

Profile

« Previous | Next » 

Revision 12d75812

Added by Katja Luther over 5 years ago

ref #7849: remove OVERRIDE constants from IPreferenceKeys and handle it by method

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/CommonNameNamedAreaSelectionDialog.java
19 19
import eu.etaxonomy.cdm.model.common.TermType;
20 20
import eu.etaxonomy.cdm.model.common.TermVocabulary;
21 21
import eu.etaxonomy.cdm.model.location.NamedArea;
22
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
23
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
24
import eu.etaxonomy.taxeditor.preference.CdmPreferenceCache;
22 25
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
23 26
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
24 27
import eu.etaxonomy.taxeditor.store.CdmStore;
......
69 72
        List<TermVocabulary> vocabularies = new ArrayList();
70 73

  
71 74
        UUID[] preselectedVocabularyUuids = createVocabularyUuidList();
72
        if (!PreferencesUtil.getBooleanValue(IPreferenceKeys.COMMON_NAME_AREA_VOCABULARIES_ALLOW_OVERRIDE)
73
                && preselectedVocabularyUuids!=null){
74

  
75
            for(int i=0;i<preselectedVocabularyUuids.length;i++){
76
                TermVocabulary preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);
77
                vocabularies.add(preselectedVocabulary);
78
            }
75
        CdmPreferenceCache cache = CdmPreferenceCache.instance();
76
        CdmPreference pref = cache.get(PreferencePredicate.CommonNameAreaVocabularies.getKey());
77
        if ((pref != null && !pref.isAllowOverride()) && preselectedVocabularyUuids!=null) {
78
                for(int i=0;i<preselectedVocabularyUuids.length;i++){
79
                    TermVocabulary preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);
80
                    vocabularies.add(preselectedVocabulary);
81
                }
79 82
        }else{
80 83
            vocabularies = CdmStore.getService(IVocabularyService.class).listByTermType(TermType.NamedArea, true, null, null, null, null);
81 84
        }
85

  
82 86
        return vocabularies;
83 87
    }
84 88

  

Also available in: Unified diff