Revision c1bd0764
Added by Patrick Plitzner about 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/webimport/termimport/parser/TerminologyParser.java | ||
---|---|---|
24 | 24 |
* |
25 | 25 |
*/ |
26 | 26 |
public class TerminologyParser { |
27 |
public static Collection<TerminologyWrapper> parse(String response){ |
|
27 |
public static Collection<TerminologyWrapper> parse(String response) throws JSONException{
|
|
28 | 28 |
List<TerminologyWrapper> wrapperList = new ArrayList<>(); |
29 |
try { |
|
30 |
JSONObject jsonResponse = new JSONObject(response); |
|
31 |
JSONArray responseArray = jsonResponse.getJSONArray("results"); |
|
32 |
for(int i=0;i<responseArray.length();i++){ |
|
33 |
JSONObject jsonObject = responseArray.getJSONObject(i); |
|
34 |
String name = jsonObject.getString("name"); |
|
35 |
String acronym = jsonObject.getString("acronym"); |
|
36 |
String description = ParserUtil.parseDescription(jsonObject); |
|
37 |
String uri = ParserUtil.parseUri(jsonObject); |
|
38 |
wrapperList.add(new TerminologyWrapper(name, acronym, description, uri)); |
|
39 |
} |
|
40 |
} catch (JSONException e) { |
|
41 |
e.printStackTrace(); |
|
29 |
JSONObject jsonResponse = new JSONObject(response); |
|
30 |
JSONArray responseArray = jsonResponse.getJSONArray("results"); |
|
31 |
for(int i=0;i<responseArray.length();i++){ |
|
32 |
JSONObject jsonObject = responseArray.getJSONObject(i); |
|
33 |
String name = jsonObject.getString("name"); |
|
34 |
String acronym = jsonObject.getString("acronym"); |
|
35 |
String description = ParserUtil.parseDescription(jsonObject); |
|
36 |
String uri = ParserUtil.parseUri(jsonObject); |
|
37 |
wrapperList.add(new TerminologyWrapper(name, acronym, description, uri)); |
|
42 | 38 |
} |
43 | 39 |
return wrapperList; |
44 | 40 |
} |
Also available in: Unified diff
Show error message when loading ontologies fails