@Override public void validate() { auditMessage.validate(); }
public BaseAuditMessageBuilder() { this.auditMessage = new AuditMessage(); }
/** * Create and set a Type Value Pair instance for a given type and value * * @param type the type to set * @param value the value to set * @param defaultValue the value to set if value is null * @return the Type Value Pair instance */ default TypeValuePairType getTypeValuePair(String type, byte[] value, byte[] defaultValue) { return new TypeValuePairType( type, value != null ? value : null, defaultValue); }
@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"); } } }
private void testRequest(boolean serverSide, XdsIRetrieveAuditStrategy30 strategy) { XdsNonconstructiveDocumentSetRequestAuditDataset auditDataset = getXdsAuditDataset(strategy); AuditMessage auditMessage = makeAuditMessage(strategy, auditContext, auditDataset); assertNotNull(auditMessage); auditMessage.validate(); // System.out.println(printAuditMessage(auditMessage)); assertCommonXdsAuditAttributes(auditMessage, EventOutcomeIndicator.Success, serverSide ? EventIdCode.Export : EventIdCode.Import, serverSide ? EventActionCode.Read : EventActionCode.Create, serverSide, true); assertEquals(3, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCodeRole() == ParticipantObjectTypeCodeRole.Report).size()); assertEquals(4, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCode() == ParticipantObjectTypeCode.System) .get(0) .getParticipantObjectDetails().size()); }
@Override public void validate() { super.validate(); if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Destination)).isEmpty()) { throw new AuditException("Must have one or more ActiveParticipant with RoleIDCode Destination"); } if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.SourceMedia)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode SourceMedia"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).isEmpty()) { throw new AuditException("Must one or more ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } } }
@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 testRequest(boolean serverSide) { Iti86AuditStrategy strategy = new Iti86AuditStrategy(serverSide); XdsNonconstructiveDocumentSetRequestAuditDataset auditDataset = getXdsAuditDataset(strategy); AuditMessage auditMessage = makeAuditMessage(strategy, auditContext, auditDataset); assertNotNull(auditMessage); auditMessage.validate(); // System.out.println(printAuditMessage(auditMessage)); assertCommonXdsAuditAttributes(auditMessage, EventOutcomeIndicator.Success, EventIdCode.PatientRecord, EventActionCode.Delete, serverSide, true); assertEquals(3, auditMessage.findParticipantObjectIdentifications( poit -> poit.getParticipantObjectTypeCodeRole() == ParticipantObjectTypeCodeRole.Report).size()); }
/** * 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); }
public T addParticipantObjectIdentification(ParticipantObjectIdentificationType poit) { auditMessage.getParticipantObjectIdentifications().add(poit); return self(); }
@Override public void validate() { super.validate(); if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Source)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode Source"); } if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Destination)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode Destination"); } // DICOM restricts Participating Object to be one SOP Queried and the Query, but IHE also uses this Audit Event // for all sorts of other queries, so we cannot validate this at this point. } }
public T setAuditSourceIdentification(AuditSourceIdentificationType auditSourceIdentificationType) { auditMessage.setAuditSourceIdentification(auditSourceIdentificationType); 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 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 sources = getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Source)).size(); if (sources < 1 || sources > 2) { throw new AuditException("Must have one or two ActiveParticipant with RoleIDCode Source"); } if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.DestinationMedia)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode DestinationMedia"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).isEmpty()) { throw new AuditException("Must one or more ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } } }
/** * Create and set a Type Value Pair instance for a given type and value * * @param type the type to set * @param value the value to set * @param defaultValue the value to set if value is null * @return the Type Value Pair instance */ default TypeValuePairType getTypeValuePair(String type, Object value, String defaultValue) { return new TypeValuePairType( type, value != null ? value.toString() : null, defaultValue); }
@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"); } } }
@Override public void validate() { super.validate(); if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Source)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode Source"); } if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Destination)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode Destination"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).size() != 1) { throw new AuditException("Must one ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.StudyInstanceUID).isEmpty()) { throw new AuditException("Must have one or more ParticipantObjectIdentification with ParticipantObjectIDTypeCode StudyInstanceUID"); } } }
@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(); if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Source)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode Source"); } if (getMessage().findActiveParticipants(ap -> ap.getRoleIDCodes().contains(ActiveParticipantRoleIdCode.Destination)).size() != 1) { throw new AuditException("Must have one ActiveParticipant with RoleIDCode Destination"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.PatientNumber).size() != 1) { throw new AuditException("Must have one ParticipantObjectIdentification with ParticipantObjectIDTypeCode PatientNumber"); } if (getMessage().findParticipantObjectIdentifications(poi -> poi.getParticipantObjectIDTypeCode() == ParticipantObjectIdTypeCode.StudyInstanceUID).isEmpty()) { throw new AuditException("Must have one or more ParticipantObjectIdentification with ParticipantObjectIDTypeCode StudyInstanceUID"); } } }
@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"); } } }