public static String getCurrentUser() {
        ServiceContext ctx = ServiceContextStore.get();
        String currentUser;
        if (ctx == null) {
            currentUser = ServiceContextFactory.SYSTEM_USER;
        } else {
            currentUser = ctx.getUserId();
        }

        if (currentUser == null) {
            currentUser = ServiceContextFactory.UNKNOWN_USER;
        }
        return currentUser;
    }
public static String getCurrentUser ( ) { ServiceContext ctx = ServiceContextStore . get ( ) ; String currentUser ; if ( ctx == null ) { currentUser = ServiceContextFactory . SYSTEM_USER ; } else { currentUser = ctx . getUserId ( ) ; } if ( currentUser == null ) { currentUser = ServiceContextFactory . UNKNOWN_USER ; } return currentUser ; }
Current user from ServiceContext. If ServiceContext is not set then
{@link ServiceContextFactory.SYSTEM_USER} is returned.