diff --git a/orcid-persistence/src/main/resources/db-master.xml b/orcid-persistence/src/main/resources/db-master.xml index fda8f31a661..d629482ead5 100644 --- a/orcid-persistence/src/main/resources/db-master.xml +++ b/orcid-persistence/src/main/resources/db-master.xml @@ -387,4 +387,5 @@ + diff --git a/orcid-persistence/src/main/resources/db/updates/alter_ip_col_in_events.xml b/orcid-persistence/src/main/resources/db/updates/alter_ip_col_in_events.xml new file mode 100644 index 00000000000..052e0d4168f --- /dev/null +++ b/orcid-persistence/src/main/resources/db/updates/alter_ip_col_in_events.xml @@ -0,0 +1,33 @@ + + + + + + + ALTER TABLE event ALTER COLUMN ip VARCHAR(60); + + + + + + + ALTER TABLE event_stats ALTER COLUMN ip VARCHAR(60); + + + + + + + ALTER TABLE event ALTER COLUMN ip TYPE VARCHAR(60); + + + + + + + ALTER TABLE event_stats ALTER COLUMN ip TYPE VARCHAR(60); + + + \ No newline at end of file diff --git a/orcid-persistence/src/test/java/org/orcid/persistence/dao/EventStatsDaoTest.java b/orcid-persistence/src/test/java/org/orcid/persistence/dao/EventStatsDaoTest.java index 42d0b7a76c4..343b6fc8063 100644 --- a/orcid-persistence/src/test/java/org/orcid/persistence/dao/EventStatsDaoTest.java +++ b/orcid-persistence/src/test/java/org/orcid/persistence/dao/EventStatsDaoTest.java @@ -65,7 +65,7 @@ public void createPapiEventStats() { assertEquals(Integer.valueOf(10), eventStatsEntityList.get(1).getCount()); assertNull(eventStatsEntityList.get(2).getClientId()); - assertEquals("104.20.228.70", eventStatsEntityList.get(2).getIp()); + assertEquals("2001:db8:85a3:8d3:1319:8a2e:370:7348", eventStatsEntityList.get(2).getIp()); assertEquals(Integer.valueOf(1100), eventStatsEntityList.get(2).getCount()); @@ -99,7 +99,7 @@ private void createPapiEvents() { for (int i = 0; i < 1100; i++) { EventEntity eventEntity = new EventEntity(); eventEntity.setEventType(EventType.PAPI.getValue()); - eventEntity.setIp("104.20.228.70"); + eventEntity.setIp("2001:db8:85a3:8d3:1319:8a2e:370:7348"); eventEntity.setLabel("anonymous"); LocalDate date = LocalDate.now().minusDays(1); Instant instant = date.atStartOfDay(ZoneId.systemDefault()).toInstant(); diff --git a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_0.java b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_0.java index 20e208195bd..745509da5c3 100644 --- a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_0.java +++ b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_0.java @@ -82,6 +82,9 @@ public class PublicV2ApiServiceImplV2_0 { @Resource protected SwaggerUIBuilder swaggerUIBuilder; + @Context + private HttpServletRequest httpRequest; + public void setServiceDelegator( PublicV2ApiServiceDelegator serviceDelegator) { this.serviceDelegator = serviceDelegator; @@ -110,6 +113,7 @@ public Response viewStatusText() { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(ACTIVITIES) public Response viewActivities(@PathParam("orcid") String orcid, @Context HttpServletRequest httpRequest) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewActivities(orcid); } @@ -118,6 +122,7 @@ public Response viewActivities(@PathParam("orcid") String orcid, @Context HttpSe OrcidApiConstants.APPLICATION_CITEPROC }) @Path(WORK + PUTCODE) public Response viewWork(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode, @Context HttpServletRequest httpRequest) { + serviceDelegator.trackEvents(httpRequest); if (OrcidApiConstants.APPLICATION_CITEPROC.equals(httpRequest.getHeader("Accept"))) return serviceDelegator.viewWorkCitation(orcid, putCode); return serviceDelegator.viewWork(orcid, putCode); @@ -127,6 +132,7 @@ public Response viewWork(@PathParam("orcid") String orcid, @PathParam("putCode") @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(WORK_SUMMARY + PUTCODE) public Response viewWorkSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewWorkSummary(orcid, putCode); } @@ -134,6 +140,7 @@ public Response viewWorkSummary(@PathParam("orcid") String orcid, @PathParam("pu @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(WORKS) public Response viewWorks(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewWorks(orcid); } @@ -141,6 +148,7 @@ public Response viewWorks(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(BULK_WORKS) public Response viewSpecifiedWorks(@PathParam("orcid") String orcid, @PathParam("putCodes") String putCodes) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewBulkWorks(orcid, putCodes); } @@ -148,6 +156,7 @@ public Response viewSpecifiedWorks(@PathParam("orcid") String orcid, @PathParam( @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(FUNDING + PUTCODE) public Response viewFunding(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewFunding(orcid, putCode); } @@ -155,13 +164,15 @@ public Response viewFunding(@PathParam("orcid") String orcid, @PathParam("putCod @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(FUNDING_SUMMARY + PUTCODE) public Response viewFundingSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewFundingSummary(orcid, putCode); } @GET @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(FUNDINGS) - public Response viewFundings(@PathParam("orcid") String orcid) { + public Response viewFundings(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewFundings(orcid); } @@ -169,6 +180,7 @@ public Response viewFundings(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EDUCATION + PUTCODE) public Response viewEducation(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEducation(orcid, putCode); } @@ -176,6 +188,7 @@ public Response viewEducation(@PathParam("orcid") String orcid, @PathParam("putC @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EDUCATION_SUMMARY + PUTCODE) public Response viewEducationSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEducationSummary(orcid, putCode); } @@ -183,6 +196,7 @@ public Response viewEducationSummary(@PathParam("orcid") String orcid, @PathPara @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EDUCATIONS) public Response viewEducations(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEducations(orcid); } @@ -190,6 +204,7 @@ public Response viewEducations(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMPLOYMENT + PUTCODE) public Response viewEmployment(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmployment(orcid, putCode); } @@ -197,6 +212,7 @@ public Response viewEmployment(@PathParam("orcid") String orcid, @PathParam("put @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMPLOYMENT_SUMMARY + PUTCODE) public Response viewEmploymentSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmploymentSummary(orcid, putCode); } @@ -204,6 +220,7 @@ public Response viewEmploymentSummary(@PathParam("orcid") String orcid, @PathPar @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMPLOYMENTS) public Response viewEmployments(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmployments(orcid); } @@ -211,6 +228,7 @@ public Response viewEmployments(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PEER_REVIEW + PUTCODE) public Response viewPeerReview(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPeerReview(orcid, putCode); } @@ -218,6 +236,7 @@ public Response viewPeerReview(@PathParam("orcid") String orcid, @PathParam("put @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PEER_REVIEW_SUMMARY + PUTCODE) public Response viewPeerReviewSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPeerReviewSummary(orcid, putCode); } @@ -225,6 +244,7 @@ public Response viewPeerReviewSummary(@PathParam("orcid") String orcid, @PathPar @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PEER_REVIEWS) public Response viewPeerReviews(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPeerReviews(orcid); } @@ -232,6 +252,7 @@ public Response viewPeerReviews(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(RESEARCHER_URLS) public Response viewResearcherUrls(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewResearcherUrls(orcid); } @@ -239,6 +260,7 @@ public Response viewResearcherUrls(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(RESEARCHER_URLS + PUTCODE) public Response viewResearcherUrl(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewResearcherUrl(orcid, Long.valueOf(putCode)); } @@ -246,6 +268,7 @@ public Response viewResearcherUrl(@PathParam("orcid") String orcid, @PathParam(" @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMAIL) public Response viewEmails(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmails(orcid); } @@ -253,6 +276,7 @@ public Response viewEmails(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PERSONAL_DETAILS) public Response viewPersonalDetails(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPersonalDetails(orcid); } @@ -260,6 +284,7 @@ public Response viewPersonalDetails(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(OTHER_NAMES) public Response viewOtherNames(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewOtherNames(orcid); } @@ -267,6 +292,7 @@ public Response viewOtherNames(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(OTHER_NAMES + PUTCODE) public Response viewOtherName(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewOtherName(orcid, Long.valueOf(putCode)); } @@ -274,6 +300,7 @@ public Response viewOtherName(@PathParam("orcid") String orcid, @PathParam("putC @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EXTERNAL_IDENTIFIERS) public Response viewExternalIdentifiers(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewExternalIdentifiers(orcid); } @@ -281,6 +308,7 @@ public Response viewExternalIdentifiers(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EXTERNAL_IDENTIFIERS + PUTCODE) public Response viewExternalIdentifier(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewExternalIdentifier(orcid, Long.valueOf(putCode)); } @@ -288,6 +316,7 @@ public Response viewExternalIdentifier(@PathParam("orcid") String orcid, @PathPa @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(KEYWORDS) public Response viewKeywords(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewKeywords(orcid); } @@ -295,6 +324,7 @@ public Response viewKeywords(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(KEYWORDS + PUTCODE) public Response viewKeyword(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewKeyword(orcid, Long.valueOf(putCode)); } @@ -302,6 +332,7 @@ public Response viewKeyword(@PathParam("orcid") String orcid, @PathParam("putCod @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(ADDRESS) public Response viewAddresses(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewAddresses(orcid); } @@ -309,6 +340,7 @@ public Response viewAddresses(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(ADDRESS + PUTCODE) public Response viewAddress(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewAddress(orcid, Long.valueOf(putCode)); } @@ -316,6 +348,7 @@ public Response viewAddress(@PathParam("orcid") String orcid, @PathParam("putCod @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(BIOGRAPHY) public Response viewBiography(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewBiography(orcid); } @@ -323,6 +356,7 @@ public Response viewBiography(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PERSON) public Response viewPerson(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPerson(orcid); } @@ -331,6 +365,7 @@ public Response viewPerson(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON , JSON_LD}) @Path(OrcidApiConstants.RECORD_SIMPLE) public Response viewRecord(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewRecord(orcid); } @@ -339,6 +374,7 @@ public Response viewRecord(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(OrcidApiConstants.RECORD_RECORD) public Response viewRecordRecord(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewRecord(orcid); } @@ -346,6 +382,7 @@ public Response viewRecordRecord(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(SEARCH_PATH) public Response searchByQuery(@QueryParam("q") @DefaultValue("") String query, @Context UriInfo uriInfo) { + serviceDelegator.trackEvents(httpRequest); Map> solrParams = new HashMap<>(uriInfo.getQueryParameters()); Response jsonQueryResults = serviceDelegator.searchByQuery(solrParams); return jsonQueryResults; @@ -355,6 +392,7 @@ public Response searchByQuery(@QueryParam("q") @DefaultValue("") String query, @ @Path(CLIENT_PATH) @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) public Response viewClient(@PathParam("client_id") String clientId) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewClient(clientId); } diff --git a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_1.java b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_1.java index cb6979a9c3c..d9c8799689a 100644 --- a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_1.java +++ b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/PublicV2ApiServiceImplV2_1.java @@ -80,7 +80,9 @@ public class PublicV2ApiServiceImplV2_1 { @Resource protected SwaggerUIBuilder swaggerUIBuilder; - + + @Context + private HttpServletRequest httpRequest; public void setServiceDelegator( PublicV2ApiServiceDelegator serviceDelegator) { @@ -112,6 +114,7 @@ public Response viewStatusText() { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(ACTIVITIES) public Response viewActivities(@PathParam("orcid") String orcid, @Context HttpServletRequest httpRequest) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewActivities(orcid); } @@ -120,6 +123,7 @@ public Response viewActivities(@PathParam("orcid") String orcid, @Context HttpSe OrcidApiConstants.APPLICATION_CITEPROC }) @Path(WORK + PUTCODE) public Response viewWork(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode, @Context HttpServletRequest httpRequest) { + serviceDelegator.trackEvents(httpRequest); if (OrcidApiConstants.APPLICATION_CITEPROC.equals(httpRequest.getHeader("Accept"))) return serviceDelegator.viewWorkCitation(orcid, putCode); return serviceDelegator.viewWork(orcid, putCode); @@ -129,6 +133,7 @@ public Response viewWork(@PathParam("orcid") String orcid, @PathParam("putCode") @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(WORK_SUMMARY + PUTCODE) public Response viewWorkSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewWorkSummary(orcid, putCode); } @@ -136,6 +141,7 @@ public Response viewWorkSummary(@PathParam("orcid") String orcid, @PathParam("pu @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(WORKS) public Response viewWorks(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewWorks(orcid); } @@ -143,6 +149,7 @@ public Response viewWorks(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(BULK_WORKS) public Response viewSpecifiedWorks(@PathParam("orcid") String orcid, @PathParam("putCodes") String putCodes) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewBulkWorks(orcid, putCodes); } @@ -150,6 +157,7 @@ public Response viewSpecifiedWorks(@PathParam("orcid") String orcid, @PathParam( @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(FUNDING + PUTCODE) public Response viewFunding(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewFunding(orcid, putCode); } @@ -157,13 +165,15 @@ public Response viewFunding(@PathParam("orcid") String orcid, @PathParam("putCod @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(FUNDING_SUMMARY + PUTCODE) public Response viewFundingSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewFundingSummary(orcid, putCode); } @GET @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(FUNDINGS) - public Response viewFundings(@PathParam("orcid") String orcid) { + public Response viewFundings(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewFundings(orcid); } @@ -171,6 +181,7 @@ public Response viewFundings(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EDUCATION + PUTCODE) public Response viewEducation(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEducation(orcid, putCode); } @@ -178,6 +189,7 @@ public Response viewEducation(@PathParam("orcid") String orcid, @PathParam("putC @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EDUCATION_SUMMARY + PUTCODE) public Response viewEducationSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEducationSummary(orcid, putCode); } @@ -185,6 +197,7 @@ public Response viewEducationSummary(@PathParam("orcid") String orcid, @PathPara @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EDUCATIONS) public Response viewEducations(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEducations(orcid); } @@ -192,6 +205,7 @@ public Response viewEducations(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMPLOYMENT + PUTCODE) public Response viewEmployment(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmployment(orcid, putCode); } @@ -199,6 +213,7 @@ public Response viewEmployment(@PathParam("orcid") String orcid, @PathParam("put @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMPLOYMENT_SUMMARY + PUTCODE) public Response viewEmploymentSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmploymentSummary(orcid, putCode); } @@ -206,6 +221,7 @@ public Response viewEmploymentSummary(@PathParam("orcid") String orcid, @PathPar @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMPLOYMENTS) public Response viewEmployments(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmployments(orcid); } @@ -213,6 +229,7 @@ public Response viewEmployments(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PEER_REVIEW + PUTCODE) public Response viewPeerReview(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPeerReview(orcid, putCode); } @@ -220,6 +237,7 @@ public Response viewPeerReview(@PathParam("orcid") String orcid, @PathParam("put @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PEER_REVIEW_SUMMARY + PUTCODE) public Response viewPeerReviewSummary(@PathParam("orcid") String orcid, @PathParam("putCode") Long putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPeerReviewSummary(orcid, putCode); } @@ -227,6 +245,7 @@ public Response viewPeerReviewSummary(@PathParam("orcid") String orcid, @PathPar @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PEER_REVIEWS) public Response viewPeerReviews(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPeerReviews(orcid); } @@ -234,6 +253,7 @@ public Response viewPeerReviews(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(RESEARCHER_URLS) public Response viewResearcherUrls(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewResearcherUrls(orcid); } @@ -241,6 +261,7 @@ public Response viewResearcherUrls(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(RESEARCHER_URLS + PUTCODE) public Response viewResearcherUrl(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewResearcherUrl(orcid, Long.valueOf(putCode)); } @@ -248,6 +269,7 @@ public Response viewResearcherUrl(@PathParam("orcid") String orcid, @PathParam(" @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EMAIL) public Response viewEmails(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewEmails(orcid); } @@ -255,6 +277,7 @@ public Response viewEmails(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PERSONAL_DETAILS) public Response viewPersonalDetails(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPersonalDetails(orcid); } @@ -262,6 +285,7 @@ public Response viewPersonalDetails(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(OTHER_NAMES) public Response viewOtherNames(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewOtherNames(orcid); } @@ -269,6 +293,7 @@ public Response viewOtherNames(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(OTHER_NAMES + PUTCODE) public Response viewOtherName(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewOtherName(orcid, Long.valueOf(putCode)); } @@ -276,6 +301,7 @@ public Response viewOtherName(@PathParam("orcid") String orcid, @PathParam("putC @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EXTERNAL_IDENTIFIERS) public Response viewExternalIdentifiers(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewExternalIdentifiers(orcid); } @@ -283,6 +309,7 @@ public Response viewExternalIdentifiers(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(EXTERNAL_IDENTIFIERS + PUTCODE) public Response viewExternalIdentifier(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewExternalIdentifier(orcid, Long.valueOf(putCode)); } @@ -290,6 +317,7 @@ public Response viewExternalIdentifier(@PathParam("orcid") String orcid, @PathPa @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(KEYWORDS) public Response viewKeywords(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewKeywords(orcid); } @@ -297,6 +325,7 @@ public Response viewKeywords(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(KEYWORDS + PUTCODE) public Response viewKeyword(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewKeyword(orcid, Long.valueOf(putCode)); } @@ -304,6 +333,7 @@ public Response viewKeyword(@PathParam("orcid") String orcid, @PathParam("putCod @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(ADDRESS) public Response viewAddresses(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewAddresses(orcid); } @@ -311,6 +341,7 @@ public Response viewAddresses(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(ADDRESS + PUTCODE) public Response viewAddress(@PathParam("orcid") String orcid, @PathParam("putCode") String putCode) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewAddress(orcid, Long.valueOf(putCode)); } @@ -318,6 +349,7 @@ public Response viewAddress(@PathParam("orcid") String orcid, @PathParam("putCod @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(BIOGRAPHY) public Response viewBiography(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewBiography(orcid); } @@ -325,6 +357,7 @@ public Response viewBiography(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(PERSON) public Response viewPerson(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewPerson(orcid); } @@ -333,6 +366,7 @@ public Response viewPerson(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON, JSON_LD }) @Path(OrcidApiConstants.RECORD_SIMPLE) public Response viewRecord(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewRecord(orcid); } @@ -341,6 +375,7 @@ public Response viewRecord(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(OrcidApiConstants.RECORD_RECORD) public Response viewRecordRecord(@PathParam("orcid") String orcid) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewRecord(orcid); } @@ -348,6 +383,7 @@ public Response viewRecordRecord(@PathParam("orcid") String orcid) { @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) @Path(SEARCH_PATH) public Response searchByQuery(@QueryParam("q") @DefaultValue("") String query, @Context UriInfo uriInfo) { + serviceDelegator.trackEvents(httpRequest); Map> solrParams = new HashMap<>(uriInfo.getQueryParameters()); Response jsonQueryResults = serviceDelegator.searchByQuery(solrParams); return jsonQueryResults; @@ -357,6 +393,7 @@ public Response searchByQuery(@QueryParam("q") @DefaultValue("") String query, @ @Path(CLIENT_PATH) @Produces(value = { VND_ORCID_XML, ORCID_XML, MediaType.APPLICATION_XML, VND_ORCID_JSON, ORCID_JSON, MediaType.APPLICATION_JSON }) public Response viewClient(@PathParam("client_id") String clientId) { + serviceDelegator.trackEvents(httpRequest); return serviceDelegator.viewClient(clientId); } } \ No newline at end of file diff --git a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/PublicV2ApiServiceDelegator.java b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/PublicV2ApiServiceDelegator.java index 5730a2d2420..b51e80e01e6 100644 --- a/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/PublicV2ApiServiceDelegator.java +++ b/orcid-pub-web/src/main/java/org/orcid/api/publicV2/server/delegator/PublicV2ApiServiceDelegator.java @@ -3,6 +3,7 @@ import java.util.List; import java.util.Map; +import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.Response; /** @@ -90,4 +91,6 @@ public interface PublicV2ApiServiceDelegator