Skip to content

Commit

Permalink
Revert "Merge conflict resolving for DS-2532"
Browse files Browse the repository at this point in the history
This reverts commit 260b804.
  • Loading branch information
bram-atmire committed Apr 2, 2015
1 parent 260b804 commit 8eb8a59
Showing 1 changed file with 2 additions and 88 deletions.
90 changes: 2 additions & 88 deletions dspace-api/src/main/java/org/dspace/statistics/SolrLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,6 @@ private static SolrInputDocument getCommonSolrDoc(DSpaceObject dspaceObject, Htt
log.debug(e.getMessage(),e);
}

if(request.getHeader("User-Agent") != null)
{
doc1.addField("userAgent", request.getHeader("User-Agent"));
}
doc1.addField("isBot",isSpiderBot);

// Save the location information if valid, save the event without
// location information if not valid
if(locationService != null)
Expand All @@ -327,92 +321,12 @@ private static SolrInputDocument getCommonSolrDoc(DSpaceObject dspaceObject, Htt
doc1.addField("city", location.city);
doc1.addField("latitude", location.latitude);
doc1.addField("longitude", location.longitude);


}
}
}

if(dspaceObject != null){
doc1.addField("id", dspaceObject.getID());
doc1.addField("type", dspaceObject.getType());
storeParents(doc1, dspaceObject);
}
// Save the current time
doc1.addField("time", DateFormatUtils.format(new Date(), DATE_FORMAT_8601));
if (currentUser != null)
{
doc1.addField("epersonid", currentUser.getID());
}

return doc1;
}

private static SolrInputDocument getCommonSolrDoc(DSpaceObject dspaceObject, String ip, String userAgent, String xforwardedfor, EPerson currentUser) throws SQLException {
boolean isSpiderBot = SpiderDetector.isSpider(ip);
if(isSpiderBot &&
!ConfigurationManager.getBooleanProperty("usage-statistics", "logBots", true))
{
return null;
}

SolrInputDocument doc1 = new SolrInputDocument();
// Save our basic info that we already have


if (isUseProxies() && xforwardedfor != null) {
/* This header is a comma delimited list */
for (String xfip : xforwardedfor.split(",")) {
/* proxy itself will sometime populate this header with the same value in
remote address. ordering in spec is vague, we'll just take the last
not equal to the proxy
*/
if (!xforwardedfor.contains(ip)) {
ip = xfip.trim();
}
}

doc1.addField("ip", ip);

try
{
String dns = DnsLookup.reverseDns(ip);
doc1.addField("dns", dns.toLowerCase());
}
catch (Exception e)
{
log.error("Failed DNS Lookup for IP:" + ip);
log.debug(e.getMessage(),e);
}
if(userAgent != null)
{
doc1.addField("userAgent", userAgent);
}
doc1.addField("isBot",isSpiderBot);
// Save the location information if valid, save the event without
// location information if not valid
if(locationService != null)
{
Location location = locationService.getLocation(ip);
if (location != null
&& !("--".equals(location.countryCode)
&& location.latitude == -180 && location.longitude == -180))
{
try
{
doc1.addField("continent", LocationUtils
.getContinentCode(location.countryCode));
}
catch (Exception e)
doc1.addField("isBot",isSpiderBot);

if(request.getHeader("User-Agent") != null)
{
doc1.addField("userAgent", request.getHeader("User-Agent"));
}

doc1.addField("countryCode", location.countryCode);
doc1.addField("city", location.city);
doc1.addField("latitude", location.latitude);
doc1.addField("longitude", location.longitude);
}
}
}
Expand Down

0 comments on commit 8eb8a59

Please sign in to comment.