Revision 61441
Added by Antonis Lempesis over 2 years ago
Converter.java | ||
---|---|---|
12 | 12 |
import org.json.JSONArray; |
13 | 13 |
import org.json.JSONException; |
14 | 14 |
import org.json.JSONObject; |
15 |
import org.springframework.stereotype.Component; |
|
15 | 16 |
|
16 | 17 |
import java.io.BufferedReader; |
17 | 18 |
import java.io.IOException; |
... | ... | |
21 | 22 |
import java.text.SimpleDateFormat; |
22 | 23 |
import java.util.*; |
23 | 24 |
|
25 |
@Component |
|
24 | 26 |
public class Converter { |
25 | 27 |
|
26 | 28 |
private static final Logger LOGGER = Logger.getLogger(Converter.class); |
... | ... | |
28 | 30 |
public static Repository jsonToRepositoryObject(JSONObject repositoryObject) throws JSONException { |
29 | 31 |
|
30 | 32 |
Repository repository = new Repository(); |
31 |
|
|
33 |
|
|
32 | 34 |
JSONObject datasource = repositoryObject.getJSONObject("datasource"); |
33 | 35 |
|
34 | 36 |
//if( datasource.equals(null)) |
... | ... | |
37 | 39 |
repository.setId(datasource.get("id").toString()); |
38 | 40 |
repository.setOfficialName(datasource.get("officialname").toString()); |
39 | 41 |
|
40 |
repository.setEnglishName( datasource.get("englishname").toString());
|
|
41 |
if(repository.getEnglishName().equals("null")) |
|
42 |
repository.setEnglishName(datasource.get("englishname").toString()); |
|
43 |
if (repository.getEnglishName().equals("null"))
|
|
42 | 44 |
repository.setEnglishName(""); |
43 | 45 |
|
44 | 46 |
repository.setWebsiteUrl(datasource.get("websiteurl").toString()); |
45 |
if(repository.getWebsiteUrl().equals("null")) |
|
47 |
if (repository.getWebsiteUrl().equals("null"))
|
|
46 | 48 |
repository.setWebsiteUrl(""); |
47 | 49 |
|
48 | 50 |
repository.setLogoUrl(datasource.get("logourl").toString()); |
49 |
if(repository.getLogoUrl().equals("null")) |
|
51 |
if (repository.getLogoUrl().equals("null"))
|
|
50 | 52 |
repository.setLogoUrl(""); |
51 | 53 |
|
52 | 54 |
repository.setContactEmail(datasource.get("contactemail").toString()); |
53 |
if(repository.getContactEmail().equals("null")) |
|
55 |
if (repository.getContactEmail().equals("null"))
|
|
54 | 56 |
repository.setContactEmail(""); |
55 | 57 |
|
56 | 58 |
|
57 |
repository.setLatitude( toDouble(datasource.get("latitude").toString()));
|
|
59 |
repository.setLatitude(toDouble(datasource.get("latitude").toString())); |
|
58 | 60 |
repository.setLongitude(toDouble(datasource.get("longitude").toString())); |
59 | 61 |
Double timezone = toDouble(datasource.get("timezone").toString()); |
60 |
repository.setTimezone(timezone!=null?timezone:0.0);
|
|
62 |
repository.setTimezone(timezone != null ? timezone : 0.0);
|
|
61 | 63 |
repository.setNamespacePrefix(datasource.get("namespaceprefix").toString()); |
62 | 64 |
repository.setOdLanguages(datasource.get("languages").toString()); |
63 |
repository.setDateOfValidation(convertStringToDate( datasource.get("dateofvalidation").toString()));
|
|
65 |
repository.setDateOfValidation(convertStringToDate(datasource.get("dateofvalidation").toString())); |
|
64 | 66 |
|
65 | 67 |
/* typology -> platform |
66 | 68 |
* datasource class -> typology */ |
67 | 69 |
repository.setTypology(datasource.get("platform").toString()); |
68 |
if(repository.getTypology().equals("null")) |
|
70 |
if (repository.getTypology().equals("null"))
|
|
69 | 71 |
repository.setTypology(""); |
70 | 72 |
repository.setDatasourceClass(datasource.get("typology").toString()); |
71 | 73 |
|
72 |
repository.setDateOfCollection(convertStringToDate( datasource.get("dateofcollection").toString()));
|
|
74 |
repository.setDateOfCollection(convertStringToDate(datasource.get("dateofcollection").toString())); |
|
73 | 75 |
repository.setActivationId(datasource.get("activationId").toString()); |
74 | 76 |
|
75 | 77 |
repository.setDescription(datasource.get("description").toString()); |
76 |
if(repository.getDescription().equals("null")) |
|
78 |
if (repository.getDescription().equals("null"))
|
|
77 | 79 |
repository.setDescription(""); |
78 | 80 |
|
79 | 81 |
repository.setIssn(datasource.get("issn").toString()); |
80 | 82 |
repository.setLissn(datasource.get("lissn").toString()); |
81 |
if(repository.getLissn().equals("null")) |
|
83 |
if (repository.getLissn().equals("null"))
|
|
82 | 84 |
repository.setLissn(""); |
83 | 85 |
repository.setEissn(datasource.get("eissn").toString()); |
84 |
if(repository.getEissn().equals("null")) |
|
86 |
if (repository.getEissn().equals("null"))
|
|
85 | 87 |
repository.setEissn(""); |
86 | 88 |
repository.setRegisteredBy(datasource.get("registeredby").toString()); |
87 | 89 |
|
... | ... | |
94 | 96 |
repository.setCollectedFrom(datasource.get("collectedfrom").toString()); |
95 | 97 |
|
96 | 98 |
//TODO change organization to list |
97 |
JSONArray organizations = ((JSONArray)datasource.get("organizations")); |
|
98 |
if(organizations.length() != 0) { |
|
99 |
JSONArray organizations = ((JSONArray) datasource.get("organizations"));
|
|
100 |
if (organizations.length() != 0) {
|
|
99 | 101 |
repository.setOrganization(((JSONArray) datasource.get("organizations")).getJSONObject(0).get("legalname").toString()); |
100 | 102 |
String countryCode = ((JSONArray) datasource.get("organizations")).getJSONObject(0).get("country").toString(); |
101 | 103 |
repository.setCountryCode(countryCode); |
... | ... | |
106 | 108 |
return repository; |
107 | 109 |
} |
108 | 110 |
|
109 |
public static Date convertStringToDate(String date){ |
|
111 |
public static Date convertStringToDate(String date) {
|
|
110 | 112 |
|
111 |
if(Objects.equals(date, "null")) |
|
113 |
if (Objects.equals(date, "null"))
|
|
112 | 114 |
return null; |
113 | 115 |
|
114 | 116 |
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); |
115 | 117 |
try { |
116 | 118 |
return formatter.parse(date); |
117 | 119 |
} catch (ParseException e) { |
118 |
LOGGER.error(e); |
|
120 |
LOGGER.error(e);
|
|
119 | 121 |
} |
120 | 122 |
return null; |
121 | 123 |
} |
122 | 124 |
|
123 |
public static String convertDateToString(Date date){ |
|
125 |
public static String convertDateToString(Date date) {
|
|
124 | 126 |
|
125 |
if(Objects.equals(date, null)) |
|
127 |
if (Objects.equals(date, null))
|
|
126 | 128 |
return null; |
127 | 129 |
|
128 | 130 |
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); |
129 | 131 |
return formatter.format(date); |
130 | 132 |
} |
131 | 133 |
|
132 |
public static Double toDouble(String number){ |
|
133 |
if(Objects.equals(number, "null")) |
|
134 |
public static Double toDouble(String number) {
|
|
135 |
if (Objects.equals(number, "null"))
|
|
134 | 136 |
return 0.0; |
135 | 137 |
else |
136 | 138 |
return Double.valueOf(number); |
... | ... | |
140 | 142 |
|
141 | 143 |
List<RepositorySnippet> resultSet = new ArrayList<>(); |
142 | 144 |
JSONArray rs = json.getJSONArray("datasourceInfo"); |
143 |
for(int i=0;i<rs.length();i++)
|
|
144 |
resultSet.add(jsonToRepositorySnippetObject( rs.getJSONObject(i)) );
|
|
145 |
for (int i = 0; i < rs.length(); i++)
|
|
146 |
resultSet.add(jsonToRepositorySnippetObject(rs.getJSONObject(i)));
|
|
145 | 147 |
return resultSet; |
146 | 148 |
} |
147 | 149 |
|
148 |
private static RepositorySnippet jsonToRepositorySnippetObject(JSONObject repositorySnippetObject) throws JSONException {
|
|
150 |
public static RepositorySnippet jsonToRepositorySnippetObject(JSONObject repositorySnippetObject) throws JSONException {
|
|
149 | 151 |
|
150 | 152 |
|
151 | 153 |
RepositorySnippet repositorySnippet = new RepositorySnippet(); |
... | ... | |
156 | 158 |
repositorySnippet.setId(repositorySnippetObject.get("id").toString()); |
157 | 159 |
repositorySnippet.setOfficialname(repositorySnippetObject.get("officialname").toString()); |
158 | 160 |
|
159 |
repositorySnippet.setEnglishname( repositorySnippetObject.get("englishname").toString());
|
|
160 |
if(repositorySnippet.getEnglishname().equals("null")) |
|
161 |
repositorySnippet.setEnglishname(repositorySnippetObject.get("englishname").toString()); |
|
162 |
if (repositorySnippet.getEnglishname().equals("null"))
|
|
161 | 163 |
repositorySnippet.setEnglishname(""); |
162 | 164 |
|
163 | 165 |
repositorySnippet.setWebsiteurl(repositorySnippetObject.get("websiteurl").toString()); |
164 |
if(repositorySnippet.getWebsiteurl().equals("null")) |
|
166 |
if (repositorySnippet.getWebsiteurl().equals("null"))
|
|
165 | 167 |
repositorySnippet.setWebsiteurl(""); |
166 | 168 |
|
167 | 169 |
repositorySnippet.setRegisteredby(repositorySnippetObject.get("registeredby").toString()); |
168 |
if(repositorySnippet.getRegisteredby().equals("null")) |
|
170 |
if (repositorySnippet.getRegisteredby().equals("null"))
|
|
169 | 171 |
repositorySnippet.setRegisteredby(""); |
170 | 172 |
return repositorySnippet; |
171 | 173 |
|
... | ... | |
175 | 177 |
|
176 | 178 |
List<Repository> resultSet = new ArrayList<>(); |
177 | 179 |
JSONArray rs = json.getJSONArray("datasourceInfo"); |
178 |
for(int i=0;i<rs.length();i++)
|
|
179 |
resultSet.add(jsonToRepositoryObject( rs.getJSONObject(i)) );
|
|
180 |
for (int i = 0; i < rs.length(); i++)
|
|
181 |
resultSet.add(jsonToRepositoryObject(rs.getJSONObject(i)));
|
|
180 | 182 |
return resultSet; |
181 | 183 |
} |
182 | 184 |
|
... | ... | |
184 | 186 |
|
185 | 187 |
List<RepositoryInterface> resultSet = new ArrayList<>(); |
186 | 188 |
JSONArray rs = json.getJSONArray("api"); |
187 |
for(int i=0;i<rs.length();i++)
|
|
188 |
resultSet.add(jsonToRepositoryInterfaceObject( rs.getJSONObject(i)) );
|
|
189 |
for (int i = 0; i < rs.length(); i++)
|
|
190 |
resultSet.add(jsonToRepositoryInterfaceObject(rs.getJSONObject(i)));
|
|
189 | 191 |
return resultSet; |
190 | 192 |
} |
191 | 193 |
|
... | ... | |
204 | 206 |
repositoryInterface.setRemovable(Boolean.parseBoolean(repositoryInterfaceObject.get("removable").toString())); |
205 | 207 |
|
206 | 208 |
|
207 |
// repositoryInterface.setMetadataIdentifierPath(repositoryInterfaceObject.get("metadataIdentifierPath").toString()); |
|
209 |
// repositoryInterface.setMetadataIdentifierPath(repositoryInterfaceObject.get("metadataIdentifierPath").toString());
|
|
208 | 210 |
repositoryInterface.setDesiredCompatibilityLevel(repositoryInterfaceObject.get("compatibility").toString()); |
209 | 211 |
//repositoryInterface.setActive(Boolean.parseBoolean(repositoryInterfaceObject.get("active").toString())); |
210 | 212 |
|
... | ... | |
215 | 217 |
ObjectMapper mapper = new ObjectMapper(); |
216 | 218 |
JSONArray apiparams = repositoryInterfaceObject.getJSONArray("apiParams"); |
217 | 219 |
|
218 |
for(int i=0;i<apiparams.length();i++)
|
|
219 |
accessParams.put(apiparams.getJSONObject(i).getString("param"),apiparams.getJSONObject(i).getString("value")); |
|
220 |
for (int i = 0; i < apiparams.length(); i++)
|
|
221 |
accessParams.put(apiparams.getJSONObject(i).getString("param"), apiparams.getJSONObject(i).getString("value"));
|
|
220 | 222 |
|
221 | 223 |
repositoryInterface.setAccessParams(accessParams); |
222 | 224 |
|
... | ... | |
225 | 227 |
|
226 | 228 |
public static String repositoryObjectToJson(Repository repository) throws JSONException, JsonProcessingException { |
227 | 229 |
|
228 |
HashMap<String,Object> repositoryMap = new HashMap<>(); |
|
230 |
HashMap<String, Object> repositoryMap = new HashMap<>();
|
|
229 | 231 |
ObjectMapper mapper = new ObjectMapper(); |
230 | 232 |
|
231 |
repositoryMap.put("id",repository.getId()); |
|
232 |
repositoryMap.put("openaireId",getOpenaireId(repository.getId())); |
|
233 |
repositoryMap.put("officialname",repository.getOfficialName()); |
|
234 |
repositoryMap.put("englishname",repository.getEnglishName()); |
|
235 |
repositoryMap.put("websiteurl",repository.getWebsiteUrl()); |
|
236 |
repositoryMap.put("logourl",repository.getLogoUrl()); |
|
237 |
repositoryMap.put("contactemail",repository.getContactEmail()); |
|
238 |
repositoryMap.put("longitude",repository.getLongitude().toString()); |
|
239 |
repositoryMap.put("latitude",repository.getLatitude().toString()); |
|
240 |
repositoryMap.put("timezone",repository.getTimezone()); |
|
233 |
repositoryMap.put("id", repository.getId());
|
|
234 |
repositoryMap.put("openaireId", getOpenaireId(repository.getId()));
|
|
235 |
repositoryMap.put("officialname", repository.getOfficialName());
|
|
236 |
repositoryMap.put("englishname", repository.getEnglishName());
|
|
237 |
repositoryMap.put("websiteurl", repository.getWebsiteUrl());
|
|
238 |
repositoryMap.put("logourl", repository.getLogoUrl());
|
|
239 |
repositoryMap.put("contactemail", repository.getContactEmail());
|
|
240 |
repositoryMap.put("longitude", repository.getLongitude().toString());
|
|
241 |
repositoryMap.put("latitude", repository.getLatitude().toString());
|
|
242 |
repositoryMap.put("timezone", repository.getTimezone());
|
|
241 | 243 |
|
242 |
repositoryMap.put("namespaceprefix",repository.getNamespacePrefix()!=null?repository.getNamespacePrefix():"");
|
|
243 |
repositoryMap.put("languages",repository.getOdLanguages()!=null?repository.getOdLanguages():"");
|
|
244 |
repositoryMap.put("namespaceprefix", repository.getNamespacePrefix() != null ? repository.getNamespacePrefix() : "");
|
|
245 |
repositoryMap.put("languages", repository.getOdLanguages() != null ? repository.getOdLanguages() : "");
|
|
244 | 246 |
|
245 |
repositoryMap.put("dateofcollection",repository.getDateOfCollection()!=null?convertDateToString(repository.getDateOfCollection()):"");
|
|
247 |
repositoryMap.put("dateofcollection", repository.getDateOfCollection() != null ? convertDateToString(repository.getDateOfCollection()) : "");
|
|
246 | 248 |
|
247 | 249 |
/* |
248 |
* typology -> platform |
|
249 |
* datasource class -> typology |
|
250 |
* */ |
|
251 |
repositoryMap.put("typology",repository.getDatasourceClass()); |
|
252 |
repositoryMap.put("platform",repository.getTypology()); |
|
250 |
* typology -> platform
|
|
251 |
* datasource class -> typology
|
|
252 |
* */
|
|
253 |
repositoryMap.put("typology", repository.getDatasourceClass());
|
|
254 |
repositoryMap.put("platform", repository.getTypology());
|
|
253 | 255 |
|
254 |
repositoryMap.put("dateofvalidation",repository.getDateOfCollection()!=null?convertDateToString(repository.getDateOfCollection()):"");
|
|
255 |
repositoryMap.put("activationId",repository.getActivationId()!=null?repository.getActivationId():"");
|
|
256 |
repositoryMap.put("dateofvalidation", repository.getDateOfCollection() != null ? convertDateToString(repository.getDateOfCollection()) : "");
|
|
257 |
repositoryMap.put("activationId", repository.getActivationId() != null ? repository.getActivationId() : "");
|
|
256 | 258 |
|
257 |
repositoryMap.put("description",repository.getDescription()); |
|
259 |
repositoryMap.put("description", repository.getDescription());
|
|
258 | 260 |
|
259 |
repositoryMap.put("eissn",repository.getEissn()!=null?repository.getEissn():"");
|
|
260 |
repositoryMap.put("issn",repository.getIssn()!=null?repository.getIssn():"");
|
|
261 |
repositoryMap.put("lissn",repository.getLissn()!=null?repository.getLissn():"");
|
|
261 |
repositoryMap.put("eissn", repository.getEissn() != null ? repository.getEissn() : "");
|
|
262 |
repositoryMap.put("issn", repository.getIssn() != null ? repository.getIssn() : "");
|
|
263 |
repositoryMap.put("lissn", repository.getLissn() != null ? repository.getLissn() : "");
|
|
262 | 264 |
|
263 |
repositoryMap.put("registeredby",repository.getRegisteredBy()); |
|
265 |
repositoryMap.put("registeredby", repository.getRegisteredBy());
|
|
264 | 266 |
|
265 |
repositoryMap.put("aggregator",repository.getAggregator()!=null?repository.getAggregator():"");
|
|
266 |
repositoryMap.put("collectedfrom",repository.getCollectedFrom()!=null?repository.getCollectedFrom():"");
|
|
267 |
repositoryMap.put("aggregator", repository.getAggregator() != null ? repository.getAggregator() : "");
|
|
268 |
repositoryMap.put("collectedfrom", repository.getCollectedFrom() != null ? repository.getCollectedFrom() : "");
|
|
267 | 269 |
|
268 |
repositoryMap.put("managed",repository.isRegistered()); |
|
270 |
repositoryMap.put("managed", repository.isRegistered());
|
|
269 | 271 |
|
270 |
Map<String,String> organization = new HashMap<>(); |
|
271 |
organization.put("legalname",repository.getOrganization()); |
|
272 |
organization.put("country",repository.getCountryCode()); |
|
273 |
organization.put("legalshortname",""); |
|
274 |
organization.put("websiteurl",""); |
|
275 |
organization.put("logourl",""); |
|
272 |
Map<String, String> organization = new HashMap<>();
|
|
273 |
organization.put("legalname", repository.getOrganization());
|
|
274 |
organization.put("country", repository.getCountryCode());
|
|
275 |
organization.put("legalshortname", "");
|
|
276 |
organization.put("websiteurl", "");
|
|
277 |
organization.put("logourl", "");
|
|
276 | 278 |
|
277 | 279 |
List organizations = new ArrayList(); |
278 | 280 |
organizations.add(organization); |
279 |
repositoryMap.put("organizations",organizations); |
|
281 |
repositoryMap.put("organizations", organizations);
|
|
280 | 282 |
|
281 | 283 |
//TODO check identitites |
282 | 284 |
//Map<String,String> identity = new HashMap<>(); |
... | ... | |
293 | 295 |
repositoryMap.put("identities", identities); |
294 | 296 |
} |
295 | 297 |
|
296 |
repositoryMap.put("subjects",""); |
|
298 |
repositoryMap.put("subjects", "");
|
|
297 | 299 |
|
298 | 300 |
return mapper.writeValueAsString(repositoryMap); |
299 | 301 |
} |
300 | 302 |
|
301 |
public static String repositoryInterfaceObjectToJson(Repository repository,RepositoryInterface repositoryInterface) throws JSONException { |
|
303 |
public static String repositoryInterfaceObjectToJson(Repository repository, RepositoryInterface repositoryInterface) throws JSONException {
|
|
302 | 304 |
|
303 | 305 |
JSONObject jsonObject = new JSONObject(); |
304 | 306 |
|
305 |
jsonObject.put("id",repositoryInterface.getId()); |
|
306 |
jsonObject.put("protocol",repositoryInterface.getAccessProtocol()); |
|
307 |
jsonObject.put("datasource",repository.getId()); |
|
308 |
jsonObject.put("contentdescription",repositoryInterface.getContentDescription()); |
|
309 |
jsonObject.put("typology",repositoryInterface.getTypology()); |
|
310 |
jsonObject.put("compatibility",repositoryInterface.getDesiredCompatibilityLevel()); |
|
311 |
jsonObject.put("compatibilityOverride",repositoryInterface.getDesiredCompatibilityLevel()); |
|
307 |
jsonObject.put("id", repositoryInterface.getId());
|
|
308 |
jsonObject.put("protocol", repositoryInterface.getAccessProtocol());
|
|
309 |
jsonObject.put("datasource", repository.getId());
|
|
310 |
jsonObject.put("contentdescription", repositoryInterface.getContentDescription());
|
|
311 |
jsonObject.put("typology", repositoryInterface.getTypology());
|
|
312 |
jsonObject.put("compatibility", repositoryInterface.getDesiredCompatibilityLevel());
|
|
313 |
jsonObject.put("compatibilityOverride", repositoryInterface.getDesiredCompatibilityLevel());
|
|
312 | 314 |
|
313 |
jsonObject.put("lastCollectionTotal",""); |
|
315 |
jsonObject.put("lastCollectionTotal", "");
|
|
314 | 316 |
|
315 |
jsonObject.put("lastCollectionDate",repositoryInterface.getLastCollectionDate()); |
|
316 |
jsonObject.put("lastAggregationTotal",""); |
|
317 |
jsonObject.put("lastAggregationDate",""); |
|
318 |
jsonObject.put("lastDownloadTotal",""); |
|
319 |
jsonObject.put("lastDownloadDate",""); |
|
317 |
jsonObject.put("lastCollectionDate", repositoryInterface.getLastCollectionDate());
|
|
318 |
jsonObject.put("lastAggregationTotal", "");
|
|
319 |
jsonObject.put("lastAggregationDate", "");
|
|
320 |
jsonObject.put("lastDownloadTotal", "");
|
|
321 |
jsonObject.put("lastDownloadDate", "");
|
|
320 | 322 |
|
321 |
jsonObject.put("baseurl",repositoryInterface.getBaseUrl()); |
|
322 |
jsonObject.put("removable",repositoryInterface.isRemovable()); |
|
323 |
jsonObject.put("baseurl", repositoryInterface.getBaseUrl());
|
|
324 |
jsonObject.put("removable", repositoryInterface.isRemovable());
|
|
323 | 325 |
|
324 |
|
|
326 |
|
|
325 | 327 |
JSONArray apiparams = new JSONArray(); |
326 |
for(String param: repositoryInterface.getAccessParams().keySet()){
|
|
328 |
for (String param : repositoryInterface.getAccessParams().keySet()) {
|
|
327 | 329 |
JSONObject jo = new JSONObject(); |
328 |
jo.put("param",param); |
|
329 |
jo.put("value",repositoryInterface.getAccessParams().get(param)); |
|
330 |
jo.put("param", param);
|
|
331 |
jo.put("value", repositoryInterface.getAccessParams().get(param));
|
|
330 | 332 |
apiparams.put(jo); |
331 | 333 |
} |
332 |
jsonObject.put("apiParams",apiparams); |
|
334 |
jsonObject.put("apiParams", apiparams);
|
|
333 | 335 |
|
334 | 336 |
|
335 | 337 |
// jsonObject.put("metadataIdentifierPath",repositoryInterface.getMetadataIdentifierPath()); |
... | ... | |
345 | 347 |
//InputStream in = Converter.class.getResourceAsStream("resources/eu/dnetlib/repo/manager/service/utils/"+filename); |
346 | 348 |
InputStream in = Converter.class.getClass().getResourceAsStream("/eu/**/" + filename); |
347 | 349 |
BufferedReader br = new BufferedReader(new InputStreamReader(in)); |
348 |
while((line = br.readLine()) != null) { |
|
350 |
while ((line = br.readLine()) != null) {
|
|
349 | 351 |
list.add(line.trim()); |
350 | 352 |
} |
351 | 353 |
br.close(); |
... | ... | |
375 | 377 |
AggregationDetails aggregationDetails = new AggregationDetails(); |
376 | 378 |
|
377 | 379 |
aggregationDetails.setAggregationStage(aggregationObject.get("aggregationStage").toString()); |
378 |
if(aggregationObject.has("collectionMode")) |
|
380 |
if (aggregationObject.has("collectionMode"))
|
|
379 | 381 |
aggregationDetails.setCollectionMode(aggregationObject.get("collectionMode").toString()); |
380 |
if(aggregationObject.has("indexedVersion")) |
|
382 |
if (aggregationObject.has("indexedVersion"))
|
|
381 | 383 |
aggregationDetails.setIndexedVersion(Boolean.parseBoolean(aggregationObject.get("indexedVersion").toString())); |
382 | 384 |
aggregationDetails.setDate(convertStringToDate(aggregationObject.get("date").toString())); |
383 | 385 |
aggregationDetails.setNumberOfRecords(Integer.parseInt(aggregationObject.get("numberOfRecords").toString())); |
... | ... | |
388 | 390 |
public static List<Timezone> toTimezones(List<String> timezones) { |
389 | 391 |
|
390 | 392 |
List<Timezone> tmz = new ArrayList<>(); |
391 |
for(String t : timezones){
|
|
393 |
for (String t : timezones) {
|
|
392 | 394 |
String[] s = t.split("\t"); |
393 |
tmz.add(new Timezone(s[1],Double.parseDouble(s[0]))); |
|
395 |
tmz.add(new Timezone(s[1], Double.parseDouble(s[0])));
|
|
394 | 396 |
} |
395 | 397 |
return tmz; |
396 | 398 |
} |
Also available in: Unified diff
merged branch aai_roles_new to trunk