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 NodeField_Upload {
|
---|
12 |
|
---|
13 | private long timestamp; // Time of upload
|
---|
14 | private int uid; // User ID of uploader
|
---|
15 | private int fid; // File ID
|
---|
16 | private int filesize; // Size in bytes
|
---|
17 | private String status; // ???
|
---|
18 | private String description;// Description
|
---|
19 | private String filename; // Filename
|
---|
20 | private int display; // isVisible
|
---|
21 | private String filemime; // Mimetype
|
---|
22 | private String uri; // Private URI
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * @param json
|
---|
26 | * JSON object of upload-entry to parse
|
---|
27 | * @throws JSONException
|
---|
28 | * On key not found / wrong type
|
---|
29 | */
|
---|
30 | public NodeField_Upload(JSONObject json) throws JSONException {
|
---|
31 | timestamp = json.getLong("timestamp");
|
---|
32 | uid = json.getInt("uid");
|
---|
33 | fid = json.getInt("fid");
|
---|
34 | filesize = json.getInt("filesize");
|
---|
35 | status = JSONHelpers.getStringOrNull(json, "status");
|
---|
36 | description = JSONHelpers.getStringOrNull(json, "description");
|
---|
37 | filename = JSONHelpers.getStringOrNull(json, "filename");
|
---|
38 | display = json.getInt("display");
|
---|
39 | filemime = JSONHelpers.getStringOrNull(json, "filemime");
|
---|
40 | uri = JSONHelpers.getStringOrNull(json, "uri");
|
---|
41 | }
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * @return the timestamp
|
---|
45 | */
|
---|
46 | public long getTimestamp() {
|
---|
47 | return timestamp;
|
---|
48 | }
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * @return the uid
|
---|
52 | */
|
---|
53 | public int getUid() {
|
---|
54 | return uid;
|
---|
55 | }
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * @return the fid
|
---|
59 | */
|
---|
60 | public int getFid() {
|
---|
61 | return fid;
|
---|
62 | }
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * @return the filesize
|
---|
66 | */
|
---|
67 | public int getFilesize() {
|
---|
68 | return filesize;
|
---|
69 | }
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * @return the status
|
---|
73 | */
|
---|
74 | public String getStatus() {
|
---|
75 | return status;
|
---|
76 | }
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * @return the description
|
---|
80 | */
|
---|
81 | public String getDescription() {
|
---|
82 | return description;
|
---|
83 | }
|
---|
84 |
|
---|
85 | /**
|
---|
86 | * @return the filename
|
---|
87 | */
|
---|
88 | public String getFilename() {
|
---|
89 | return filename;
|
---|
90 | }
|
---|
91 |
|
---|
92 | /**
|
---|
93 | * @return the display
|
---|
94 | */
|
---|
95 | public int getDisplay() {
|
---|
96 | return display;
|
---|
97 | }
|
---|
98 |
|
---|
99 | /**
|
---|
100 | * @return the filemime
|
---|
101 | */
|
---|
102 | public String getFilemime() {
|
---|
103 | return filemime;
|
---|
104 | }
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * @return the uri
|
---|
108 | */
|
---|
109 | public String getUri() {
|
---|
110 | return uri;
|
---|
111 | }
|
---|
112 | }
|
---|