public List<ActiveParticipantType> findActiveParticipants(Predicate<ActiveParticipantType> selector) { return getActiveParticipants().stream() .filter(selector) .collect(Collectors.toList()); }
public T addActiveParticipant(ActiveParticipantType activeParticipantType) { auditMessage.getActiveParticipants().add(activeParticipantType); return self(); }
@Override public void validate() { super.validate(); int aps = getMessage().getActiveParticipants().size(); if (aps < 1 || aps > 2) { throw new AuditException("Must have one or two ActiveParticipants reporting this event"); } } }
@Override public void validate() { super.validate(); int participants = getMessage().getActiveParticipants().size(); if (participants < 1 || participants > 2) { throw new AuditException("Must have one or two ActiveParticipants"); } } }
@Override public void validate() { super.validate(); if (getMessage().getActiveParticipants().size() != 1) { throw new AuditException("Must have one ActiveParticipant"); } } }
@Override public void validate() { super.validate(); if (getMessage().getActiveParticipants().isEmpty() || getMessage().getActiveParticipants().size() > 2) { throw new AuditException("Must have one or two participants that started the Application"); } if (getMessage().findParticipantObjectIdentifications(poi -> ParticipantObjectIdTypeCode.URI.equals(poi.getParticipantObjectTypeCode())).size() != 1) { throw new AuditException("Must have exactly Audit Log Identity Participating Object "); } } }
private void serialize(AuditMessage auditMessage, Writer writer, XMLOutputter outputter) throws IOException { Element element = new Element("AuditMessage"); element.addContent(eventIdentification(auditMessage.getEventIdentification())); auditMessage.getActiveParticipants().stream() .map(this::activeParticipant) .forEach(element::addContent); element.addContent(auditSourceIdentification(auditMessage.getAuditSourceIdentification())); auditMessage.getParticipantObjectIdentifications().stream() .map(this::participantObjectIdentification) .forEach(element::addContent); outputter.output(new Document(element), writer); }
/** * Validates the constructed audit message against the specification, because API does not completely * prevent constructing incomplete or inconsistent messages. * * @throws org.openehealth.ipf.commons.audit.AuditException AuditException in case validation fails */ @Override public void validate() { if (eventIdentification == null) { throw new AuditException("The event must be identified"); } if (auditSourceIdentification == null) { throw new AuditException("The event must be have an audit source"); } if (getActiveParticipants().isEmpty()) { throw new AuditException("The event must have one or more active participants"); } eventIdentification.validate(); auditSourceIdentification.validate(); activeParticipants.forEach(ActiveParticipantType::validate); participantObjectIdentifications.forEach(ParticipantObjectIdentificationType::validate); }
@Override public void validate() { super.validate(); int participants = getMessage().getActiveParticipants().size(); if (participants < 1 || participants > 2) { throw new AuditException("Must have one or two ActiveParticipants"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).size() != 1) { throw new AuditException("Must one ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } } }
@Override public void validate() { super.validate(); int aps = getMessage().getActiveParticipants().size(); if (aps < 1 || aps > 2) { throw new AuditException("Must have one or two user ActiveParticipants"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).size() != 1) { throw new AuditException("Must one ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } } }
@Override public void validate() { super.validate(); int participants = getMessage().getActiveParticipants().size(); if (participants < 1 || participants > 2) { throw new AuditException("Must have one or two ActiveParticipants"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).size() != 1) { throw new AuditException("Must one ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } } }
@Override public void validate() { super.validate(); int participants = getMessage().getActiveParticipants().size(); if (participants < 1 || participants > 2) { throw new AuditException("Must have one or two ActiveParticipants"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.StudyInstanceUID).isEmpty()) { throw new AuditException("Must have one or more ParticipantObjectIdentification with ParticipantObjectIDTypeCode StudyInstanceUID"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).size() != 1) { throw new AuditException("Must have one ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } } }
@Override public void validate() { super.validate(); int participants = getMessage().getActiveParticipants().size(); if (participants < 1 || participants > 2) { throw new AuditException("Must have one or two ActiveParticipants"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.StudyInstanceUID).isEmpty()) { throw new AuditException("Must have one or more ParticipantObjectIdentification with ParticipantObjectIDTypeCode StudyInstanceUID"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).size() != 1) { throw new AuditException("Must one ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } } }
protected AuditEvent translate(AuditMessage auditMessage) { EventIdentificationType eit = auditMessage.getEventIdentification(); AuditEvent auditEvent = new AuditEvent() .setType(codedValueTypeToCoding(eit.getEventID())) .setAction(getAuditEventAction(eit.getEventActionCode())) .setRecorded(Date.from(eit.getEventDateTime())) .setOutcome(getAuditEventOutcome(eit.getEventOutcomeIndicator())) .setOutcomeDesc(eit.getEventOutcomeDescription()); eit.getEventTypeCode().forEach(etc -> auditEvent.addSubtype(codedValueTypeToCoding(etc))); eit.getPurposesOfUse().forEach(pou -> auditEvent.addPurposeOfEvent(codedValueTypeToCodeableConcept(pou))); auditMessage.getActiveParticipants().forEach(ap -> auditEvent.addAgent(activeParticipantToAgent(ap))); auditEvent.setSource(auditSourceIdentificationToEventSource(auditMessage.getAuditSourceIdentification())); auditMessage.getParticipantObjectIdentifications().forEach(poit -> auditEvent.addEntity(participantObjectIdentificationToEntity(poit))); return auditEvent; }
protected AuditEvent translate(AuditMessage auditMessage) { EventIdentificationType eit = auditMessage.getEventIdentification(); AuditEvent auditEvent = new AuditEvent() .setType(codedValueTypeToCoding(eit.getEventID())) .setAction(getAuditEventAction(eit.getEventActionCode())) .setRecorded(Date.from(eit.getEventDateTime())) .setOutcome(getAuditEventOutcome(eit.getEventOutcomeIndicator())) .setOutcomeDesc(eit.getEventOutcomeDescription()); eit.getEventTypeCode().forEach(etc -> auditEvent.addSubtype(codedValueTypeToCoding(etc))); eit.getPurposesOfUse().forEach(pou -> auditEvent.addPurposeOfEvent(codedValueTypeToCodeableConcept(pou))); auditMessage.getActiveParticipants().forEach(ap -> auditEvent.addAgent(activeParticipantToAgent(ap))); auditEvent.setSource(auditSourceIdentificationToEventSource(auditMessage.getAuditSourceIdentification())); auditMessage.getParticipantObjectIdentifications().forEach(poit -> auditEvent.addEntity(participantObjectIdentificationToEntity(poit))); return auditEvent; }
ActiveParticipantType source = event.getActiveParticipants().get(0); assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); ActiveParticipantType destination = event.getActiveParticipants().get(1); assertFalse(destination.isUserIsRequestor()); assertEquals(AuditUtils.getLocalIPAddress(), destination.getNetworkAccessPointID());
ActiveParticipantType source = event.getActiveParticipants().get(0); assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); ActiveParticipantType destination = event.getActiveParticipants().get(1); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/Patient/$ihe-pix", destination.getUserID());
ActiveParticipantType source = event.getActiveParticipants().get(0); assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); ActiveParticipantType destination = event.getActiveParticipants().get(1); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/Patient", destination.getUserID());
ActiveParticipantType source = event.getActiveParticipants().get(0); assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); ActiveParticipantType destination = event.getActiveParticipants().get(1); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/", destination.getUserID());
ActiveParticipantType source = event.getActiveParticipants().get(0); assertTrue(source.isUserIsRequestor()); assertEquals("127.0.0.1", source.getNetworkAccessPointID()); ActiveParticipantType destination = event.getActiveParticipants().get(1); assertFalse(destination.isUserIsRequestor()); assertEquals("http://localhost:" + DEMO_APP_PORT + "/", destination.getUserID());