|
|
|
@ -1,12 +1,11 @@
|
|
|
|
|
package eu.dnetlib.dnetexploremetrics.service;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.util.JSONPObject;
|
|
|
|
|
import com.google.gson.JsonObject;
|
|
|
|
|
import com.google.gson.JsonParser;
|
|
|
|
|
import eu.dnetlib.dnetexploremetrics.dao.MetricsDAO;
|
|
|
|
|
import eu.dnetlib.dnetexploremetrics.dao.MetricsFileDAO;
|
|
|
|
|
import eu.dnetlib.dnetexploremetrics.model.Metrics;
|
|
|
|
|
import eu.dnetlib.dnetexploremetrics.utils.PrometheusMetricsFormatter;
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
@ -53,9 +52,9 @@ public class MetricsService {
|
|
|
|
|
ResponseEntity<String> response
|
|
|
|
|
= restTemplate.getForEntity(searchUrl + recordsRequest, String.class);
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject(response.getBody());
|
|
|
|
|
metrics.records= jsonObject.getJSONObject("meta").get("total").toString();
|
|
|
|
|
|
|
|
|
|
JsonObject jsonObject = new JsonParser().parse(response.getBody()).getAsJsonObject();
|
|
|
|
|
metrics.records= jsonObject.get("meta").getAsJsonObject().get("total").getAsString();
|
|
|
|
|
/*
|
|
|
|
|
response = restTemplate.
|
|
|
|
|
getForEntity(searchUrl + publicationsRequest, String.class);
|
|
|
|
|
jsonObject = new JSONObject(response.getBody());
|
|
|
|
@ -96,7 +95,7 @@ public class MetricsService {
|
|
|
|
|
|
|
|
|
|
jsonObject = new JSONObject(response.getBody());
|
|
|
|
|
metrics.organizations = jsonObject.getJSONObject("meta").get("total").toString();
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
metricsDAO.save(metrics);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|