@Test public void returnsInputIfNotOnTheRightPushPatientService() throws ComponentLookupException { final AuditEvent e = new AuditEvent(this.user, "ip", "get", null, new DocumentReference("wiki", "Sandbox", "PushPatientService"), Calendar.getInstance()); Assert.assertSame(e, this.mocker.getComponentUnderTest().process(e)); }
@Override public AuditEvent process(AuditEvent event) { DocumentReference originalEntity = event.getEntity(); XWikiRequest request = this.xcontextProvider.get().getRequest(); if ("PushPatientService".equals(originalEntity.getName()) && "PhenoTips".equals(originalEntity.getParent().getName()) && "push".equals(request.getParameter("do"))) { String pushedEntityName = request.getParameter("patientid"); DocumentReference pushedEntity = this.resolver.resolve(pushedEntityName, Patient.DEFAULT_DATA_SPACE); JSONObject extraInfo = new JSONObject(); String serverId = request.getParameter("serverid"); extraInfo.put("server", serverId); extraInfo.put("group", request.getParameter("groupname")); extraInfo.put("fields", request.getParameter("fields")); String remoteUser = request.getParameter("usr"); if (StringUtils.isEmpty(remoteUser)) { remoteUser = this.pushService.getRemoteUsername(serverId); } extraInfo.put("remoteUser", remoteUser); return new AuditEvent(event.getUser(), event.getIp(), "push", extraInfo.toString(), pushedEntity, event.getTime()); } return event; }
PushAuditEventProcessor implements AuditEventProcessor { @Override public AuditEvent process(AuditEvent event) { DocumentReference originalEntity = event.getEntity(); XWikiRequest request = this.xcontextProvider.get().getRequest(); if ("PushPatientService".equals(originalEntity.getName()) && "PhenoTips".equals(originalEntity.getParent().getName()) && "push".equals(request.getParameter("do"))) { String pushedEntityName = request.getParameter("patientid"); DocumentReference pushedEntity = this.resolver.resolve(pushedEntityName, Patient.DEFAULT_DATA_SPACE); JSONObject extraInfo = new JSONObject(); String serverId = request.getParameter("serverid"); extraInfo.put("server", serverId); extraInfo.put("group", request.getParameter("groupname")); extraInfo.put("fields", request.getParameter("fields")); String remoteUser = request.getParameter("usr"); if (StringUtils.isEmpty(remoteUser)) { remoteUser = this.pushService.getRemoteUsername(serverId); } extraInfo.put("remoteUser", remoteUser); return new AuditEvent(event.getUser(), event.getIp(), "push", extraInfo.toString(), pushedEntity, event.getTime()); } return event; } }
PushAuditEventProcessor implements AuditEventProcessor { @Override public AuditEvent process(AuditEvent event) { DocumentReference originalEntity = event.getEntity(); XWikiRequest request = this.xcontextProvider.get().getRequest(); if ("PushPatientService".equals(originalEntity.getName()) && "PhenoTips".equals(originalEntity.getParent().getName()) && "push".equals(request.getParameter("do"))) { String pushedEntityName = request.getParameter("patientid"); DocumentReference pushedEntity = this.resolver.resolve(pushedEntityName, Patient.DEFAULT_DATA_SPACE); JSONObject extraInfo = new JSONObject(); String serverId = request.getParameter("serverid"); extraInfo.put("server", serverId); extraInfo.put("group", request.getParameter("groupname")); extraInfo.put("fields", request.getParameter("fields")); String remoteUser = request.getParameter("usr"); if (StringUtils.isEmpty(remoteUser)) { remoteUser = this.pushService.getRemoteUsername(serverId); } extraInfo.put("remoteUser", remoteUser); return new AuditEvent(event.getUser(), event.getIp(), "push", extraInfo.toString(), pushedEntity, event.getTime()); } return event; }  }
PushAuditEventProcessor implements AuditEventProcessor { @Override public AuditEvent process(AuditEvent event) { DocumentReference originalEntity = event.getEntity(); XWikiRequest request = this.xcontextProvider.get().getRequest(); if ("PushPatientService".equals(originalEntity.getName()) && "PhenoTips".equals(originalEntity.getParent().getName()) && "push".equals(request.getParameter("do"))) { String pushedEntityName = request.getParameter("patientid"); DocumentReference pushedEntity = this.resolver.resolve(pushedEntityName, Patient.DEFAULT_DATA_SPACE); JSONObject extraInfo = new JSONObject(); String serverId = request.getParameter("serverid"); extraInfo.put("server", serverId); extraInfo.put("group", request.getParameter("groupname")); extraInfo.put("fields", request.getParameter("fields")); String remoteUser = request.getParameter("usr"); if (StringUtils.isEmpty(remoteUser)) { remoteUser = this.pushService.getRemoteUsername(serverId); } extraInfo.put("remoteUser", remoteUser); return new AuditEvent(event.getUser(), event.getIp(), "push", extraInfo.toString(), pushedEntity, event.getTime()); } return event; }  @Override AuditEvent process(AuditEvent event); }
PushAuditEventProcessor implements AuditEventProcessor { @Override public AuditEvent process(AuditEvent event) { DocumentReference originalEntity = event.getEntity(); XWikiRequest request = this.xcontextProvider.get().getRequest(); if ("PushPatientService".equals(originalEntity.getName()) && "PhenoTips".equals(originalEntity.getParent().getName()) && "push".equals(request.getParameter("do"))) { String pushedEntityName = request.getParameter("patientid"); DocumentReference pushedEntity = this.resolver.resolve(pushedEntityName, Patient.DEFAULT_DATA_SPACE); JSONObject extraInfo = new JSONObject(); String serverId = request.getParameter("serverid"); extraInfo.put("server", serverId); extraInfo.put("group", request.getParameter("groupname")); extraInfo.put("fields", request.getParameter("fields")); String remoteUser = request.getParameter("usr"); if (StringUtils.isEmpty(remoteUser)) { remoteUser = this.pushService.getRemoteUsername(serverId); } extraInfo.put("remoteUser", remoteUser); return new AuditEvent(event.getUser(), event.getIp(), "push", extraInfo.toString(), pushedEntity, event.getTime()); } return event; }  @Override AuditEvent process(AuditEvent event);  }