Revision 55646
Added by Antonis Lempesis almost 5 years ago
IrusStats.java | ||
---|---|---|
69 | 69 |
String sqlCreateTableSushiLog = "CREATE TABLE IF NOT EXISTS sushilog(source TEXT, repository TEXT, rid TEXT, date TEXT, metric_type TEXT, count INT, PRIMARY KEY(source, repository, rid, date, metric_type));"; |
70 | 70 |
stmt.executeUpdate(sqlCreateTableSushiLog); |
71 | 71 |
|
72 |
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS public.sushilog AS TABLE sushilog;"); |
|
73 |
|
|
72 | 74 |
String sqlCopyPublicSushiLog="INSERT INTO sushilog SELECT * FROM public.sushilog;"; |
73 | 75 |
stmt.executeUpdate(sqlCopyPublicSushiLog); |
74 | 76 |
|
... | ... | |
110 | 112 |
|
111 | 113 |
public void processIrusRRReport() throws Exception { |
112 | 114 |
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY-MM"); |
113 |
String reportUrl = "http://www.irus.mimas.ac.uk/api/sushilite/v1_7/GetReport/?Report=RR1&Release=4&RequestorID=OpenAIRE&BeginDate=2016-01&EndDate=" + simpleDateFormat.format(new Date()) + "&RepositoryIdentifier=&ItemDataType=&NewJiscBand=&Granularity=Monthly&Callback="; |
|
115 |
String reportUrl = "https://irus.jisc.ac.uk" + "/api/sushilite/v1_7/GetReport/?Report=RR1&Release=4&RequestorID=OpenAIRE&BeginDate=2016-01&EndDate=" + simpleDateFormat.format(new Date()) + "&RepositoryIdentifier=&ItemDataType=&NewJiscBand=&Granularity=Monthly&Callback="; |
|
116 |
|
|
117 |
log.info("Getting Irus report: " + reportUrl); |
|
118 |
|
|
114 | 119 |
String text = getJson(reportUrl, "", ""); |
115 | 120 |
|
121 |
log.info("Report: " + text); |
|
122 |
|
|
116 | 123 |
JSONParser parser = new JSONParser(); |
117 | 124 |
JSONObject jsonObject = (JSONObject) parser.parse(text); |
118 | 125 |
jsonObject = (JSONObject) jsonObject.get("ReportResponse"); |
... | ... | |
170 | 177 |
|
171 | 178 |
while(start.before(end)){ |
172 | 179 |
//log.info("date: " + simpleDateFormat.format(start.getTime())); |
173 |
String reportUrl = "http://irus.mimas.ac.uk/api/sushilite/v1_7/GetReport/?Report=IR1&Release=4&RequestorID=OpenAIRE&BeginDate=" + simpleDateFormat.format(start.getTime()) + "&EndDate=" + simpleDateFormat.format(start.getTime()) + "&RepositoryIdentifier=opendoar%3A" + opendoar + "&ItemIdentifier=&ItemDataType=&hasDOI=&Granularity=Monthly&Callback=";
|
|
180 |
String reportUrl = "https://irus.jisc.ac.uk/api/sushilite/v1_7/GetReport/?Report=IR1&Release=4&RequestorID=OpenAIRE&BeginDate=" + simpleDateFormat.format(start.getTime()) + "&EndDate=" + simpleDateFormat.format(start.getTime()) + "&RepositoryIdentifier=opendoar%3A" + opendoar + "&ItemIdentifier=&ItemDataType=&hasDOI=&Granularity=Monthly&Callback=";
|
|
174 | 181 |
start.add(Calendar.MONTH, 1); |
175 | 182 |
|
176 | 183 |
String text = getJson(reportUrl, "", ""); |
... | ... | |
256 | 263 |
} |
257 | 264 |
return response.toString(); |
258 | 265 |
}catch (Exception e){ |
259 |
log.error("Failed to get URL: " + e); |
|
260 |
//System.out.println("Failed to get URL: " + e); |
|
266 |
log.error("Failed to get URL", e); |
|
261 | 267 |
return null; |
262 |
//throw new Exception("Failed to get URL: " + e.toString(), e); |
|
263 | 268 |
} |
264 | 269 |
} |
265 | 270 |
|
Also available in: Unified diff
numerous bug fixes and changes to schema