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;
ScopeBean scopeBean = new ScopeBean(context);
String[] splitContext = context.split("/");
if (splitContext.length > 3) {
String lowerCasedContext = splitContext[3].toLowerCase();
for (VREAccessesReportRow row : vreAccesses) {
String pagePath = row.getPagePath();
String[] splits = pagePath.split("/");
if (splits.length > 2 && splits[2].startsWith(lowerCasedContext))
String lowerCasedContext = scopeBean.name().toLowerCase();
String case1=lowerCasedContext+"/";
String case2=lowerCasedContext+"?";
for (VREAccessesReportRow row : vreAccesses) {
String pagePath = row.getPagePath();
if (!pagePath.contains("_redirect=/group")) {
if (pagePath.endsWith(lowerCasedContext)) {
System.out.println("match end->"+pagePath);
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;
} catch(Exception e) {
throw e;