Project

General

Profile

« Previous | Next » 

Revision b1d7bf10

Added by Patrick Plitzner almost 6 years ago

ref #7362 Refactor json parser + add term request

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/webimport/termimport/parser/HierarchyParser.java
27 27
        LinkedList<HierarchyTermWrapper> wrapperList = new LinkedList<>();
28 28
        try {
29 29
            JSONObject jsonResponse = new JSONObject(response);
30
            JSONArray responseArray = jsonResponse.getJSONArray("results");
30
            JSONArray responseArray = ParserUtil.parseResults(jsonResponse);
31 31
            HierarchyTermWrapper childTerm = null;
32 32
            for(int i=0;i<responseArray.length();i++){
33
                JSONObject terminology = responseArray.getJSONObject(i);
34
                String label = terminology.getString("label");
35
                String uri = terminology.getString("uri");
33
                JSONObject jsonObject = responseArray.getJSONObject(i);
34
                String label = ParserUtil.parseLabel(jsonObject);
35
                String uri= ParserUtil.parseUri(jsonObject);
36 36
                HierarchyTermWrapper hierarchyTermWrapper = new HierarchyTermWrapper(uri, label);
37 37
                wrapperList.add(hierarchyTermWrapper);
38 38
                if(childTerm!=null){

Also available in: Unified diff