| 1 | package net.oni2.moddepot.model; | 
 
 
 
 
 | 2 |  | 
 
 
 
 
 | 3 | import org.json.JSONException; | 
 
 
 
 
 | 4 | import org.json.JSONObject; | 
 
 
 
 
 | 5 |  | 
 
 
 
 
 | 6 | /** | 
 
 
 
 
 | 7 | * @author Christian Illy | 
 
 
 
 
 | 8 | */ | 
 
 
 
 
 | 9 | public class TaxonomyTerm { | 
 
 
 
 
 | 10 | private int tid; | 
 
 
 
 
 | 11 | private int vid; | 
 
 
 
 
 | 12 | private String name; | 
 
 
 
 
 | 13 | private String description; | 
 
 
 
 
 | 14 | private String uri; | 
 
 
 
 
 | 15 |  | 
 
 
 
 
 | 16 | /** | 
 
 
 
 
 | 17 | * @param json | 
 
 
 
 
 | 18 | *            JSONObject containing the item | 
 
 
 
 
 | 19 | * @throws JSONException | 
 
 
 
 
 | 20 | *             If a key can't be found | 
 
 
 
 
 | 21 | */ | 
 
 
 
 
 | 22 | public TaxonomyTerm(JSONObject json) throws JSONException { | 
 
 
 
 
 | 23 | tid = json.getInt("tid"); | 
 
 
 
 
 | 24 | vid = json.getInt("vid"); | 
 
 
 
 
 | 25 | name = json.getString("name"); | 
 
 
 
 
 | 26 | description = json.getString("description"); | 
 
 
 
 
 | 27 | uri = json.getString("uri"); | 
 
 
 
 
 | 28 | } | 
 
 
 
 
 | 29 |  | 
 
 
 
 
 | 30 | /** | 
 
 
 
 
 | 31 | * @return the term ID (tid) | 
 
 
 
 
 | 32 | */ | 
 
 
 
 
 | 33 | public int getTid() { | 
 
 
 
 
 | 34 | return tid; | 
 
 
 
 
 | 35 | } | 
 
 
 
 
 | 36 |  | 
 
 
 
 
 | 37 | /** | 
 
 
 
 
 | 38 | * @return the vocabulary ID (vid) | 
 
 
 
 
 | 39 | */ | 
 
 
 
 
 | 40 | public int getVid() { | 
 
 
 
 
 | 41 | return vid; | 
 
 
 
 
 | 42 | } | 
 
 
 
 
 | 43 |  | 
 
 
 
 
 | 44 | /** | 
 
 
 
 
 | 45 | * @return the name | 
 
 
 
 
 | 46 | */ | 
 
 
 
 
 | 47 | public String getName() { | 
 
 
 
 
 | 48 | return name; | 
 
 
 
 
 | 49 | } | 
 
 
 
 
 | 50 |  | 
 
 
 
 
 | 51 | /** | 
 
 
 
 
 | 52 | * @return the description | 
 
 
 
 
 | 53 | */ | 
 
 
 
 
 | 54 | public String getDescription() { | 
 
 
 
 
 | 55 | return description; | 
 
 
 
 
 | 56 | } | 
 
 
 
 
 | 57 |  | 
 
 
 
 
 | 58 | /** | 
 
 
 
 
 | 59 | * @return the uri | 
 
 
 
 
 | 60 | */ | 
 
 
 
 
 | 61 | public String getUri() { | 
 
 
 
 
 | 62 | return uri; | 
 
 
 
 
 | 63 | } | 
 
 
 
 
 | 64 |  | 
 
 
 
 
 | 65 | @Override | 
 
 
 
 
 | 66 | public String toString() { | 
 
 
 
 
 | 67 | return getName(); | 
 
 
 
 
 | 68 | } | 
 
 
 
 
 | 69 | } |