[748] | 1 | package net.oni2.moddepot.model;
|
---|
| 2 |
|
---|
| 3 | import net.oni2.moddepot.JSONHelpers;
|
---|
| 4 |
|
---|
| 5 | import org.json.JSONException;
|
---|
| 6 | import org.json.JSONObject;
|
---|
| 7 |
|
---|
| 8 | /**
|
---|
| 9 | * @author Christian Illy
|
---|
| 10 | */
|
---|
| 11 | public class File {
|
---|
| 12 | private int fid;
|
---|
| 13 | private int uid; // User ID of uploader
|
---|
| 14 | private String filename; // Filename
|
---|
| 15 | private String uri; // Internal URI
|
---|
| 16 | private String filemime; // Mimetype
|
---|
| 17 | private int filesize; // Bytes
|
---|
| 18 | private int status; // ???
|
---|
| 19 | private long timestamp; // Timestamp of upload
|
---|
| 20 | private String uri_full; // Full public URI
|
---|
| 21 | private String target_uri; // ???
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * @param json
|
---|
| 25 | * JSON object of File to parse
|
---|
| 26 | * @throws JSONException
|
---|
| 27 | * On key not found / wrong type
|
---|
| 28 | */
|
---|
| 29 | public File(JSONObject json) throws JSONException {
|
---|
| 30 | fid = json.getInt("fid");
|
---|
| 31 | uid = json.getInt("uid");
|
---|
| 32 | filename = JSONHelpers.getStringOrNull(json, "filename");
|
---|
| 33 | uri = JSONHelpers.getStringOrNull(json, "uri");
|
---|
| 34 | filemime = JSONHelpers.getStringOrNull(json, "filemime");
|
---|
| 35 | filesize = json.getInt("filesize");
|
---|
| 36 | status = json.getInt("status");
|
---|
| 37 | timestamp = json.getLong("timestamp");
|
---|
| 38 | uri_full = JSONHelpers.getStringOrNull(json, "uri_full");
|
---|
| 39 | target_uri = JSONHelpers.getStringOrNull(json, "target_uri");
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | /**
|
---|
| 43 | * @return the fid
|
---|
| 44 | */
|
---|
| 45 | public int getFid() {
|
---|
| 46 | return fid;
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | /**
|
---|
| 50 | * @return the uid
|
---|
| 51 | */
|
---|
| 52 | public int getUid() {
|
---|
| 53 | return uid;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | /**
|
---|
| 57 | * @return the filename
|
---|
| 58 | */
|
---|
| 59 | public String getFilename() {
|
---|
| 60 | return filename;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | /**
|
---|
| 64 | * @return the uri
|
---|
| 65 | */
|
---|
| 66 | public String getUri() {
|
---|
| 67 | return uri;
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | /**
|
---|
| 71 | * @return the filemime
|
---|
| 72 | */
|
---|
| 73 | public String getFilemime() {
|
---|
| 74 | return filemime;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | /**
|
---|
| 78 | * @return the filesize
|
---|
| 79 | */
|
---|
| 80 | public int getFilesize() {
|
---|
| 81 | return filesize;
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | /**
|
---|
| 85 | * @return the status
|
---|
| 86 | */
|
---|
| 87 | public int getStatus() {
|
---|
| 88 | return status;
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | /**
|
---|
| 92 | * @return the timestamp
|
---|
| 93 | */
|
---|
| 94 | public long getTimestamp() {
|
---|
| 95 | return timestamp;
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | /**
|
---|
| 99 | * @return the uri_full
|
---|
| 100 | */
|
---|
| 101 | public String getUri_full() {
|
---|
| 102 | return uri_full;
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | /**
|
---|
| 106 | * @return the target_uri
|
---|
| 107 | */
|
---|
| 108 | public String getTarget_uri() {
|
---|
| 109 | return target_uri;
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | }
|
---|