revised heuristic counting VRE accesses from page paths

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-dashboard-harvester-se-plugin@169200 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2018-06-14 13:15:08 +00:00
parent 8335d11956
commit adab0bea74
1 changed files with 18 additions and 13 deletions

View File

@ -92,21 +92,26 @@ public class VREAccessesHarvester extends BasicHarvester {
int measure = 0; int measure = 0;
ScopeBean scopeBean = new ScopeBean(context); ScopeBean scopeBean = new ScopeBean(context);
String lowerCasedContext = scopeBean.name().toLowerCase();
String[] splitContext = context.split("/"); String case1=lowerCasedContext+"/";
if (splitContext.length > 3) { String case2=lowerCasedContext+"?";
String lowerCasedContext = splitContext[3].toLowerCase(); for (VREAccessesReportRow row : vreAccesses) {
for (VREAccessesReportRow row : vreAccesses) { String pagePath = row.getPagePath();
if (!pagePath.contains("_redirect=/group")) {
String pagePath = row.getPagePath(); if (pagePath.endsWith(lowerCasedContext)) {
String[] splits = pagePath.split("/"); System.out.println("match end->"+pagePath);
if (splits.length > 2 && splits[2].startsWith(lowerCasedContext))
measure++; measure++;
}
else if (pagePath.contains(case1) || pagePath.contains(case2) ) {
System.out.println("match compare->"+pagePath);
measure++;
}
} }
HarvestedData harvest = new HarvestedData(HarvestedDataKey.ACCESSES, context, measure); }
logger.debug(harvest.toString());
data.add(harvest); HarvestedData harvest = new HarvestedData(HarvestedDataKey.ACCESSES, context, measure);
} logger.debug(harvest.toString());
data.add(harvest);
return data; return data;
} catch(Exception e) { } catch(Exception e) {
throw e; throw e;