import org.apache.commons.lang.StringUtils;
import eu.etaxonomy.cdm.api.service.ITermService;
-import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.taxeditor.store.CdmStore;
termlist = termService.findByUUIDsAsDto(uuidList);
}
- if (listValue.isEmpty()){
- List<DefinedTermBase> terms = CdmStore.getTermManager().getAllTerms(type, null);
- for (DefinedTermBase term: terms){
- if (!(term instanceof eu.etaxonomy.cdm.model.description.Character) && term != null){
- termlist.add(TermDto.fromTerm(term, true));
- }
- }
+ if (listValue == null || listValue.isEmpty() ){
+ termlist = termService.findByTitleAsDto("", type);
+// if (terms != null){
+// for (DefinedTermBase term: terms){
+// if (!(term instanceof eu.etaxonomy.cdm.model.description.Character) && term != null){
+// termlist.add(TermDto.fromTerm(term, true));
+// }
+// }
+// }
}
return new ArrayList(termlist);
initialiseVocabularies();
treeComposite.getViewer().setInput(getVocabularies());
-
+ List<T> termsFromStringValues = null;
if (checkedValues != null && checkedValues != "") { //$NON-NLS-1$
String[] listChecked = checkedValues.split(";"); //$NON-NLS-1$
String[] listCheckedComma = checkedValues.split(","); //$NON-NLS-1$
if (listCheckedComma != null && checkedValues.contains(",")){ //$NON-NLS-1$
checked = Arrays.asList(listCheckedComma);
}
- List<T> termsFromStringValues = getTermsFromStringValues(checked);
- treeComposite.setCheckedElements(termsFromStringValues.toArray());
+ termsFromStringValues = getTermsFromStringValues(checked);
+ if (termsFromStringValues != null){
+ treeComposite.setCheckedElements(termsFromStringValues.toArray());
+ }
- }else{
- List<T> termsFromStringValues = getTermsFromStringValues(new ArrayList<String>());
- treeComposite.setCheckedElements(termsFromStringValues.toArray());
+ }
+ if (termsFromStringValues == null){
+ termsFromStringValues = getTermsFromStringValues(new ArrayList<String>());
+ if (termsFromStringValues != null){
+ treeComposite.setCheckedElements(termsFromStringValues.toArray());
+ }
}
}
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
import eu.etaxonomy.cdm.model.term.TermType;
-import eu.etaxonomy.cdm.persistence.dto.TermDto;
import eu.etaxonomy.cdm.persistence.dto.TermVocabularyDto;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
* @since 05.10.2018
*
*/
-public class AvailableDistributionStatusPage extends AbstractTermSelectionWizardPage<TermDto> {
+public class AvailableDistributionStatusPage extends TermSelectionWizardPage {
return checkedValues;
}
-
-
- /**
- * {@inheritDoc}
- */
@Override
protected List<TermVocabularyDto> getVocabulariesFromPreference() {
// TODO Auto-generated method stub
return null;
}
- @Override
- protected List<TermDto> getTermsFromStringValues(List<String> listValue) {
- // TODO Auto-generated method stub
- return null;
- }
+
+
+
}
--- /dev/null
+/**
+* Copyright (C) 2019 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.preference.wizard;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.commons.lang.StringUtils;
+
+import eu.etaxonomy.cdm.api.service.ITermService;
+import eu.etaxonomy.cdm.model.term.TermType;
+import eu.etaxonomy.cdm.persistence.dto.TermDto;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @since 26.09.2019
+ */
+public abstract class TermSelectionWizardPage extends AbstractTermSelectionWizardPage<TermDto> {
+
+ /**
+ * @param pageName
+ * @param type
+ */
+ protected TermSelectionWizardPage(String pageName, TermType type) {
+ super(pageName, type);
+
+ }
+
+ @Override
+ protected List<TermDto> getTermsFromStringValues(List<String> listValue) {
+ Collection<TermDto> termlist = null ;
+ ITermService termService = CdmStore.getService(ITermService.class);
+ List<UUID> uuidList = new ArrayList();
+ for (String s : listValue) {
+ if (!StringUtils.isBlank(s)){
+ UUID uuid = UUID.fromString(s);
+ uuidList.add(uuid);
+ }
+ }
+ if (!uuidList.isEmpty()){
+ termlist = termService.findByUUIDsAsDto(uuidList);
+ }
+
+ if (listValue == null || listValue.isEmpty() ){
+ termlist = termService.findByTitleAsDto("", type);
+ }
+ return new ArrayList(termlist);
+ }
+}