--- /dev/null
+/**
+* Copyright (C) 2021 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.commons.lang3.StringUtils;
+
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.taxeditor.preference.LocalOrDefaultEnum;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.preference.menu.NameRelationshipTypeMenuPreferences;
+
+/**
+ * @author k.luther
+ * @since Jul 7, 2021
+ */
+public class NameRelationshipTypeAdminPreferences extends NameRelationshipTypeMenuPreferences {
+
+ public NameRelationshipTypeAdminPreferences(){
+ super();
+ isAdminPreference = true;
+ }
+
+
+
+ @Override
+ public boolean performOk() {
+ if (!isApply()){
+ return true;
+ }
+
+ Object[] checkedElements = treeComposite.getViewer().getCheckedElements();
+
+ List<UUID> listUIIDChecked = new ArrayList<>();
+
+ for (Object o : checkedElements) {
+ if(o instanceof TermDto){
+ TermDto termDto = (TermDto) o;
+ listUIIDChecked.add(termDto.getUuid());
+
+ }
+ }
+ String saveCheckedElements = StringUtils.join(listUIIDChecked, ";"); //$NON-NLS-1$
+ if (pref == null){
+ saveCheckedElements = null;
+ }
+ CdmPreference savePref = CdmPreference.NewTaxEditorInstance(predicate, saveCheckedElements);
+ String text = this.useLocalOrAdmin.getText();
+ if (text.equals(LocalOrDefaultEnum.Database.getLabel()) ){
+ savePref.setAllowOverride(false);
+ }else if (text.equals(LocalOrDefaultEnum.AllowOverride.getLabel())){
+ savePref.setAllowOverride(true);
+ }
+
+ PreferencesUtil.setPreferenceToDB(savePref);
+ PreferencesUtil.updateDBPreferences();
+ PreferencesUtil.firePreferencesChanged(this.getClass());
+ return true;
+
+ }
+}