Project

General

Profile

« Previous | Next » 

Revision 240ff660

Added by Katja Luther over 5 years ago

fix #7645: get the correct values from db for specimen admin preference page

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/SpecimenAdminPreferences.java
46 46
    @Override
47 47
    protected Control createContents(Composite parent) {
48 48
        Composite composite = new Composite(parent, SWT.NULL);
49
        init();
49
        getValues();
50 50
        GridLayout gridLayout = new GridLayout();
51 51
        composite.setLayout(gridLayout);
52 52
        final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK);
......
125 125
        if(!CdmStore.isActive()){
126 126
            return;
127 127
        }
128
          ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
129
          if (controller != null){
130
              IPreferenceService service = controller.getPreferenceService();
131
              PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection);
132
              CdmPreference isShowCollectingAreaInGeneralSectionPref = service.find(key);
133
              if (isShowCollectingAreaInGeneralSectionPref != null){
134
                  this.isShowCollectingAreaInGeneralSection = Boolean.valueOf(isShowCollectingAreaInGeneralSectionPref.getValue());
135
              }
136 128

  
137
              key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.DeterminationOnlyForFieldUnits);
138
              CdmPreference isDeterminationOnlyForFieldUnitsPref = service.find(key);
139
              if (isDeterminationOnlyForFieldUnitsPref != null){
140
                  this.isDeterminationOnlyForFieldUnits = Boolean.valueOf(isDeterminationOnlyForFieldUnitsPref.getValue());
141
              }
142
              key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowTaxonAssociations);
143
              CdmPreference isShowTaxonAssociationPref = service.find(key);
144
              if (isShowTaxonAssociationPref != null){
145
                  this.isShowTaxonAssociation = Boolean.valueOf(isShowTaxonAssociationPref.getValue());
146
                  isUseLocalPreference = isShowTaxonAssociationPref.isAllowOverride();
147
              }
148 129

  
149
              key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowLifeForm);
150
              CdmPreference isShowLifeFormPref = service.find(key);
151
              if (isShowLifeFormPref != null){
152
                  this.isShowLifeForm = Boolean.valueOf(isShowLifeFormPref.getValue());
153
              }
154 130

  
131
    }
155 132

  
133
    private void getValues(){
134
        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
135
        if (controller != null){
136
            IPreferenceService service = controller.getPreferenceService();
137
            PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection);
138
            CdmPreference isShowCollectingAreaInGeneralSectionPref = service.find(key);
139
            if (isShowCollectingAreaInGeneralSectionPref != null){
140
                this.isShowCollectingAreaInGeneralSection = Boolean.valueOf(isShowCollectingAreaInGeneralSectionPref.getValue());
141
            }
142

  
143
            key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.DeterminationOnlyForFieldUnits);
144
            CdmPreference isDeterminationOnlyForFieldUnitsPref = service.find(key);
145
            if (isDeterminationOnlyForFieldUnitsPref != null){
146
                this.isDeterminationOnlyForFieldUnits = Boolean.valueOf(isDeterminationOnlyForFieldUnitsPref.getValue());
147
            }
148
            key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowTaxonAssociations);
149
            CdmPreference isShowTaxonAssociationPref = service.find(key);
150
            if (isShowTaxonAssociationPref != null){
151
                this.isShowTaxonAssociation = Boolean.valueOf(isShowTaxonAssociationPref.getValue());
152
                isUseLocalPreference = isShowTaxonAssociationPref.isAllowOverride();
153
            }
156 154

  
155
            key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowLifeForm);
156
            CdmPreference isShowLifeFormPref = service.find(key);
157
            if (isShowLifeFormPref != null){
158
                this.isShowLifeForm = Boolean.valueOf(isShowLifeFormPref.getValue());
159
            }
157 160

  
158
          }
159 161

  
160 162

  
163

  
164
        }
161 165
    }
162 166

  
163 167
    @Override

Also available in: Unified diff