| 1 |
package net.oni2.aeinstaller.backend.depot.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 |
* Manually create a taxonomy term for internal use |
| 18 |
* |
| 19 |
* @param tid |
| 20 |
* ID |
| 21 |
* @param vid |
| 22 |
* VocabID |
| 23 |
* @param name |
| 24 |
* Term name |
| 25 |
*/ |
| 26 |
public TaxonomyTerm(int tid, int vid, String name) { |
| 27 |
this.tid = tid; |
| 28 |
this.vid = vid; |
| 29 |
this.name = name; |
| 30 |
this.description = ""; |
| 31 |
this.uri = ""; |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* @param json |
| 36 |
* JSONObject containing the item |
| 37 |
* @throws JSONException |
| 38 |
* If a key can't be found |
| 39 |
*/ |
| 40 |
public TaxonomyTerm(JSONObject json) throws JSONException { |
| 41 |
tid = json.getInt("tid"); |
| 42 |
vid = json.getInt("vid"); |
| 43 |
name = json.getString("name"); |
| 44 |
description = json.getString("description"); |
| 45 |
uri = json.getString("uri"); |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* @return the term ID (tid) |
| 50 |
*/ |
| 51 |
public int getTid() { |
| 52 |
return tid; |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* @return the vocabulary ID (vid) |
| 57 |
*/ |
| 58 |
public int getVid() { |
| 59 |
return vid; |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* @return the name |
| 64 |
*/ |
| 65 |
public String getName() { |
| 66 |
return name; |
| 67 |
} |
| 68 |
|
| 69 |
/** |
| 70 |
* @return the description |
| 71 |
*/ |
| 72 |
public String getDescription() { |
| 73 |
return description; |
| 74 |
} |
| 75 |
|
| 76 |
/** |
| 77 |
* @return the uri |
| 78 |
*/ |
| 79 |
public String getUri() { |
| 80 |
return uri; |
| 81 |
} |
| 82 |
|
| 83 |
@Override |
| 84 |
public String toString() { |
| 85 |
return getName(); |
| 86 |
} |
| 87 |
} |