1
|
package eu.dnetlib.data.objectstore.rmi;
|
2
|
|
3
|
import java.io.Serializable;
|
4
|
|
5
|
import com.google.gson.Gson;
|
6
|
|
7
|
/**
|
8
|
* The Class ObjectStoreFile.
|
9
|
*/
|
10
|
public class ObjectStoreFile implements Serializable {
|
11
|
|
12
|
/** The Constant serialVersionUID. */
|
13
|
private static final long serialVersionUID = -6501291693572693712L;
|
14
|
|
15
|
/** The metadata related id. */
|
16
|
private String metadataRelatedID;
|
17
|
|
18
|
/** The object id. */
|
19
|
private String objectID;
|
20
|
|
21
|
/** The mime type. */
|
22
|
private String mimeType;
|
23
|
|
24
|
/** The access protocol. */
|
25
|
private Protocols accessProtocol;
|
26
|
|
27
|
/** The object uri . */
|
28
|
private String URI;
|
29
|
|
30
|
/** The username auth. */
|
31
|
private String usernameAuth;
|
32
|
|
33
|
/** The password auth. */
|
34
|
private String passwordAuth;
|
35
|
|
36
|
/** The downloaded url. */
|
37
|
private String downloadedURL;
|
38
|
|
39
|
/** The md5 sum of the file. */
|
40
|
private String md5Sum;
|
41
|
|
42
|
/** The file size. */
|
43
|
private long fileSizeKB;
|
44
|
|
45
|
/**
|
46
|
* Gets the downloaded url.
|
47
|
*
|
48
|
* @return the downloaded url
|
49
|
*/
|
50
|
public String getDownloadedURL() {
|
51
|
return downloadedURL;
|
52
|
}
|
53
|
|
54
|
/**
|
55
|
* Sets the downloaded url.
|
56
|
*
|
57
|
* @param downloadedURL
|
58
|
* the new downloaded url
|
59
|
*/
|
60
|
public void setDownloadedURL(final String downloadedURL) {
|
61
|
this.downloadedURL = downloadedURL.replace("\\u003d", "=").replace("\\u0026", "&");;
|
62
|
}
|
63
|
|
64
|
/**
|
65
|
* Instantiates a new object store file.
|
66
|
*/
|
67
|
public ObjectStoreFile() {
|
68
|
this.accessProtocol = Protocols.None;
|
69
|
|
70
|
}
|
71
|
|
72
|
/**
|
73
|
* Return a new instance of the object from a json String.
|
74
|
*
|
75
|
* @param jsonObject
|
76
|
* the json object
|
77
|
* @return the object store file
|
78
|
*/
|
79
|
public static ObjectStoreFile createObject(final String jsonObject) {
|
80
|
Gson g = new Gson();
|
81
|
return g.fromJson(jsonObject, ObjectStoreFile.class);
|
82
|
}
|
83
|
|
84
|
/**
|
85
|
* Gets the object id.
|
86
|
*
|
87
|
* @return the object id
|
88
|
*/
|
89
|
public String getObjectID() {
|
90
|
return objectID;
|
91
|
}
|
92
|
|
93
|
/**
|
94
|
* Sets the object id.
|
95
|
*
|
96
|
* @param objectID
|
97
|
* the new object id
|
98
|
*/
|
99
|
public void setObjectID(final String objectID) {
|
100
|
this.objectID = objectID;
|
101
|
}
|
102
|
|
103
|
/**
|
104
|
* Gets the mime type.
|
105
|
*
|
106
|
* @return the mime type
|
107
|
*/
|
108
|
public String getMimeType() {
|
109
|
return mimeType;
|
110
|
}
|
111
|
|
112
|
/**
|
113
|
* Sets the mime type.
|
114
|
*
|
115
|
* @param mimeType
|
116
|
* the new mime type
|
117
|
*/
|
118
|
public void setMimeType(final String mimeType) {
|
119
|
this.mimeType = mimeType;
|
120
|
}
|
121
|
|
122
|
/**
|
123
|
* Gets the access protocol.
|
124
|
*
|
125
|
* @return the access protocol
|
126
|
*/
|
127
|
public Protocols getAccessProtocol() {
|
128
|
return accessProtocol;
|
129
|
}
|
130
|
|
131
|
/**
|
132
|
* Sets the access protocol.
|
133
|
*
|
134
|
* @param accessProtocol
|
135
|
* the new access protocol
|
136
|
*/
|
137
|
public void setAccessProtocol(final Protocols accessProtocol) {
|
138
|
this.accessProtocol = accessProtocol;
|
139
|
}
|
140
|
|
141
|
/**
|
142
|
* Gets the username auth.
|
143
|
*
|
144
|
* @return the username auth
|
145
|
*/
|
146
|
public String getUsernameAuth() {
|
147
|
return usernameAuth;
|
148
|
}
|
149
|
|
150
|
/**
|
151
|
* Sets the username auth.
|
152
|
*
|
153
|
* @param usernameAuth
|
154
|
* the new username auth
|
155
|
*/
|
156
|
public void setUsernameAuth(final String usernameAuth) {
|
157
|
this.usernameAuth = usernameAuth;
|
158
|
}
|
159
|
|
160
|
/**
|
161
|
* Gets the password auth.
|
162
|
*
|
163
|
* @return the password auth
|
164
|
*/
|
165
|
public String getPasswordAuth() {
|
166
|
return passwordAuth;
|
167
|
}
|
168
|
|
169
|
/**
|
170
|
* Sets the password auth.
|
171
|
*
|
172
|
* @param passwordAuth
|
173
|
* the new password auth
|
174
|
*/
|
175
|
public void setPasswordAuth(final String passwordAuth) {
|
176
|
this.passwordAuth = passwordAuth;
|
177
|
}
|
178
|
|
179
|
/**
|
180
|
* Gets the uri.
|
181
|
*
|
182
|
* @return the uri
|
183
|
*/
|
184
|
public String getURI() {
|
185
|
return URI != null ? URI.replace("\\u003d", "=").replace("\\u0026", "&") : "";
|
186
|
}
|
187
|
|
188
|
/**
|
189
|
* Sets the uri.
|
190
|
*
|
191
|
* @param uri
|
192
|
* the new uri
|
193
|
*/
|
194
|
public void setURI(final String uri) {
|
195
|
if (uri != null) {
|
196
|
URI = uri.replace("\\u003d", "=").replace("\\u0026", "&");
|
197
|
}
|
198
|
}
|
199
|
|
200
|
/**
|
201
|
* Convert the object into a json String.
|
202
|
*
|
203
|
* @return the string
|
204
|
*/
|
205
|
public String toJSON() {
|
206
|
Gson g = new Gson();
|
207
|
return g.toJson(this).replace("\\u003d", "=").replace("\\u0026", "&");
|
208
|
}
|
209
|
|
210
|
/**
|
211
|
* Gets the related metadata id.
|
212
|
*
|
213
|
* @return the related metadata id.
|
214
|
*/
|
215
|
public String getMetadataRelatedID() {
|
216
|
return metadataRelatedID;
|
217
|
}
|
218
|
|
219
|
/**
|
220
|
* Sets the related metadata id.
|
221
|
*
|
222
|
* @param metadataRelatedID
|
223
|
* the related metadata id.
|
224
|
*/
|
225
|
public void setMetadataRelatedID(final String metadataRelatedID) {
|
226
|
this.metadataRelatedID = metadataRelatedID;
|
227
|
}
|
228
|
|
229
|
/**
|
230
|
* @return the md5Sum
|
231
|
*/
|
232
|
public String getMd5Sum() {
|
233
|
return md5Sum;
|
234
|
}
|
235
|
|
236
|
/**
|
237
|
* @param md5Sum
|
238
|
* the md5Sum to set
|
239
|
*/
|
240
|
public void setMd5Sum(final String md5Sum) {
|
241
|
this.md5Sum = md5Sum;
|
242
|
}
|
243
|
|
244
|
/**
|
245
|
* @return the fileSizeKB
|
246
|
*/
|
247
|
public long getFileSizeKB() {
|
248
|
return fileSizeKB;
|
249
|
}
|
250
|
|
251
|
/**
|
252
|
* @param fileSizeKB the fileSizeKB to set
|
253
|
*/
|
254
|
public void setFileSizeKB(long fileSizeKB) {
|
255
|
this.fileSizeKB = fileSizeKB;
|
256
|
}
|
257
|
|
258
|
}
|