| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.Callable; |
| | | |
| | | /** |
| | | * Flowable 相关的工具方法 |
| | |
| | | Authentication.setAuthenticatedUserId(null); |
| | | } |
| | | |
| | | public static <V> V executeAuthenticatedUserId(Long userId, Callable<V> callable) { |
| | | setAuthenticatedUserId(userId); |
| | | try { |
| | | return callable.call(); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } finally { |
| | | clearAuthenticatedUserId(); |
| | | } |
| | | } |
| | | |
| | | public static String getTenantId() { |
| | | Long tenantId = TenantContextHolder.getTenantId(); |
| | | return tenantId != null ? String.valueOf(tenantId) : ProcessEngineConfiguration.NO_TENANT_ID; |