-
+
+
+ Archival Collection ID
+
+
+
+
@@ -374,7 +373,33 @@
|
-
+
+
+
+
+
+
+
+
+
+
+ https://catalog.lib.unc.edu/catalog/UNC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
@@ -525,8 +550,10 @@
-
+
+
+
@@ -945,14 +972,9 @@
-
- Archival Collection ID
-
-
-
-
+
Identifier
-
+
@@ -989,13 +1011,12 @@
-
-
+
-
+
@@ -1006,11 +1027,7 @@
Genre
-
- Archival Collection ID
-
-
-
+
Identifier
diff --git a/web-access-app/src/main/webapp/WEB-INF/access-fedora-context.xml b/web-access-app/src/main/webapp/WEB-INF/access-fedora-context.xml
index e481b1586c..cc44218bd2 100644
--- a/web-access-app/src/main/webapp/WEB-INF/access-fedora-context.xml
+++ b/web-access-app/src/main/webapp/WEB-INF/access-fedora-context.xml
@@ -22,10 +22,7 @@
-
-
-
diff --git a/web-access-app/src/main/webapp/WEB-INF/service-context.xml b/web-access-app/src/main/webapp/WEB-INF/service-context.xml
index 922573be8f..fdb3a2e605 100644
--- a/web-access-app/src/main/webapp/WEB-INF/service-context.xml
+++ b/web-access-app/src/main/webapp/WEB-INF/service-context.xml
@@ -41,10 +41,6 @@
-
-
-
-
diff --git a/web-common/src/main/java/edu/unc/lib/boxc/web/common/utils/AnalyticsTrackerUtil.java b/web-common/src/main/java/edu/unc/lib/boxc/web/common/utils/AnalyticsTrackerUtil.java
index 9056839bc0..f4caf1fc38 100644
--- a/web-common/src/main/java/edu/unc/lib/boxc/web/common/utils/AnalyticsTrackerUtil.java
+++ b/web-common/src/main/java/edu/unc/lib/boxc/web/common/utils/AnalyticsTrackerUtil.java
@@ -1,23 +1,10 @@
package edu.unc.lib.boxc.web.common.utils;
import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.http.conn.HttpClientConnectionManager;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.message.BasicNameValuePair;
import org.matomo.java.tracking.MatomoTracker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,42 +28,13 @@ public class AnalyticsTrackerUtil {
// Made up CID to use if the request does not include one, such as from a API request
protected static final String DEFAULT_CID = "35009a79-1a05-49d7-b876-2b884d0f825b";
- // Google analytics measurement API url
- private static final String GA_URL = "https://www.google-analytics.com/collect";
public static final String MATOMO_ACTION = "Downloaded Original";
- // Google analytics tracking id
- private String gaTrackingID;
-
- private HttpClientConnectionManager httpClientConnectionManager;
- private CloseableHttpClient httpClient;
- private String repositoryHost;
private String matomoAuthToken;
private String matomoApiURL;
private int matomoSiteID;
private SolrSearchService solrSearchService;
- public void setHttpClientConnectionManager(HttpClientConnectionManager manager) {
- this.httpClientConnectionManager = manager;
-
- RequestConfig requestConfig = RequestConfig.custom()
- .setConnectTimeout(2000)
- .build();
-
- this.httpClient = HttpClients.custom()
- .setConnectionManager(httpClientConnectionManager)
- .setDefaultRequestConfig(requestConfig)
- .build();
- }
-
- public void setHttpClient(CloseableHttpClient httpClient) {
- this.httpClient = httpClient;
- }
-
- public void setGaTrackingID(String trackingID) {
- this.gaTrackingID = trackingID;
- }
-
/**
* Track an event with the specified action for object pid for the active user on the request.
*
@@ -94,7 +52,6 @@ public void trackEvent(HttpServletRequest request, String action, PID pid, Acces
"(no collection)"
: briefObject.getParentCollectionName();
String viewedObjectLabel = briefObject.getTitle() + "|" + pid;
- trackEvent(userData, parentCollection, action, viewedObjectLabel);
// track in matomo
var matomoRequest = buildMatomoRequest(getFullURL(request), userData, parentCollection, viewedObjectLabel);
sendMatomoRequest(matomoRequest);
@@ -104,16 +61,6 @@ public void trackEvent(HttpServletRequest request, String action, PID pid, Acces
}
}
- private void trackEvent(AnalyticsUserData userData, String category, String action, String label) {
- if (userData == null) {
- return;
- }
-
- // Perform the analytics tracking event asynchronously
- Thread trackerThread = new Thread(new EventTrackerRunnable(userData, category, action, label));
- trackerThread.start();
- }
-
private MatomoRequest buildMatomoRequest(String url, AnalyticsUserData userData, String parentCollection, String label) throws UnsupportedEncodingException {
return MatomoRequest.builder()
.siteId(matomoSiteID)
@@ -156,10 +103,6 @@ private String getFullURL(HttpServletRequest request) {
public void setSolrSearchService(SolrSearchService solrSearchService) {
this.solrSearchService = solrSearchService;
}
-
- public void setRepositoryHost(String repositoryHost) {
- this.repositoryHost = repositoryHost;
- }
public void setMatomoAuthToken(String matomoAuthToken) {
this.matomoAuthToken = matomoAuthToken;
}
@@ -232,77 +175,4 @@ public AnalyticsUserData(HttpServletRequest request) {
}
}
}
-
- protected class EventTrackerRunnable implements Runnable {
-
- private final AnalyticsUserData userData;
- private final String category;
- private final String action;
- private final String label;
-
- public EventTrackerRunnable(AnalyticsUserData userData, String category, String action, String label) {
- this.category = category;
- this.action = action;
- this.label = label;
- this.userData = userData;
- }
-
- @Override
- public void run() {
- log.debug("Tracking user {} with event {} in category {} with label {}",
- userData.cid, action, category, label);
-
- URIBuilder builder;
- try {
- builder = new URIBuilder(GA_URL);
- } catch (URISyntaxException e) {
- log.warn("Failed to build URI for tracker", e);
- return;
- }
-
- // See https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
- List params = new ArrayList<>();
- params.add(new BasicNameValuePair("v", "1"));
- params.add(new BasicNameValuePair("tid", gaTrackingID));
- params.add(new BasicNameValuePair("cid", userData.cid));
- params.add(new BasicNameValuePair("t", "event"));
- params.add(new BasicNameValuePair("uip", userData.uip));
- params.add(new BasicNameValuePair("ua", userData.userAgent));
- params.add(new BasicNameValuePair("dh", repositoryHost));
- params.add(new BasicNameValuePair("an", "cdr"));
- params.add(new BasicNameValuePair("de", "UTF-8"));
- params.add(new BasicNameValuePair("ul", "en-us"));
- log.debug("Tracking user {} with event {} in category {} with label {}",
- userData.cid, action, category, label);
- log.debug("Tracking:{} {} {} {}", new Object[] { GA_URL, gaTrackingID, userData.cid, userData.uip});
-
- if (category != null) {
- params.add(new BasicNameValuePair("ec", category));
- }
- if (action != null) {
- params.add(new BasicNameValuePair("ea", action));
- }
- if (label != null) {
- params.add(new BasicNameValuePair("el", label));
- }
-
- builder.addParameters(params);
-
- HttpGet method;
- try {
- URI url = builder.build();
- method = new HttpGet(url);
- method.addHeader("Accept", "*/*");
- } catch (URISyntaxException e) {
- log.warn("Failed to build tracking url", e);
- return;
- }
-
- try (CloseableHttpResponse resp = httpClient.execute(method)) {
- } catch (Exception e) {
- log.warn("Failed to issue tracking event for cid {}", e, userData.cid);
- }
- }
-
- }
}
diff --git a/web-common/src/test/java/edu/unc/lib/boxc/web/common/utils/AnalyticsTrackerUtilTest.java b/web-common/src/test/java/edu/unc/lib/boxc/web/common/utils/AnalyticsTrackerUtilTest.java
index bad83022bb..fdfbe0da63 100644
--- a/web-common/src/test/java/edu/unc/lib/boxc/web/common/utils/AnalyticsTrackerUtilTest.java
+++ b/web-common/src/test/java/edu/unc/lib/boxc/web/common/utils/AnalyticsTrackerUtilTest.java
@@ -9,13 +9,10 @@
import edu.unc.lib.boxc.search.api.models.ContentObjectRecord;
import edu.unc.lib.boxc.search.solr.services.SolrSearchService;
-import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.impl.client.CloseableHttpClient;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import com.github.tomakehurst.wiremock.junit5.WireMockTest;
@@ -25,7 +22,6 @@
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
-import java.net.URI;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
@@ -37,11 +33,8 @@
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.timeout;
-import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
@@ -51,22 +44,14 @@
public class AnalyticsTrackerUtilTest {
private final static String PID_UUID = "03114533-0017-4c83-b9d9-567b08fb2429";
@Mock
- private HttpClientConnectionManager httpClientConnectionManager;
- @Mock
- private CloseableHttpClient httpClient;
- @Mock
private SolrSearchService solrSearchService;
@Mock
private HttpServletRequest request;
@Mock
private ContentObjectRecord contentObjectRecord;
- @Captor
- private ArgumentCaptor httpRequestCaptor;
private AccessGroupSet principals;
private AnalyticsTrackerUtil analyticsTrackerUtil;
- private String repositoryHost = "boxy.example.com";
- private String trackingId = "trackme";
private String authToken = "secret123456789qwertyasdfghzxcvb";
private String apiURL = "http://localhost:46887";
private String userId = "5e462bae5cada463";
@@ -78,10 +63,7 @@ public class AnalyticsTrackerUtilTest {
public void setup() {
MockitoAnnotations.openMocks(this);
analyticsTrackerUtil = new AnalyticsTrackerUtil();
- analyticsTrackerUtil.setRepositoryHost(repositoryHost);
- analyticsTrackerUtil.setGaTrackingID(trackingId);
analyticsTrackerUtil.setSolrSearchService(solrSearchService);
- analyticsTrackerUtil.setHttpClient(httpClient);
analyticsTrackerUtil.setMatomoApiURL(apiURL);
analyticsTrackerUtil.setMatomoAuthToken(authToken);
analyticsTrackerUtil.setMatomoSiteID(siteID);
@@ -91,13 +73,10 @@ public void setup() {
@Test
public void testTrackEventInCollection() throws Exception {
when(request.getHeader("Proxy-Client-IP")).thenReturn("0.0.0.0");
- var cidCookie = mock(Cookie.class);
- when(cidCookie.getName()).thenReturn("_ga");
- when(cidCookie.getValue()).thenReturn("ga.1.123456789.1234567890");
var uidCookie = mock(Cookie.class);
when(uidCookie.getName()).thenReturn("_pk_id");
when(uidCookie.getValue()).thenReturn(userId +".1234567890");
- when(request.getCookies()).thenReturn(new Cookie[]{ cidCookie, uidCookie });
+ when(request.getCookies()).thenReturn(new Cookie[]{ uidCookie });
when(request.getHeader("User-Agent")).thenReturn("boxy-client");
when(request.getRequestURL()).thenReturn(urlBuffer);
var pid = PIDs.get(PID_UUID);
@@ -114,11 +93,6 @@ public void testTrackEventInCollection() throws Exception {
analyticsTrackerUtil.trackEvent(request, "testAction", pid, principals);
- verify(httpClient, timeout(1000).times(1)).execute(httpRequestCaptor.capture());
- var gaRequest = httpRequestCaptor.getValue();
- var gaUri = gaRequest.getURI();
- assertGaQueryIsCorrect(gaUri, true);
-
assertMatomoQueryIsCorrect(expectedParams);
}
@@ -144,12 +118,6 @@ public void testTrackEventNotInCollection() throws Exception {
analyticsTrackerUtil.trackEvent(request, "testAction", pid, principals);
- verify(httpClient, timeout(1000).times(1)).execute(httpRequestCaptor.capture());
-
- var gaRequest = httpRequestCaptor.getValue();
- var gaUri = gaRequest.getURI();
- assertGaQueryIsCorrect(gaUri, false);
-
assertMatomoQueryIsCorrect(expectedParams);
}
@@ -181,36 +149,6 @@ public void testAnalyticsUserDataRemoteAddr() throws Exception {
assertEquals("1.1.1.1", userData.uip);
}
- @Test
- public void testSetHttpClientConnectionManager() throws Exception {
- // Just verifying the setter doesn't error
- analyticsTrackerUtil.setHttpClientConnectionManager(httpClientConnectionManager);
- }
-
- private void assertGaQueryIsCorrect(URI gaUri, boolean withCollection) {
- assertEquals("www.google-analytics.com", gaUri.getHost());
- assertEquals("/collect", gaUri.getPath());
- var gaQuery = gaUri.getQuery();
- assertTrue(gaQuery.contains("&t=event"));
- assertTrue(gaQuery.contains("&ua=boxy-client"));
- assertTrue(gaQuery.contains("&dh=boxy.example.com"));
- assertTrue(gaQuery.contains("&an=cdr"));
- assertTrue(gaQuery.contains("&de=UTF-8"));
- assertTrue(gaQuery.contains("&ea=testAction"));
-
- if (withCollection) {
- assertTrue(gaQuery.contains("&cid=123456789.1234567890"));
- assertTrue(gaQuery.contains("&ec=Parent+Collection"));
- assertTrue(gaQuery.contains("&uip=0.0.0.0"));
- assertTrue(gaQuery.contains("&el=Test+Work|" + url));
- } else {
- assertTrue(gaQuery.contains("&cid=" + AnalyticsTrackerUtil.DEFAULT_CID));
- assertTrue(gaQuery.contains("&ec=(no+collection)"));
- assertTrue(gaQuery.contains("&uip=1.1.1.1"));
- assertTrue(gaQuery.contains("&el=Test+Work2|" + url));
- }
- }
-
private void assertMatomoQueryIsCorrect(Map params) {
for (int i=0 ; i<100 ; i++) {
try {
diff --git a/web-services-app/src/main/webapp/WEB-INF/service-context.xml b/web-services-app/src/main/webapp/WEB-INF/service-context.xml
index 1c4bfa967c..8a0adb7398 100644
--- a/web-services-app/src/main/webapp/WEB-INF/service-context.xml
+++ b/web-services-app/src/main/webapp/WEB-INF/service-context.xml
@@ -172,20 +172,12 @@
-
-
-
-
-
-
-
|