Revision 88df332d
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableDistributionPage.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.preference.wizard; |
10 | 10 |
|
11 |
import java.util.ArrayList; |
|
11 | 12 |
import java.util.Arrays; |
12 | 13 |
import java.util.Collection; |
13 | 14 |
import java.util.HashMap; |
15 |
import java.util.HashSet; |
|
14 | 16 |
import java.util.List; |
15 | 17 |
import java.util.Map; |
18 |
import java.util.Set; |
|
19 |
import java.util.UUID; |
|
16 | 20 |
|
21 |
import org.apache.commons.lang.StringUtils; |
|
17 | 22 |
import org.eclipse.jface.preference.IPreferenceStore; |
18 | 23 |
import org.eclipse.jface.viewers.CheckStateChangedEvent; |
19 | 24 |
import org.eclipse.jface.viewers.CheckboxTreeViewer; |
... | ... | |
28 | 33 |
import org.eclipse.swt.widgets.Composite; |
29 | 34 |
import org.eclipse.swt.widgets.Display; |
30 | 35 |
|
36 |
import eu.etaxonomy.cdm.api.service.IVocabularyService; |
|
31 | 37 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
38 |
import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
|
32 | 39 |
import eu.etaxonomy.cdm.model.common.TermType; |
40 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
|
41 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
|
33 | 42 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
34 | 43 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
35 | 44 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
... | ... | |
266 | 275 |
return propertyPathsMap; |
267 | 276 |
} |
268 | 277 |
|
278 |
@Override |
|
279 |
protected List<TermVocabulary<DefinedTermBase>> getVocabulariesFromPreference(){ |
|
280 |
List<TermVocabulary<DefinedTermBase>> vocs = new ArrayList(); |
|
281 |
|
|
282 |
if (PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies) == null && PreferencesUtil.getPreferenceStore().getString(PreferencesUtil.DISTRIBUTION_VOCABULARIES) == null){ |
|
283 |
vocs = CdmStore.getService(IVocabularyService.class).findByTermType( |
|
284 |
type, null); |
|
285 |
}else{ |
|
286 |
String vocString = PreferencesUtil.getPreferenceStore().getString(PreferencesUtil.DISTRIBUTION_VOCABULARIES); |
|
287 |
|
|
288 |
String[] arrayVocs = vocString.split(";"); |
|
289 |
|
|
290 |
Set<UUID> uuidVocs = new HashSet(); |
|
291 |
for (String voc: arrayVocs){ |
|
292 |
if (!StringUtils.isBlank(voc)){ |
|
293 |
uuidVocs.add(UUID.fromString(voc)); |
|
294 |
} |
|
295 |
} |
|
296 |
List<TermVocabulary> tempVocs = CdmStore.getService(IVocabularyService.class).find(uuidVocs); |
|
297 |
for (TermVocabulary voc: tempVocs){ |
|
298 |
vocs.add(voc); |
|
299 |
} |
|
300 |
|
|
301 |
} |
|
302 |
return vocs; |
|
303 |
} |
|
269 | 304 |
|
270 | 305 |
|
271 | 306 |
|
Also available in: Unified diff
smaller changes in preferences for distribution vocabularies