AuditDataTransformHelper { public static void logAuditMessage(final AuditMessageType message) { LOG.debug("********** Audit Log Message ***********"); LOG.debug("EventIdCode: {}", message.getEventIdentification().getEventID().getCode()); LOG.debug("EventIdCodeSystem: {}", message.getEventIdentification().getEventID().getCodeSystem()); if (CollectionUtils.isNotEmpty(message.getAuditSourceIdentification()) && message.getAuditSourceIdentification().get(0).getAuditSourceID() != null) { LOG.debug("Home Community Id: {}", message.getAuditSourceIdentification().get(0).getAuditSourceID()); } else { LOG.debug("Home Community Id: There was no AuditSourceID in the message"); } if (CollectionUtils.isNotEmpty(message.getActiveParticipant())) { if (message.getActiveParticipant().get(0).getUserID() != null) { LOG.debug("UserId: {}", message.getActiveParticipant().get(0).getUserID()); } else { LOG.debug("UserId: There was no User Id in the message"); } if (message.getActiveParticipant().get(0).getUserName() != null) { LOG.debug("UserName: {}", message.getActiveParticipant().get(0).getUserName()); } } if (CollectionUtils.isNotEmpty(message.getParticipantObjectIdentification()) && message.getParticipantObjectIdentification().get(0).getParticipantObjectID() != null) { LOG.debug("PatientId: {}", message.getParticipantObjectIdentification().get(0).getParticipantObjectID()); } else { LOG.debug("PatientId: There was no Patient Id in the message"); } }  static EventIdentificationType createEventIdentification(final String actionCode, final Integer eventOutcome,
        final CodedValueType eventId); static CodedValueType createEventId(final String eventCode, final String eventCodeSys,
        final String eventCodeSysName, final String dispName); static CodedValueType createCodeValueType(final String code, final String codeSys, final String codeSysName,
        final String dispName); static AuditMessageType.ActiveParticipant createActiveParticipantFromUser(final UserType userInfo,
        final Boolean userIsReq); static AuditMessageType.ActiveParticipant createActiveParticipant(final String userId,
        final String altUserId, final String userName, final Boolean userIsReq); static AuditSourceIdentificationType createAuditSourceIdentificationFromUser(final UserType userInfo); static AuditSourceIdentificationType createAuditSourceIdentification(final String communityId,
        final String communityName); static ParticipantObjectIdentificationType createParticipantObjectIdentification(final String patientId); static ParticipantObjectIdentificationType createDocumentParticipantObjectIdentification(
        final String documentId); static void logAuditMessage(final AuditMessageType message); static ExternalIdentifierType findSingleExternalIdentifier(final List<ExternalIdentifierType> olExtId,
        final String sIdentScheme); static String findSingleExternalIdentifierAndExtractValue(final List<ExternalIdentifierType> olExtId,
        final String sIdentScheme); static String createCompositePatientId(final String assigningAuthId, final String patientId); static String createCompositePatientIdFromAssertion(final UserType userInfo, final String patientId);  }
@Test public void testLogAuditMessage() { EventIdentificationType eventId = new EventIdentificationType(); CodedValueType code = new CodedValueType(); code.setCode(AuditDataTransformConstants.EVENT_ACTION_CODE_EXECUTE); code.setCodeSystem(AuditDataTransformConstants.EVENT_ID_CODE_SYS_NAME_SDN); eventId.setEventActionCode(AuditDataTransformConstants.EVENT_ACTION_CODE_EXECUTE); eventId.setEventID(code); ActiveParticipant participant = new ActiveParticipant(); participant.setUserID("tester"); AuditSourceIdentificationType sourceId = new AuditSourceIdentificationType(); sourceId.setAuditSourceID("2.16.840.1.113883.3.198"); sourceId.setAuditEnterpriseSiteID("Federal - DoD"); AuditMessageType message = new AuditMessageType(); message.setEventIdentification(eventId); message.getActiveParticipant().add(participant); message.getAuditSourceIdentification().add(sourceId); AuditDataTransformHelper.logAuditMessage(message); }