Project

General

Profile

Revision df9fa40d

IDdf9fa40dd352274b65db308307197ec73a88c2e8
Parent 533fd1e8
Child 269e40a9

Added by Patrick Plitzner over 3 years ago

ref #7362 Ask for detail loading when importing term

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/FeatureNodeDropAdapter.java
33 33
import eu.etaxonomy.taxeditor.model.MessagingUtils;
34 34
import eu.etaxonomy.taxeditor.store.CdmStore;
35 35
import eu.etaxonomy.taxeditor.ui.dialog.selection.TermVocabularySelectionDialog;
36
import eu.etaxonomy.taxeditor.view.webimport.termimport.parser.ParserUtil;
36 37
import eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper.OntologyTermWrapper;
37 38

  
38 39
public class FeatureNodeDropAdapter extends ViewerDropAdapter {
......
111 112
		            return false;
112 113
		        }
113 114
		        if(vocabulary!=null){
115
		            if(wrapper.getDescription()==null && MessagingUtils.confirmDialog("Load Details?", "Not all details for this term have been loaded yet.\n"
116
		                    + "Do you want to load the details before adding it?")){
117
		                ParserUtil.loadDetails(wrapper);
118
		            }
114 119
		            Feature feature = Feature.NewInstance(wrapper.getDescription(), wrapper.getLabel(), null);
115 120
		            feature.setUri(URI.create(wrapper.getUri()));
116 121
		            vocabulary.addTerm(feature);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/webimport/termimport/GfBioTerminologyImportPresenter.java
35 35
import eu.etaxonomy.taxeditor.model.ColorResources;
36 36
import eu.etaxonomy.taxeditor.model.MessagingUtils;
37 37
import eu.etaxonomy.taxeditor.preference.Resources;
38
import eu.etaxonomy.taxeditor.view.webimport.termimport.parser.ParserUtil;
38 39
import eu.etaxonomy.taxeditor.view.webimport.termimport.parser.TermParser;
39 40
import eu.etaxonomy.taxeditor.view.webimport.termimport.parser.TerminologyParser;
40 41
import eu.etaxonomy.taxeditor.view.webimport.termimport.requests.RequestSearch;
41 42
import eu.etaxonomy.taxeditor.view.webimport.termimport.requests.RequestSuggest;
42
import eu.etaxonomy.taxeditor.view.webimport.termimport.requests.RequestTerm;
43 43
import eu.etaxonomy.taxeditor.view.webimport.termimport.requests.RequestTerminologies;
44 44
import eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper.OntologyTermWrapper;
45 45
import eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper.TerminologyWrapper;
......
185 185

  
186 186
    private void loadTermDetails(){
187 187
        OntologyTermWrapper selectedWrapper = getSelectedTerm((IStructuredSelection) composite.getTreeTermHierarchy().getSelection());
188
        //load term description
189
        String request = new RequestTerm(selectedWrapper.getUri(), selectedWrapper.getSourceTerminology()).request();
190
        OntologyTermWrapper detailTerm = TermParser.parseSingleTerm(request);
191
        selectedWrapper.setDescription(detailTerm.getDescription());
188
        ParserUtil.loadDetails(selectedWrapper);
192 189
        updateDetails(new StructuredSelection(selectedWrapper));
193 190
    }
194 191

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/webimport/termimport/parser/ParserUtil.java
12 12
import org.json.JSONException;
13 13
import org.json.JSONObject;
14 14

  
15
import eu.etaxonomy.taxeditor.view.webimport.termimport.requests.RequestTerm;
16
import eu.etaxonomy.taxeditor.view.webimport.termimport.wrapper.OntologyTermWrapper;
17

  
15 18
/**
16 19
 * @author pplitzner
17 20
 * @since May 31, 2018
......
42 45
    public static String parseTerminology(JSONObject jsonObject) throws JSONException {
43 46
        return jsonObject.getString("sourceTerminology");
44 47
    }
48

  
49
    /**
50
     * Loads and sets detail information for the given wrapper
51
     * @param wrapper the wrapper for which the detailed information will be loaded and set
52
     */
53
    public static void loadDetails(OntologyTermWrapper wrapper) {
54
        String request = new RequestTerm(wrapper.getUri(), wrapper.getSourceTerminology()).request();
55
        OntologyTermWrapper detailTerm = TermParser.parseSingleTerm(request);
56
        wrapper.setDescription(detailTerm.getDescription());
57
    }
45 58
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)