Project

General

Profile

Revision d4db4070

IDd4db40709483dba7f8451f64de1db944d0ba694e
Parent f662104a
Child 446a945a

Added by Patrick Plitzner 9 months ago

fix #7235 Fix "allowOverride" flag for common name areas DB prefs

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/VokabularyAdminPreferences.java
17 17
import org.eclipse.swt.widgets.Composite;
18 18
import org.eclipse.swt.widgets.Control;
19 19

  
20
import eu.etaxonomy.cdm.api.application.ICdmRepository;
21
import eu.etaxonomy.cdm.api.service.IPreferenceService;
20 22
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
21 23
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
22 24
import eu.etaxonomy.taxeditor.l10n.Messages;
23 25
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
24 26
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
27
import eu.etaxonomy.taxeditor.store.CdmStore;
25 28
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
26 29

  
27 30
/**
......
32 35
public class VokabularyAdminPreferences extends CdmPreferencePage implements IE4AdminPreferencePage {
33 36

  
34 37
    boolean allowOverride;
35
    CdmPreference pref = null;
36

  
37 38

  
38 39
    @Override
39 40
    protected Control createContents(Composite parent) {
......
41 42
        Composite composite = new Composite(parent, SWT.NULL);
42 43
        composite.setLayout(new GridLayout());
43 44

  
44
        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
45
        CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
45 46

  
46 47
        if (pref != null){
47 48
            allowOverride = pref.isAllowOverride();
......
70 71

  
71 72
    @Override
72 73
    public boolean performOk() {
73
        PreferencesUtil.updateDBPreferences();
74
        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
75

  
76
        if(controller!=null){
77
            IPreferenceService service = controller.getPreferenceService();
78

  
79
            CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
80
            if(pref==null){
81
                pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameAreaVocabularies, "");
82
            }
83
            pref.setAllowOverride(allowOverride);
84
            service.set(pref);
85

  
86
            PreferencesUtil.updateDBPreferences();
87
        }
74 88
        return true;
75 89

  
76 90
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableVocabularyWizard.java
130 130
               predicate = pref.getPredicate();
131 131
           }
132 132
           if (!localPref){
133
               CdmPreference savePref = CdmPreference.NewInstance(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.getByKey(pref.getPredicate()), saveCheckedElements);
133
               CdmPreference savePref = CdmPreference.NewInstance(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.getByKey(predicate), saveCheckedElements);
134
               savePref.setAllowOverride(pref.isAllowOverride());
134 135
               PreferencesUtil.setPreferenceToDB(savePref);
135 136

  
136 137
               PreferencesUtil.updateDBPreferences();

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)