93 |
93 |
@Resource(name = "msroWorkflowLogger")
|
94 |
94 |
private DnetLogger dnetLogger;
|
95 |
95 |
|
96 |
|
@Value("${dnet.openaire.stats.validation.wfname}")
|
97 |
|
private String statsWfName;
|
|
96 |
@Value("${dnet.openaire.stats.validation.wftype}")
|
|
97 |
private String statsWfType;
|
98 |
98 |
|
99 |
99 |
@Value("${dnet.openaire.stats.validation.logparam}")
|
100 |
100 |
private String reportLogParam;
|
101 |
101 |
|
102 |
|
// @Value("${dnet.openaire.stats.validation.xsltpath}")
|
103 |
|
// private String statsReportXsltPath;
|
|
102 |
@Value("${dnet.openaire.stats.validation.fields}")
|
|
103 |
private String validationFields;
|
104 |
104 |
|
|
105 |
private Map<String, String> getReportQuery() {
|
|
106 |
final Map<String, String> query = Maps.newHashMap();
|
|
107 |
query.put(WorkflowsConstants.SYSTEM_WF_PROFILE_FAMILY, statsWfType);
|
|
108 |
query.put(WorkflowsConstants.SYSTEM_COMPLETED_SUCCESSFULLY, "true");
|
|
109 |
query.put("$exists", reportLogParam);
|
|
110 |
return query;
|
|
111 |
}
|
|
112 |
|
105 |
113 |
@ResponseBody
|
106 |
114 |
@RequestMapping(value = "/ui/stats/list.do")
|
107 |
115 |
public List<StatsProcessEntry> list(@RequestParam(value = "start", required = true) final String start,
|
... | ... | |
111 |
119 |
final DateTime startDate = formatter.parseDateTime(start);
|
112 |
120 |
final DateTime endDate = formatter.parseDateTime(end).plusHours(23).plusMinutes(59).plusSeconds(59);
|
113 |
121 |
|
114 |
|
final Map<String, String> query = Maps.newHashMap();
|
115 |
|
query.put(WorkflowsConstants.SYSTEM_WF_PROFILE_NAME, statsWfName);
|
116 |
|
query.put(WorkflowsConstants.SYSTEM_COMPLETED_SUCCESSFULLY, "true");
|
|
122 |
final Map<String, String> query = getReportQuery();
|
|
123 |
// final Map<String, String> query = Maps.newHashMap();
|
|
124 |
// query.put(WorkflowsConstants.SYSTEM_WF_PROFILE_FAMILY, statsWfType);
|
|
125 |
// query.put(WorkflowsConstants.SYSTEM_COMPLETED_SUCCESSFULLY, "true");
|
|
126 |
// query.put("$exists", reportLogParam);
|
117 |
127 |
|
118 |
|
final List<StatsProcessEntry> res =
|
119 |
|
Lists.newArrayList(Iterators.transform(
|
120 |
|
dnetLogger.range(startDate.toDate(), endDate.toDate(), query),
|
121 |
|
new JournalEntryFunction()));
|
|
128 |
final List<StatsProcessEntry> res = Lists.newArrayList(Iterators.transform(dnetLogger.range(startDate.toDate(), endDate.toDate(), query),
|
|
129 |
new JournalEntryFunction()));
|
122 |
130 |
|
123 |
131 |
log.info(String.format("found %d stat validation workflows", res.size()));
|
124 |
132 |
|
... | ... | |
147 |
155 |
|
148 |
156 |
@ResponseBody
|
149 |
157 |
@RequestMapping(value = "/ui/stats/listHistoryFields.do")
|
150 |
|
public List<String> listLegendFields() throws Exception {
|
151 |
|
return Lists.newArrayList(
|
152 |
|
"Results",
|
153 |
|
"Publications",
|
154 |
|
"Open Access Publications",
|
155 |
|
"FP7 Publications",
|
156 |
|
"FP7 Closed Access Publications",
|
157 |
|
"FP7 Open Access Publications",
|
158 |
|
"FP7 Restricted Access Publications",
|
159 |
|
"FP7 Embargo Access Publications",
|
160 |
|
"FP7 Projects with Publications",
|
161 |
|
"FP7 Projects",
|
162 |
|
"FP7 Projects with SC39",
|
163 |
|
"FP7 Publications with SC39",
|
164 |
|
"OpenAccess FP7 Publications with SC39",
|
165 |
|
"WT Publications",
|
166 |
|
"WT Projects",
|
167 |
|
"Open Access WT Projects",
|
168 |
|
"Restricted Access WT Projects",
|
169 |
|
"Embargo WT Projects",
|
170 |
|
"ERC Publications",
|
171 |
|
"ERC Projects",
|
172 |
|
"ERC Open Access Projects",
|
173 |
|
"ERC Restricted Access Projects",
|
174 |
|
"ERC Embargo Projects");
|
|
158 |
public String listLegendFields() throws Exception {
|
|
159 |
return validationFields;
|
175 |
160 |
}
|
176 |
161 |
|
177 |
162 |
@ResponseBody
|
... | ... | |
179 |
164 |
public List<Map<String, Object>> getHistory(@RequestParam(value = "fieldsJson", required = true) final String fieldsJson) throws Exception {
|
180 |
165 |
final List<String> fields = new Gson().fromJson(fieldsJson, new TypeToken<List<String>>() {}.getType());
|
181 |
166 |
|
182 |
|
final Map<String, String> query = Maps.newHashMap();
|
183 |
|
query.put(WorkflowsConstants.SYSTEM_WF_PROFILE_NAME, statsWfName);
|
184 |
|
query.put(WorkflowsConstants.SYSTEM_COMPLETED_SUCCESSFULLY, "true");
|
|
167 |
final Map<String, String> query = getReportQuery();
|
185 |
168 |
|
186 |
|
final List<Map<String, Object>> res =
|
187 |
|
Lists.newArrayList(Iterators.transform(dnetLogger.find(query), new JournalGraphEntryFunction(reportLogParam, fields)));
|
|
169 |
final List<Map<String, Object>> res = Lists.newArrayList(Iterators.transform(dnetLogger.find(query), new JournalGraphEntryFunction(reportLogParam,
|
|
170 |
fields)));
|
188 |
171 |
|
189 |
172 |
log.info(String.format("found %d stat validation workflows", res.size()));
|
190 |
173 |
if (log.isDebugEnabled()) {
|
Changed query to look for stats validation repo. Updated fields according to the last report generated by the StatsManagerService registered on dev.