Project

General

Profile

« Previous | Next » 

Revision 34060

Changed query to look for stats validation repo. Updated fields according to the last report generated by the StatsManagerService registered on dev.

View differences:

modules/dnet-openaireplus-workflows/branches/dnet-openaireplus-workflows-2.2.1/src/main/java/eu/dnetlib/functionality/modular/ui/stats/StatsServiceInternalController.java
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()) {
modules/dnet-openaireplus-workflows/branches/dnet-openaireplus-workflows-2.2.1/src/main/resources/eu/dnetlib/test/profiles/openaireplus/workflows/provision/stats.validate.shadow.xml
9 9
	</HEADER>
10 10
	<BODY>
11 11
		<WORKFLOW_NAME>Shadow StatsDB Validation</WORKFLOW_NAME>
12
		<WORKFLOW_TYPE>Provision</WORKFLOW_TYPE>
12
		<WORKFLOW_TYPE>Data Provision</WORKFLOW_TYPE>
13 13
		<WORKFLOW_PRIORITY>30</WORKFLOW_PRIORITY>
14 14
		<CONFIGURATION start="manual">
15 15
			 <NODE name="findStatsService" type="FindStatsService" isStart="true">
modules/dnet-openaireplus-workflows/branches/dnet-openaireplus-workflows-2.2.1/src/main/resources/eu/dnetlib/functionality/modular/ui/applicationContext-modular-ui-stats.properties
1
dnet.openaire.stats.validation.wfname 	=	Shadow StatsDB Validation
2
dnet.openaire.stats.validation.logparam	=	blackboard:param:report
1
dnet.openaire.stats.validation.wftype 	=	Data Provision
2
dnet.openaire.stats.validation.logparam	=	blackboard:param:report
3
dnet.openaire.stats.validation.fields = ["Results", "Projects", "Publications", "Open Access Publications", "Closed Access Publications", "FP7 Publications", "FP7 Closed Access Publications", "FP7 Open Access Publications", "FP7 Restricted Access Publications", "FP7 Embargo Access Publications", "FP7 Projects with Publications", "FP7 Projects", "FP7 Projects with SC39", "FP7 Projects with SC39 that have publications", "OA publications in FP7 Projects with SC39", "WT Projects", "WT Projects with Publications", "Publications in WT Projects", "Open Access Publications in WT Projects", "Restricted Access Publications in WT Projects", "Embargo Publications in WT Projects", "Projects with ERC funding", "ERC Projects with Publications", "Open Access Publications in ERC Projects", "Restricted Publications in ERC Projects", "Embargo Publications in ERC Projects", "Total Publications in ERC Projects", "Total Datasources", "Valid Datasources", "Datasources with Publications", "Journal Datasources", "Publication Repository Datasources", "Data Repository Datasources", "Aggregator Datasources", "Total number of datasets", "Funders", "Organizations with Publications", "Total number of datasets"]

Also available in: Unified diff