本文整理了Java中org.activiti.engine.impl.identity.Authentication
类的一些代码示例,展示了Authentication
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Authentication
类的具体详情如下:
包路径:org.activiti.engine.impl.identity.Authentication
类名称:Authentication
暂无
代码示例来源:origin: Activiti/Activiti
@Override
protected void setUp() throws Exception {
super.setUp();
// Always reset authenticated user to avoid any mistakes
Authentication.setAuthenticatedUserId(null);
}
代码示例来源:origin: Activiti/Activiti
} else if (LOGGED_IN_USER_KEY.equals(property)) {
context.setPropertyResolved(true);
return Authentication.getAuthenticatedUserId();
} else {
if (variableScope.hasVariable(variable)) {
代码示例来源:origin: Activiti/Activiti
org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(username);
代码示例来源:origin: Activiti/Activiti
protected EventLogEntryEntity createEventLogEntry(String type, String processDefinitionId, String processInstanceId, String executionId, String taskId, Map<String, Object> data) {
EventLogEntryEntity eventLogEntry = Context.getCommandContext().getEventLogEntryEntityManager().create();
eventLogEntry.setProcessDefinitionId(processDefinitionId);
eventLogEntry.setProcessInstanceId(processInstanceId);
eventLogEntry.setExecutionId(executionId);
eventLogEntry.setTaskId(taskId);
eventLogEntry.setType(type);
eventLogEntry.setTimeStamp(timeStamp);
putInMapIfNotNull(data, Fields.TIMESTAMP, timeStamp);
// Current user
String userId = Authentication.getAuthenticatedUserId();
if (userId != null) {
eventLogEntry.setUserId(userId);
putInMapIfNotNull(data, "userId", userId);
}
// Current tenant
if (!data.containsKey(Fields.TENANT_ID) && processDefinitionId != null) {
ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(processDefinitionId);
if (processDefinition != null && !ProcessEngineConfigurationImpl.NO_TENANT_ID.equals(processDefinition.getTenantId())) {
putInMapIfNotNull(data, Fields.TENANT_ID, processDefinition.getTenantId());
}
}
try {
eventLogEntry.setData(objectMapper.writeValueAsBytes(data));
} catch (Exception e) {
logger.warn("Could not serialize event data. Data will not be written to the database", e);
}
return eventLogEntry;
}
代码示例来源:origin: org.activiti/activiti-engine
public void setAuthenticatedUserId(String authenticatedUserId) {
Authentication.setAuthenticatedUserId(authenticatedUserId);
}
代码示例来源:origin: Activiti/Activiti
@Override
public ExecutionEntity createSubprocessInstance(ProcessDefinition processDefinition, ExecutionEntity superExecutionEntity, String businessKey) {
ExecutionEntity subProcessInstance = executionDataManager.create();
inheritCommonProperties(superExecutionEntity, subProcessInstance);
subProcessInstance.setProcessDefinitionId(processDefinition.getId());
subProcessInstance.setProcessDefinitionKey(processDefinition.getKey());
subProcessInstance.setSuperExecution(superExecutionEntity);
subProcessInstance.setRootProcessInstanceId(superExecutionEntity.getRootProcessInstanceId());
subProcessInstance.setScope(true); // process instance is always a scope for all child executions
subProcessInstance.setStartUserId(Authentication.getAuthenticatedUserId());
subProcessInstance.setBusinessKey(businessKey);
// Store in database
insert(subProcessInstance, false);
if (logger.isDebugEnabled()) {
logger.debug("Child execution {} created with super execution {}", subProcessInstance, superExecutionEntity.getId());
}
subProcessInstance.setProcessInstanceId(subProcessInstance.getId());
superExecutionEntity.setSubProcessInstance(subProcessInstance);
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_CREATED, subProcessInstance));
}
return subProcessInstance;
}
代码示例来源:origin: org.activiti.cloud/activiti-cloud-services-identity-keycloak
protected void setAuthenticatedUserId(String userId) {
org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(userId);
}
}
代码示例来源:origin: Activiti/Activiti
@Override
public void createAttachmentComment(String taskId, String processInstanceId, String attachmentName, boolean create) {
if (isHistoryEnabled()) {
String userId = Authentication.getAuthenticatedUserId();
CommentEntity comment = getCommentEntityManager().create();
comment.setUserId(userId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(getClock().getCurrentTime());
comment.setTaskId(taskId);
comment.setProcessInstanceId(processInstanceId);
if (create) {
comment.setAction(Event.ACTION_ADD_ATTACHMENT);
} else {
comment.setAction(Event.ACTION_DELETE_ATTACHMENT);
}
comment.setMessage(attachmentName);
getCommentEntityManager().insert(comment);
}
}
代码示例来源:origin: org.activiti/activiti-explorer
public void logout(LoggedInUser userToLogout) {
// Clear activiti authentication context
Authentication.setAuthenticatedUserId(null);
}
代码示例来源:origin: Activiti/Activiti
protected void executeTaskComplete(CommandContext commandContext, TaskEntity taskEntity, Map<String, Object> variables, boolean localScope) {
// Task complete logic
if (taskEntity.getDelegationState() != null && taskEntity.getDelegationState().equals(DelegationState.PENDING)) {
throw new ActivitiException("A delegated task cannot be completed, but should be resolved instead.");
}
commandContext.getProcessEngineConfiguration().getListenerNotificationHelper().executeTaskListeners(taskEntity, TaskListener.EVENTNAME_COMPLETE);
if (Authentication.getAuthenticatedUserId() != null && taskEntity.getProcessInstanceId() != null) {
ExecutionEntity processInstanceEntity = commandContext.getExecutionEntityManager().findById(taskEntity.getProcessInstanceId());
commandContext.getIdentityLinkEntityManager().involveUser(processInstanceEntity, Authentication.getAuthenticatedUserId(),IdentityLinkType.PARTICIPANT);
}
ActivitiEventDispatcher eventDispatcher = Context.getProcessEngineConfiguration().getEventDispatcher();
if (eventDispatcher.isEnabled()) {
if (variables != null) {
eventDispatcher.dispatchEvent(ActivitiEventBuilder.createEntityWithVariablesEvent(ActivitiEventType.TASK_COMPLETED, taskEntity, variables, localScope));
} else {
eventDispatcher.dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.TASK_COMPLETED, taskEntity));
}
}
commandContext.getTaskEntityManager().deleteTask(taskEntity, null, false, false);
// Continue process (if not a standalone task)
if (taskEntity.getExecutionId() != null) {
ExecutionEntity executionEntity = commandContext.getExecutionEntityManager().findById(taskEntity.getExecutionId());
Context.getAgenda().planTriggerExecutionOperation(executionEntity);
}
}
代码示例来源:origin: org.flowable/flowable5-engine
@Override
public void setAuthenticatedUserId(String authenticatedUserId) {
Authentication.setAuthenticatedUserId(authenticatedUserId);
}
代码示例来源:origin: Activiti/Activiti
String userId = Authentication.getAuthenticatedUserId();
CommentEntity comment = commandContext.getCommentEntityManager().create();
comment.setUserId(userId);
代码示例来源:origin: com.github.hongframework/hframe-workflow
public void logout(LoggedInUser userTologout) {
Authentication.setAuthenticatedUserId(null);
}
代码示例来源:origin: Activiti/Activiti
@Override
public void createIdentityLinkComment(String taskId, String userId, String groupId, String type, boolean create, boolean forceNullUserId) {
if (isHistoryEnabled()) {
String authenticatedUserId = Authentication.getAuthenticatedUserId();
CommentEntity comment = getCommentEntityManager().create();
comment.setUserId(authenticatedUserId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(getClock().getCurrentTime());
comment.setTaskId(taskId);
if (userId != null || forceNullUserId) {
if (create) {
comment.setAction(Event.ACTION_ADD_USER_LINK);
} else {
comment.setAction(Event.ACTION_DELETE_USER_LINK);
}
comment.setMessage(new String[] { userId, type });
} else {
if (create) {
comment.setAction(Event.ACTION_ADD_GROUP_LINK);
} else {
comment.setAction(Event.ACTION_DELETE_GROUP_LINK);
}
comment.setMessage(new String[] { groupId, type });
}
getCommentEntityManager().insert(comment);
}
}
代码示例来源:origin: com.bbossgroups.activiti/activiti-engine
public void setAuthenticatedUserId(String authenticatedUserId) {
Authentication.setAuthenticatedUserId(authenticatedUserId);
}
代码示例来源:origin: Activiti/Activiti
@Override
public void createProcessInstanceIdentityLinkComment(String processInstanceId, String userId, String groupId, String type, boolean create, boolean forceNullUserId) {
if (isHistoryEnabled()) {
String authenticatedUserId = Authentication.getAuthenticatedUserId();
CommentEntity comment = getCommentEntityManager().create();
comment.setUserId(authenticatedUserId);
comment.setType(CommentEntity.TYPE_EVENT);
comment.setTime(getClock().getCurrentTime());
comment.setProcessInstanceId(processInstanceId);
if (userId != null || forceNullUserId) {
if (create) {
comment.setAction(Event.ACTION_ADD_USER_LINK);
} else {
comment.setAction(Event.ACTION_DELETE_USER_LINK);
}
comment.setMessage(new String[] { userId, type });
} else {
if (create) {
comment.setAction(Event.ACTION_ADD_GROUP_LINK);
} else {
comment.setAction(Event.ACTION_DELETE_GROUP_LINK);
}
comment.setMessage(new String[] { groupId, type });
}
getCommentEntityManager().insert(comment);
}
}
代码示例来源:origin: org.activiti/activiti-explorer
public void onRequestEnd(HttpServletRequest request, HttpServletResponse response) {
// Clean up thread-local app
current.remove();
// Clear authentication context
Authentication.setAuthenticatedUserId(null);
// Callback to the login handler
loginHandler.onRequestEnd(request, response);
if(!isRunning() && !invalidatedSession) {
// Clear the session context, the application has been closed during this request, otherwise
// the application will be stuck on the spring-session scope and will be reused on the next
// request, which will lead to problems
if(request.getSession(false) != null) {
request.getSession().invalidate();
invalidatedSession = true;
}
}
}
代码示例来源:origin: Activiti/Activiti
String authenticatedUserId = Authentication.getAuthenticatedUserId();
代码示例来源:origin: Activiti/activiti-examples
org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(username);
代码示例来源:origin: bluejoe2008/openwebflow
/**
* 后加签
*/
@Override
public ActivityImpl[] insertTasksAfter(String targetTaskDefinitionKey, String... assignees) throws Exception
{
List<String> assigneeList = new ArrayList<String>();
assigneeList.add(Authentication.getAuthenticatedUserId());
assigneeList.addAll(CollectionUtils.arrayToList(assignees));
String[] newAssignees = assigneeList.toArray(new String[0]);
ActivityImpl prototypeActivity = ProcessDefinitionUtils.getActivity(_processEngine, _processDefinition.getId(),
targetTaskDefinitionKey);
return cloneAndMakeChain(targetTaskDefinitionKey, prototypeActivity.getOutgoingTransitions().get(0)
.getDestination().getId(), newAssignees);
}
内容来源于网络,如有侵权,请联系作者删除!