Project

General

Profile

Revision d50317d6

IDd50317d6cec65a89fe9104ca1ea14e5533b690e2
Parent 88672879
Child f4935f27

Added by Patrick Plitzner over 1 year ago

ref #8041 Use existing service method for retrieval of UuidAndTitleCache

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/FeatureSelectionDialog.java
9 9

  
10 10
package eu.etaxonomy.taxeditor.ui.dialog.selection;
11 11

  
12
import java.util.ArrayList;
13
import java.util.List;
14 12
import java.util.UUID;
15 13

  
16 14
import org.eclipse.swt.widgets.Shell;
......
18 16
import eu.etaxonomy.cdm.api.service.ITermService;
19 17
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
20 18
import eu.etaxonomy.cdm.model.description.Feature;
21
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
22 19
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
23 20
import eu.etaxonomy.taxeditor.store.CdmStore;
24 21

  
......
66 63

  
67 64
	@Override
68 65
	protected void callService(String pattern) {
69
		List<Feature> features = CdmStore.getService(ITermService.class).list(Feature.class, null, null, null, null);
70

  
71
		List<UuidAndTitleCache<Feature>> featureUuidAndTitleCache = new ArrayList<UuidAndTitleCache<Feature>>();
72

  
73
		for(Feature feature : features){
74
			UuidAndTitleCache<Feature> uuidAndTitleCache = new UuidAndTitleCache<Feature>(Feature.class, feature.getUuid(), feature.getId(), feature.getTitleCache());
75
			if (pattern == null || uuidAndTitleCache.getTitleCache().matches("(?i)"+pattern + ".*")) {
76
                featureUuidAndTitleCache.add(uuidAndTitleCache);
77
            }
78
		}
79

  
80
		model =  featureUuidAndTitleCache;
81

  
66
        model = CdmStore.getService(ITermService.class).getUuidAndTitleCache(Feature.class, limitOfInitialElements, pattern);
82 67
	}
83 68

  
84 69
	/* (non-Javadoc)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/FeatureTreeSelectionDialog.java
9 9

  
10 10
package eu.etaxonomy.taxeditor.ui.dialog.selection;
11 11

  
12
import java.util.ArrayList;
13
import java.util.List;
14 12
import java.util.UUID;
15 13

  
16 14
import org.eclipse.jface.dialogs.InputDialog;
......
22 20

  
23 21
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
24 22
import eu.etaxonomy.cdm.model.description.FeatureTree;
25
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
26 23
import eu.etaxonomy.taxeditor.l10n.Messages;
27 24
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
28 25
import eu.etaxonomy.taxeditor.store.CdmStore;
......
55 52

  
56 53
	@Override
57 54
	protected void callService(String pattern) {
58
		List<FeatureTree> featureTrees = CdmStore.getService(IFeatureTreeService.class).list(FeatureTree.class, null, null, null, null);
59

  
60
		if(model == null){
61
			model = new ArrayList<>();
62
		}
63
		model.clear();
64
		for(FeatureTree featureTree : featureTrees){
65
			UuidAndTitleCache<FeatureTree> element = new UuidAndTitleCache<FeatureTree>(FeatureTree.class, featureTree.getUuid(),featureTree.getId(), featureTree.getTitleCache());
66
			if(pattern == null || element.getTitleCache().matches("(?i)"+pattern + ".*")) { //$NON-NLS-1$ //$NON-NLS-2$
67
                model.add(element);
68
            }
69
		}
70

  
55
        model = CdmStore.getService(IFeatureTreeService.class).getUuidAndTitleCache(FeatureTree.class, limitOfInitialElements, pattern);
71 56
	}
72 57

  
73 58
	@Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TermVocabularySelectionDialog.java
9 9

  
10 10
package eu.etaxonomy.taxeditor.ui.dialog.selection;
11 11

  
12
import java.util.ArrayList;
13
import java.util.List;
14 12
import java.util.UUID;
15 13

  
16 14
import org.eclipse.swt.widgets.Shell;
17 15

  
18 16
import eu.etaxonomy.cdm.api.service.IVocabularyService;
19 17
import eu.etaxonomy.cdm.model.common.TermVocabulary;
20
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
21 18
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
22 19
import eu.etaxonomy.taxeditor.newWizard.NewVocabularyWizard;
23 20
import eu.etaxonomy.taxeditor.store.CdmStore;
......
61 58

  
62 59
	@Override
63 60
	protected void callService(String pattern) {
64
		List<TermVocabulary> vocabularies = CdmStore.getService(IVocabularyService.class).list(TermVocabulary.class, null, null, null, null);
65

  
66
		List<UuidAndTitleCache<TermVocabulary>> featureUuidAndTitleCache = new ArrayList<>();
67

  
68
		for(TermVocabulary voc : vocabularies){
69
			UuidAndTitleCache<TermVocabulary> uuidAndTitleCache = new UuidAndTitleCache<>(TermVocabulary.class, voc.getUuid(), voc.getId(), voc.getTitleCache());
70
			if (pattern == null || uuidAndTitleCache.getTitleCache().matches("(?i)"+pattern + ".*")) {
71
                featureUuidAndTitleCache.add(uuidAndTitleCache);
72
            }
73
		}
74
		model =  featureUuidAndTitleCache;
61
        model = CdmStore.getService(IVocabularyService.class).getUuidAndTitleCache(TermVocabulary.class, limitOfInitialElements, pattern);
75 62
	}
76 63

  
77 64
	@Override

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)