AuditDataTransformHelper { public static AuditSourceIdentificationType createAuditSourceIdentificationFromUser(final UserType userInfo) { final AuditSourceIdentificationType auditSrcId = new AuditSourceIdentificationType(); String communityId = null; String communityName = null; if (userInfo != null && userInfo.getOrg() != null) { if (userInfo.getOrg().getHomeCommunityId() != null && userInfo.getOrg().getHomeCommunityId().length() > 0) { communityId = userInfo.getOrg().getHomeCommunityId(); } if (userInfo.getOrg().getName() != null && userInfo.getOrg().getName().length() > 0) { communityName = userInfo.getOrg().getName(); } } if (communityId != null) { LOG.debug("communityId prior to remove urn:oid{}", communityId); if (communityId.startsWith("urn:oid:")) { auditSrcId.setAuditSourceID(communityId.substring(8)); } else { auditSrcId.setAuditSourceID(communityId); } } if (communityName != null) { auditSrcId.setAuditEnterpriseSiteID(communityName); } return auditSrcId; }  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 testCreateAuditSourceIdentificationFromAssertion() { HomeCommunityType home = new HomeCommunityType(); home.setHomeCommunityId("2.16.840.1.113883.3.200"); home.setName("Federal - VA"); UserType userInfo = new UserType(); userInfo.setOrg(home); AuditSourceIdentificationType expResult = new AuditSourceIdentificationType(); expResult.setAuditSourceID(home.getHomeCommunityId()); expResult.setAuditEnterpriseSiteID(home.getName()); AuditSourceIdentificationType result = AuditDataTransformHelper .createAuditSourceIdentificationFromUser(userInfo); assertEquals(expResult.getAuditEnterpriseSiteID(), result.getAuditEnterpriseSiteID()); assertEquals(expResult.getAuditSourceID(), result.getAuditSourceID()); }