public CommentImpl(String message) { this.message = message; this.time = Clock.getCurrentTime(); Environment environment = Environment.getCurrent(); if (environment != null) { this.userId = environment.getUserId(); } }
public static String getUserId() { final String userId = getEnv().getUserId(); if (userId == null) { throw new BonitaRuntimeException("No user found in environment"); } return userId; }
public <T> T execute(Command<T> command) { Environment environment = Environment.getCurrent(); if (environment == null) { throw new PvmException("no environment for verifying authorization"); } MessageSession messageSession = environment.get(MessageSession.class); if (messageSession == null) { throw new PvmException( "no message session for executing command asynchronously"); } String userId = (propagateUserId ? environment.getUserId() : null); messageSession.send(new AsyncCommandMessage(command, userId)); return null; }