2 * Copyright (C) 2019 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.preference
;
11 import java
.util
.ArrayList
;
12 import java
.util
.List
;
13 import java
.util
.UUID
;
15 import org
.eclipse
.swt
.widgets
.Composite
;
16 import org
.eclipse
.swt
.widgets
.Control
;
17 import org
.eclipse
.swt
.widgets
.Table
;
19 import eu
.etaxonomy
.cdm
.api
.service
.IVocabularyService
;
20 import eu
.etaxonomy
.cdm
.model
.metadata
.CdmPreference
;
21 import eu
.etaxonomy
.cdm
.model
.term
.TermType
;
22 import eu
.etaxonomy
.cdm
.persistence
.dto
.TermVocabularyDto
;
23 import eu
.etaxonomy
.taxeditor
.preference
.menu
.CdmPreferencePage
;
24 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
30 public abstract class AbstractVocabularySelectionPreference
extends CdmPreferencePage
{
31 protected Table table
;
33 protected CdmPreference pref
;
34 protected TermType type
;
35 protected List
<CdmPreference
> prefsToDelete
= new ArrayList
<>();
36 protected List
<TermVocabularyDto
> vocabularies
;
37 protected boolean override
;
40 protected Control
createContents(Composite parent
) {
41 // TODO Auto-generated method stub
48 protected void refresh() {
62 public abstract void createTableRow(CdmPreference pref
) ;
63 // public abstract String getUUIDFromSubject(CdmPreference pref);
65 protected void fillVocabularies(CdmPreference vocPref
){
66 List
<UUID
> uuids
= null;
67 if (isAdminPreference
){
68 uuids
= PreferencesUtil
.createUuidList(vocPref
.getValue());
70 uuids
= PreferencesUtil
.createUUIDListFromStringPref(vocPref
.getPredicate(), false);
72 if (uuids
== null || uuids
.isEmpty()){
73 vocabularies
= new ArrayList();
74 vocabularies
= CdmStore
.getService(IVocabularyService
.class).findVocabularyDtoByTermType(type
);
76 vocabularies
= CdmStore
.getService(IVocabularyService
.class).findVocabularyDtoByVocabularyUuids(uuids
);