Project

General

Profile

Revision 845a6a70

ID845a6a7083192de9f4e3d951ecce274bc29c06a1
Parent 160f1cbd
Child 8b0979c7

Added by Patrick Plitzner 12 months ago

ref #6794 Replace FeatureTreeService with TermTreeService

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/character/CharacterEditor.java
55 55
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
56 56
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
57 57
import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
58
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
59 58
import eu.etaxonomy.cdm.api.service.ITermService;
59
import eu.etaxonomy.cdm.api.service.ITermTreeService;
60 60
import eu.etaxonomy.cdm.api.service.IVocabularyService;
61 61
import eu.etaxonomy.cdm.model.description.Character;
62 62
import eu.etaxonomy.cdm.model.description.Feature;
......
333 333
            //save characters because they can be modified in this editor
334 334
            featureTree.getDistinctTerms().forEach(character->CdmStore.getService(ITermService.class).merge(character,true));
335 335
        }
336
        CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(featureTree);
336
        CdmStore.getService(ITermTreeService.class).saveOrUpdate(featureTree);
337 337

  
338 338

  
339 339
        dirty.setDirty(false);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureTreeEditor.java
45 45

  
46 46
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
47 47
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
48
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
49 48
import eu.etaxonomy.cdm.api.service.ITermService;
49
import eu.etaxonomy.cdm.api.service.ITermTreeService;
50 50
import eu.etaxonomy.cdm.model.description.Character;
51 51
import eu.etaxonomy.cdm.model.description.Feature;
52 52
import eu.etaxonomy.cdm.model.term.TermNode;
......
136 136
            }
137 137
        });
138 138

  
139
        List<TermTree> trees = CdmStore.getService(IFeatureTreeService.class).list(TermTree.class, null, null, null, null);
139
        List<TermTree> trees = CdmStore.getService(ITermTreeService.class).list(TermTree.class, null, null, null, null);
140 140
        viewer.setComparator(new FeatureTreeViewerComparator());
141 141
        viewer.setInput(trees);
142 142

  
......
249 249
        // commit the conversation and start a new transaction immediately
250 250
        conversation.commit(true);
251 251

  
252
        CdmStore.getService(IFeatureTreeService.class).saveOrUpdate((List)getRootEntities());
252
        CdmStore.getService(ITermTreeService.class).saveOrUpdate((List)getRootEntities());
253 253

  
254 254
        List<TermTree<Feature>> rootEntities = getRootEntities();
255 255
        for (TermTree featureTree : rootEntities) {
......
268 268
    private void initializeTrees() {
269 269
        Object[] expandedElements = viewer.getExpandedElements();
270 270
        viewer.getTree().removeAll();
271
        List<TermTree> trees = CdmStore.getService(IFeatureTreeService.class).list(TermTree.class, null, null, null, null);
271
        List<TermTree> trees = CdmStore.getService(ITermTreeService.class).list(TermTree.class, null, null, null, null);
272 272
        viewer.setInput(trees);
273 273
        viewer.setExpandedElements(expandedElements);
274 274
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/operation/CreateFeatureTreeOperation.java
13 13
import org.eclipse.core.runtime.IProgressMonitor;
14 14
import org.eclipse.core.runtime.IStatus;
15 15

  
16
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
16
import eu.etaxonomy.cdm.api.service.ITermTreeService;
17 17
import eu.etaxonomy.cdm.model.description.Feature;
18 18
import eu.etaxonomy.cdm.model.term.TermTree;
19 19
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
......
36 36

  
37 37
    @Override
38 38
    public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
39
        CdmStore.getService(IFeatureTreeService.class).save(element);
39
        CdmStore.getService(ITermTreeService.class).save(element);
40 40
        return postExecute(element);
41 41
    }
42 42

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/operation/RemoveFeatureTreeOperation.java
13 13
import org.eclipse.core.runtime.IProgressMonitor;
14 14
import org.eclipse.core.runtime.IStatus;
15 15

  
16
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
16
import eu.etaxonomy.cdm.api.service.ITermTreeService;
17 17
import eu.etaxonomy.cdm.model.description.Feature;
18 18
import eu.etaxonomy.cdm.model.term.TermTree;
19 19
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
......
36 36

  
37 37
    @Override
38 38
    public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
39
        CdmStore.getService(IFeatureTreeService.class).delete(element.getUuid());
39
        CdmStore.getService(ITermTreeService.class).delete(element.getUuid());
40 40
        return postExecute(null);
41 41
    }
42 42

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/out/owl/OwlTermExportWizardPage.java
21 21
import org.eclipse.swt.widgets.Composite;
22 22
import org.eclipse.swt.widgets.FileDialog;
23 23

  
24
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
24
import eu.etaxonomy.cdm.api.service.ITermTreeService;
25 25
import eu.etaxonomy.cdm.api.service.IVocabularyService;
26 26
import eu.etaxonomy.cdm.common.CdmUtils;
27 27
import eu.etaxonomy.cdm.model.description.Feature;
......
58 58
        composite.getSelectVocabularyComposite().getViewer().setInput(areaVocabularies);
59 59
        composite.getSelectVocabularyComposite().getViewer().addCheckStateListener(e->updateButtons());
60 60

  
61
        List<TermTree<Feature>> trees = (List)CdmStore.getService(IFeatureTreeService.class).list(TermTree.class, null, null, null, null);
61
        List<TermTree<Feature>> trees = (List)CdmStore.getService(ITermTreeService.class).list(TermTree.class, null, null, null, null);
62 62
        composite.getSelectFeatureTreeComposite().getViewer().setInput(trees);
63 63
        composite.getSelectFeatureTreeComposite().getViewer().addCheckStateListener(e->updateButtons());
64 64

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/DefaultFeatureTreePreferenecs.java
23 23
import org.eclipse.swt.widgets.Composite;
24 24
import org.eclipse.swt.widgets.Control;
25 25

  
26
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
26
import eu.etaxonomy.cdm.api.service.ITermTreeService;
27 27
import eu.etaxonomy.cdm.model.description.Feature;
28 28
import eu.etaxonomy.cdm.model.term.TermTree;
29 29
import eu.etaxonomy.taxeditor.featuretree.FeatureTreeContentProvider;
......
83 83
			}
84 84
		});
85 85

  
86
		List<TermTree<Feature>> input = (List)CdmStore.getService(IFeatureTreeService.class).list(TermTree.class, null, null, null, null);
86
		List<TermTree<Feature>> input = (List)CdmStore.getService(ITermTreeService.class).list(TermTree.class, null, null, null, null);
87 87

  
88 88
		viewer.setInput(input);
89 89

  
......
114 114
			}
115 115
		});
116 116

  
117
		List<TermTree<Feature>> input = (List)CdmStore.getService(IFeatureTreeService.class).list(TermTree.class, null, null, null, null);
117
		List<TermTree<Feature>> input = (List)CdmStore.getService(ITermTreeService.class).list(TermTree.class, null, null, null, null);
118 118

  
119 119
		viewer.setInput(input);
120 120

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
41 41

  
42 42
import eu.etaxonomy.cdm.api.application.ICdmRepository;
43 43
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeConfigurator;
44
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
45 44
import eu.etaxonomy.cdm.api.service.ITermService;
45
import eu.etaxonomy.cdm.api.service.ITermTreeService;
46 46
import eu.etaxonomy.cdm.api.service.config.FindTaxaAndNamesConfiguratorImpl;
47 47
import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;
48 48
import eu.etaxonomy.cdm.common.CdmUtils;
......
969 969
            return null;
970 970
        }
971 971
        TermTree<Feature> tree = CdmStore.getService(
972
                    IFeatureTreeService.class).load(UUID.fromString(uuidString));
972
                ITermTreeService.class).load(UUID.fromString(uuidString));
973 973
        if (tree.getId() == 0) {
974 974
            return null;
975 975
        }
......
980 980
        String uuidString = getStringValue(
981 981
                FEATURE_TREE_DEFAULT_STRUCTURE);
982 982
        return StringUtils.isBlank(uuidString) ? null : CdmStore.getService(
983
                IFeatureTreeService.class).load(UUID.fromString(uuidString));
983
                ITermTreeService.class).load(UUID.fromString(uuidString));
984 984
    }
985 985

  
986 986
    public static void setSortRanksHierarchichally(boolean selection) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java
36 36
import eu.etaxonomy.cdm.api.service.ICollectionService;
37 37
import eu.etaxonomy.cdm.api.service.ICommonService;
38 38
import eu.etaxonomy.cdm.api.service.IDescriptionService;
39
import eu.etaxonomy.cdm.api.service.IDescriptiveDataSetService;
39 40
import eu.etaxonomy.cdm.api.service.IEntityConstraintViolationService;
40 41
import eu.etaxonomy.cdm.api.service.IEntityValidationService;
41
import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
42
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
43 42
import eu.etaxonomy.cdm.api.service.IGrantedAuthorityService;
44 43
import eu.etaxonomy.cdm.api.service.IGroupService;
45 44
import eu.etaxonomy.cdm.api.service.IMarkerService;
......
53 52
import eu.etaxonomy.cdm.api.service.IRightsService;
54 53
import eu.etaxonomy.cdm.api.service.IService;
55 54
import eu.etaxonomy.cdm.api.service.ITaxonService;
55
import eu.etaxonomy.cdm.api.service.ITermNodeService;
56 56
import eu.etaxonomy.cdm.api.service.ITermService;
57
import eu.etaxonomy.cdm.api.service.ITermTreeService;
57 58
import eu.etaxonomy.cdm.api.service.IUserService;
58 59
import eu.etaxonomy.cdm.api.service.IVocabularyService;
59
import eu.etaxonomy.cdm.api.service.IDescriptiveDataSetService;
60 60
import eu.etaxonomy.cdm.api.service.molecular.IAmplificationService;
61 61
import eu.etaxonomy.cdm.api.service.molecular.IPrimerService;
62 62
import  eu.etaxonomy.cdm.cache.CdmRemoteCacheManager;
......
65 65
import eu.etaxonomy.cdm.model.agent.AgentBase;
66 66
import eu.etaxonomy.cdm.model.common.Annotation;
67 67
import eu.etaxonomy.cdm.model.common.CdmBase;
68
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
69 68
import eu.etaxonomy.cdm.model.common.Group;
70 69
import eu.etaxonomy.cdm.model.common.Language;
71
import eu.etaxonomy.cdm.model.term.TermVocabulary;
72 70
import eu.etaxonomy.cdm.model.description.DescriptionBase;
73
import eu.etaxonomy.cdm.model.term.TermNode;
74
import eu.etaxonomy.cdm.model.term.TermTree;
71
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
75 72
import eu.etaxonomy.cdm.model.description.PolytomousKey;
76 73
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
77
import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
78 74
import eu.etaxonomy.cdm.model.media.Media;
79 75
import eu.etaxonomy.cdm.model.media.Rights;
80 76
import eu.etaxonomy.cdm.model.molecular.Amplification;
......
86 82
import eu.etaxonomy.cdm.model.reference.Reference;
87 83
import eu.etaxonomy.cdm.model.taxon.Classification;
88 84
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
85
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
86
import eu.etaxonomy.cdm.model.term.TermNode;
87
import eu.etaxonomy.cdm.model.term.TermTree;
88
import eu.etaxonomy.cdm.model.term.TermVocabulary;
89 89
import eu.etaxonomy.cdm.model.validation.EntityConstraintViolation;
90 90
import eu.etaxonomy.cdm.model.validation.EntityValidation;
91 91
import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
......
729 729
                service = (IService<T>) getService(IEntityValidationService.class);
730 730
            }
731 731
            else if (cdmBase instanceof TermNode) {
732
                service = (IService<T>) getService(IFeatureNodeService.class);
732
                service = (IService<T>) getService(ITermNodeService.class);
733 733
            }
734 734
            else if (cdmBase instanceof TermTree) {
735
                service = (IService<T>) getService(IFeatureTreeService.class);
735
                service = (IService<T>) getService(ITermTreeService.class);
736 736
            }
737 737
            else if (cdmBase instanceof GrantedAuthority) {
738 738
                service = (IService<T>) getService(IGrantedAuthorityService.class);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/UseObjectStore.java
17 17
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
18 18
import eu.etaxonomy.cdm.api.service.ITermService;
19 19
import eu.etaxonomy.cdm.api.service.IVocabularyService;
20
import eu.etaxonomy.cdm.model.term.DefinedTerm;
21 20
import eu.etaxonomy.cdm.model.common.MarkerType;
22
import eu.etaxonomy.cdm.model.term.TermType;
23
import eu.etaxonomy.cdm.model.term.TermVocabulary;
24 21
import eu.etaxonomy.cdm.model.description.Feature;
25 22
import eu.etaxonomy.cdm.model.description.State;
23
import eu.etaxonomy.cdm.model.term.DefinedTerm;
24
import eu.etaxonomy.cdm.model.term.TermType;
25
import eu.etaxonomy.cdm.model.term.TermVocabulary;
26 26

  
27 27
/**
28
 * A store to handle all terms and vocabulary required for 
28
 * A store to handle all terms and vocabulary required for
29 29
 * the UseObjects view and components.
30 30
 * Whenever one of the terms is requested, all required terms are generated
31
 * in the database as we consider the requests as an indicator that 
31
 * in the database as we consider the requests as an indicator that
32 32
 * someone wants to use the terms.
33
 * This  
33
 * This
34 34
 * @author a.theys
35 35
 * @author a.mueller
36 36
 * @created mar 13, 2012
......
38 38
public class UseObjectStore {
39 39

  
40 40
	private static boolean isInitialized;
41
	
41

  
42 42
	private static MarkerType useMarkerType;
43 43
	private static Feature useSummaryFeature;
44 44
	private static Feature useRecordFeature;
45
	
46
	
45

  
46

  
47 47
	public static void reset() {
48 48
		isInitialized = false;
49 49
		useMarkerType = null;
50 50
		useSummaryFeature = null;
51 51
		useRecordFeature = null;
52 52
	}
53
	
53

  
54 54
	public static MarkerType getUseMarkerType() {
55 55
		initialize();
56 56
		return useMarkerType;
57 57
	}
58
	
58

  
59 59
	public static Feature getUseSummaryFeature() {
60 60
		initialize();
61 61
		return useSummaryFeature;
62 62
	}
63
	
63

  
64 64
	public static Feature getUseRecordFeature() {
65 65
		initialize();
66 66
		return useRecordFeature;
67 67
	}
68 68

  
69
	
69

  
70 70
	private static void initialize(){
71 71
		setupNecessaryItems(null);
72 72
		isInitialized = true;
73 73
	}
74
	
74

  
75 75
	private static void setupNecessaryItems( IProgressMonitor monitor ) {
76 76
		if (isInitialized){
77 77
			return;
......
80 80
			//TODO can we use a better one?
81 81
			monitor = new NullProgressMonitor();
82 82
		}
83
		
83

  
84 84
		ConversationHolder conversation = CdmStore.createConversation();
85
		
85

  
86 86
		//retrieve terms and vocabularies from db
87 87
		useRecordFeature = (Feature) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseRecordFeature);
88 88
		useSummaryFeature = (Feature) CdmStore.getService(ITermService.class).find(UsageTermCollection.uuidUseSummaryFeature);
89 89

  
90
		
90

  
91 91

  
92 92
		//create use marker type if not exists
93 93
		createUseMarkerType(conversation);
......
106 106

  
107 107
		if(useRecordFeature == null || useSummaryFeature == null) {
108 108
			TermVocabulary<Feature> featureVocabulary = CdmStore.getService(IVocabularyService.class).find((UsageTermCollection.uuidFeatureVocabulary));
109
//			FeatureTree palmWebFeatureTree = CdmStore.getService(IFeatureTreeService.class).find(UsageTermCollection.uuidPalmWebFeatureTree);
109
//			FeatureTree palmWebFeatureTree = CdmStore.getService(ITermTreeService.class).find(UsageTermCollection.uuidPalmWebFeatureTree);
110 110

  
111 111
			if (useRecordFeature == null ) {
112 112
				useRecordFeature = Feature.NewInstance(UsageTermCollection.useRecordFeatureLabel, UsageTermCollection.useRecordFeatureLabel, null);
113 113
				useRecordFeature.setUuid(UsageTermCollection.uuidUseRecordFeature);
114 114
				useRecordFeature.setSupportsCategoricalData(true);
115 115
				featureVocabulary.addTerm(useRecordFeature);
116
				
116

  
117 117
//				if (palmWebFeatureTree != null){
118 118
//					FeatureNode useRecFeatureNode = FeatureNode.NewInstance(featureUseRecord);
119 119
//					palmWebFeatureTree.getRoot().addChild(useRecFeatureNode);
......
136 136

  
137 137
			CdmStore.getService(IVocabularyService.class).saveOrUpdate(featureVocabulary);
138 138
//			if (palmWebFeatureTree != null){
139
//				CdmStore.getService(IFeatureTreeService.class).saveOrUpdate(palmWebFeatureTree);
139
//				CdmStore.getService(ITermTreeService.class).saveOrUpdate(palmWebFeatureTree);
140 140
//			}
141 141
			conversation.commit(true);
142 142

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)