public String getSystemAltUserId ( ) { // If a localized value is set, use it if ( ! EventUtils . isEmptyOrNull ( systemAltUserId ) ) { return systemAltUserId ; } // Check if a configuration parameter is set systemAltUserId = getConfig ( ) . getSystemAltUserId ( ) ; if ( ! EventUtils . isEmptyOrNull ( systemAltUserId ) ) { return systemAltUserId ; } // If both are empty, attempt to determine the alternate user id // per IHE specifications (e.g. owner JVM's process id) String processId = null ; try { // JVM specification says the runtime bean name may contain // the process and context information about the JVM, including // process ID. Attempt to get this information RuntimeMXBean mx = ManagementFactory . getRuntimeMXBean ( ) ; processId = mx . getName ( ) ; int pointer ; if ( ( pointer = processId . indexOf ( ' ' ) ) != - 1 ) { processId = processId . substring ( 0 , pointer ) ; } } catch ( Throwable t ) { // Ignore errors and exceptions, we'll just fake it } // If we can't get the process ID or if it's not set, fake it if ( EventUtils . isEmptyOrNull ( processId ) ) { processId = String . valueOf ( ( int ) ( Math . random ( ) * 1000 ) ) ; } systemAltUserId = processId ; return systemAltUserId ; }
Get alternate user id for the system s ActiveParticipant in audit messages . This is either set in configuration or the the auditor will attempt to determine it from the JVM s process id .