Revision c295928b
Added by Katja Luther over 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableDistributionPage.java | ||
---|---|---|
20 | 20 |
import org.apache.commons.lang.StringUtils; |
21 | 21 |
import org.eclipse.swt.widgets.Composite; |
22 | 22 |
|
23 |
import eu.etaxonomy.cdm.api.service.ITermService; |
|
23 | 24 |
import eu.etaxonomy.cdm.api.service.IVocabularyService; |
24 | 25 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
26 |
import eu.etaxonomy.cdm.model.term.DefinedTermBase; |
|
25 | 27 |
import eu.etaxonomy.cdm.model.term.TermType; |
26 | 28 |
import eu.etaxonomy.cdm.model.term.TermVocabulary; |
27 |
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
|
|
29 |
import eu.etaxonomy.cdm.persistence.dto.TermDto; |
|
28 | 30 |
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto; |
29 | 31 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
30 | 32 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
... | ... | |
35 | 37 |
* @date 21.07.2014 |
36 | 38 |
* |
37 | 39 |
*/ |
38 |
public class AvailableDistributionPage extends AbstractTermSelectionWizardPage { |
|
40 |
public class AvailableDistributionPage extends AbstractTermSelectionWizardPage<TermDto> {
|
|
39 | 41 |
|
40 | 42 |
protected AvailableDistributionPage(String pageName) { |
41 | 43 |
super(pageName, TermType.NamedArea); |
... | ... | |
75 | 77 |
if (listCheckedComma != null && checkedValues.contains(",")){ //$NON-NLS-1$ |
76 | 78 |
checked = Arrays.asList(listCheckedComma); |
77 | 79 |
} |
78 |
List<AbstractTermDto> termsFromStringValues = getTermsFromStringValues(checked);
|
|
80 |
List<TermDto> termsFromStringValues = getTermsFromStringValues(checked); |
|
79 | 81 |
treeComposite.setCheckedElements(termsFromStringValues.toArray()); |
80 | 82 |
} |
81 | 83 |
|
... | ... | |
147 | 149 |
setVocabularies(vocs); |
148 | 150 |
} |
149 | 151 |
|
152 |
@Override |
|
153 |
protected List<TermDto> getTermsFromStringValues(List<String> listValue) { |
|
154 |
|
|
155 |
List<TermDto> termlist = new ArrayList<>(); |
|
156 |
ITermService termService = CdmStore.getService(ITermService.class); |
|
157 |
List<UUID> uuidList = new ArrayList(); |
|
158 |
for (String s : listValue) { |
|
159 |
if (!StringUtils.isBlank(s)){ |
|
160 |
UUID uuid = UUID.fromString(s); |
|
161 |
uuidList.add(uuid); |
|
162 |
} |
|
163 |
} |
|
164 |
termlist = new ArrayList(termService.findByUUIDsAsDto(uuidList)); |
|
165 |
|
|
166 |
|
|
167 |
if (listValue.isEmpty()){ |
|
168 |
List<DefinedTermBase> terms = CdmStore.getTermManager().getAllTerms(type, null); |
|
169 |
for (DefinedTermBase term: terms){ |
|
170 |
termlist.add(TermDto.fromTerm(term, true)); |
|
171 |
} |
|
172 |
} |
|
173 |
|
|
174 |
return termlist; |
|
175 |
|
|
176 |
|
|
177 |
} |
|
178 |
|
|
150 | 179 |
} |
Also available in: Unified diff
ref #8568: performance issues for term and voc preference pages