当前位置: 首页>>代码示例>>Java>>正文


Java Authentication.getAuthenticatedUserId方法代码示例

本文整理汇总了Java中org.activiti.engine.impl.identity.Authentication.getAuthenticatedUserId方法的典型用法代码示例。如果您正苦于以下问题:Java Authentication.getAuthenticatedUserId方法的具体用法?Java Authentication.getAuthenticatedUserId怎么用?Java Authentication.getAuthenticatedUserId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.impl.identity.Authentication的用法示例。


在下文中一共展示了Authentication.getAuthenticatedUserId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
public Object execute(CommandContext commandContext) {
    TaskEntity taskEntity = commandContext.getTaskEntityManager()
            .findTaskById(taskId);

    // taskEntity.fireEvent(TaskListener.EVENTNAME_COMPLETE);
    if ((Authentication.getAuthenticatedUserId() != null)
            && (taskEntity.getProcessInstanceId() != null)) {
        taskEntity.getProcessInstance().involveUser(
                Authentication.getAuthenticatedUserId(),
                IdentityLinkType.PARTICIPANT);
    }

    Context.getCommandContext().getTaskEntityManager()
            .deleteTask(taskEntity, comment, false);

    if (taskEntity.getExecutionId() != null) {
        ExecutionEntity execution = taskEntity.getExecution();
        execution.removeTask(taskEntity);

        // execution.signal(null, null);
    }

    return null;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:25,代码来源:DeleteTaskWithCommentCmd.java

示例2: HistoricProcessInstanceEntity

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
public HistoricProcessInstanceEntity(ExecutionEntity processInstance) {
    id = processInstance.getId();
    processInstanceId = processInstance.getId();
    businessKey = processInstance.getBusinessKey();
    processDefinitionId = processInstance.getProcessDefinitionId();
    processDefinitionKey = processInstance.getProcessDefinitionKey();
    processDefinitionName = processInstance.getProcessDefinitionName();
    processDefinitionVersion = processInstance.getProcessDefinitionVersion();
    deploymentId = processInstance.getDeploymentId();
    startTime = Context.getProcessEngineConfiguration().getClock().getCurrentTime();
    startUserId = Authentication.getAuthenticatedUserId();
    startActivityId = processInstance.getActivityId();
    superProcessInstanceId = processInstance.getSuperExecution() != null ? processInstance.getSuperExecution().getProcessInstanceId() : null;

    // Inherit tenant id (if applicable)
    if (processInstance.getTenantId() != null) {
        tenantId = processInstance.getTenantId();
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:20,代码来源:HistoricProcessInstanceEntity.java

示例3: createAttachmentComment

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
@Override
public void createAttachmentComment(String taskId, String processInstanceId, String attachmentName, boolean create) {
    if (isHistoryEnabled()) {
        String userId = Authentication.getAuthenticatedUserId();
        CommentEntity comment = new CommentEntity();
        comment.setUserId(userId);
        comment.setType(CommentEntity.TYPE_EVENT);
        comment.setTime(Context.getProcessEngineConfiguration().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);
        getSession(CommentEntityManager.class).insert(comment);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:20,代码来源:DefaultHistoryManager.java

示例4: execute

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
public Object execute(CommandContext commandContext) {
  String userId = Authentication.getAuthenticatedUserId();
  CommentEntity comment = new CommentEntity();
  comment.setUserId(userId);
  comment.setType(CommentEntity.TYPE_COMMENT);
  comment.setTime(ClockUtil.getCurrentTime());
  comment.setTaskId(taskId);
  comment.setProcessInstanceId(processInstanceId);
  comment.setAction(Event.ACTION_ADD_COMMENT);
  
  String eventMessage = message.replaceAll("\\s+", " ");
  if (eventMessage.length()>163) {
    eventMessage = eventMessage.substring(0, 160)+"...";
  }
  comment.setMessage(eventMessage);
  
  comment.setFullMessage(message);
  
  commandContext
    .getCommentManager()
    .insert(comment);
  
  return null;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:25,代码来源:AddCommentCmd.java

示例5: execute

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
public Object execute(CommandContext commandContext) {
  AttachmentEntity attachment = commandContext
    .getDbSqlSession()
    .selectById(AttachmentEntity.class, attachmentId);

  commandContext
    .getDbSqlSession()
    .delete(AttachmentEntity.class, attachmentId);
  
  if (attachment.getTaskId()!=null) {
    CommentManager commentManager = commandContext.getCommentManager();
    if (commentManager.isHistoryEnabled()) {
      String authenticatedUserId = Authentication.getAuthenticatedUserId();
      CommentEntity comment = new CommentEntity();
      comment.setUserId(authenticatedUserId);
      comment.setType(CommentEntity.TYPE_EVENT);
      comment.setTime(ClockUtil.getCurrentTime());
      comment.setAction(Event.ACTION_DELETE_ATTACHMENT);
      comment.setMessage(attachment.getName());
      comment.setTaskId(attachment.getTaskId());
      commentManager.insert(comment);
    }
  }

  return null;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:27,代码来源:DeleteAttachmentCmd.java

示例6: complete

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
public void complete() {
  fireEvent(TaskListener.EVENTNAME_COMPLETE);

  if (Authentication.getAuthenticatedUserId() != null && processInstanceId != null) {
    getProcessInstance().involveUser(Authentication.getAuthenticatedUserId(), IdentityLinkType.PARTICIPANT);
  }
  
  Context
    .getCommandContext()
    .getTaskEntityManager()
    .deleteTask(this, TaskEntity.DELETE_REASON_COMPLETED, false);
  
  if (executionId!=null) {
    ExecutionEntity execution = getExecution();
    execution.removeTask(this);
    execution.signal(null, null);
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:19,代码来源:TaskEntity.java

示例7: createAttachmentComment

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
/**
 * Creates a new comment to indicate a new attachment has been created or deleted, 
 * if history is enabled. 
 */
public void createAttachmentComment(String taskId, String processInstanceId, String attachmentName, boolean create) {
  if (isHistoryEnabled()) {
    String userId = Authentication.getAuthenticatedUserId();
    CommentEntity comment = new CommentEntity();
    comment.setUserId(userId);
    comment.setType(CommentEntity.TYPE_EVENT);
    comment.setTime(ClockUtil.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);
    getSession(CommentEntityManager.class).insert(comment);
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:23,代码来源:HistoryManager.java

示例8: setDelegateTask

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
public HumanTaskBuilder setDelegateTask(DelegateTask delegateTask) {
    humanTaskDto.setBusinessKey(delegateTask.getExecution()
            .getProcessBusinessKey());
    humanTaskDto.setName(delegateTask.getName());
    humanTaskDto.setDescription(delegateTask.getDescription());

    humanTaskDto.setCode(delegateTask.getTaskDefinitionKey());
    humanTaskDto.setAssignee(delegateTask.getAssignee());
    humanTaskDto.setOwner(delegateTask.getOwner());
    humanTaskDto.setDelegateStatus("none");
    humanTaskDto.setPriority(delegateTask.getPriority());
    humanTaskDto.setCreateTime(new Date());
    humanTaskDto.setDuration(delegateTask.getDueDate() + "");
    humanTaskDto.setSuspendStatus("none");
    humanTaskDto.setCategory(delegateTask.getCategory());
    humanTaskDto.setForm(delegateTask.getFormKey());
    humanTaskDto.setTaskId(delegateTask.getId());
    humanTaskDto.setExecutionId(delegateTask.getExecutionId());
    humanTaskDto.setProcessInstanceId(delegateTask.getProcessInstanceId());
    humanTaskDto.setProcessDefinitionId(delegateTask
            .getProcessDefinitionId());
    humanTaskDto.setTenantId(delegateTask.getTenantId());
    humanTaskDto.setStatus("active");
    humanTaskDto.setCatalog(HumanTaskConstants.CATALOG_NORMAL);

    ExecutionEntity executionEntity = (ExecutionEntity) delegateTask
            .getExecution();
    ExecutionEntity processInstance = executionEntity.getProcessInstance();
    humanTaskDto.setPresentationSubject(processInstance.getName());

    String userId = Authentication.getAuthenticatedUserId();
    humanTaskDto.setProcessStarter(userId);

    return this;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:36,代码来源:HumanTaskBuilder.java

示例9: determineCurrentUser

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
public static String determineCurrentUser(DelegateExecution context, StepLogger stepLogger) throws SLException {
    String userId = Authentication.getAuthenticatedUserId();
    String previousUser = (String) context.getVariable(Constants.VAR_USER);
    // Determine the current user
    if (userId != null && !userId.equals(previousUser)) {
        stepLogger.debug(Messages.AUTHENTICATED_USER_ID, userId);
        stepLogger.debug(Messages.PREVIOUS_USER, previousUser);
    }
    if (userId == null) {
        // If the authenticated user cannot be determined,
        // use the user saved by the previous service task
        userId = previousUser;
        if (userId == null) {
            // If there is no previous user, this must be the first service task
            // Use the process initiator in this case
            userId = (String) context.getVariable(Constants.PARAM_INITIATOR);
            stepLogger.debug(Messages.PROCESS_INITIATOR, userId);
            if (userId == null) {
                throw new SLException(Messages.CANT_DETERMINE_CURRENT_USER);
            }
        }
    }
    // Set the current user in the context for use by later service tasks
    context.setVariable(Constants.VAR_USER, userId);

    return userId;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:28,代码来源:StepsUtil.java

示例10: complete

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
public void complete(Map variablesMap, boolean localScope, boolean fireEvents) {

    if (getDelegationState() != null && getDelegationState() == DelegationState.PENDING) {
        throw new ActivitiException("A delegated task cannot be completed, but should be resolved instead.");
    }

    if (fireEvents) {
        fireEvent(TaskListener.EVENTNAME_COMPLETE);
    }

    if (Authentication.getAuthenticatedUserId() != null && processInstanceId != null) {
        getProcessInstance().involveUser(Authentication.getAuthenticatedUserId(), IdentityLinkType.PARTICIPANT);
    }

    if (Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled() && fireEvents) {
        Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
                ActivitiEventBuilder.createEntityWithVariablesEvent(FlowableEngineEventType.TASK_COMPLETED, this, variablesMap, localScope));
    }

    Context
            .getCommandContext()
            .getTaskEntityManager()
            .deleteTask(this, TaskEntity.DELETE_REASON_COMPLETED, false);

    if (executionId != null) {
        ExecutionEntity execution = getExecution();
        execution.removeTask(this);
        execution.signal(null, null);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:32,代码来源:TaskEntity.java

示例11: getValue

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
@Override
public Object getValue(ELContext context, Object base, Object property) {

    if (base == null) {
        String variable = (String) property; // according to javadoc, can only be a String

        if ((EXECUTION_KEY.equals(property) && variableScope instanceof ExecutionEntity)
                || (TASK_KEY.equals(property) && variableScope instanceof TaskEntity)) {
            context.setPropertyResolved(true);
            return variableScope;
        } else if (EXECUTION_KEY.equals(property) && variableScope instanceof TaskEntity) {
            context.setPropertyResolved(true);
            return ((TaskEntity) variableScope).getExecution();
        } else if (LOGGED_IN_USER_KEY.equals(property)) {
            context.setPropertyResolved(true);
            return Authentication.getAuthenticatedUserId();
        } else {
            if (variableScope.hasVariable(variable)) {
                context.setPropertyResolved(true); // if not set, the next elResolver in the CompositeElResolver will be called
                return variableScope.getVariable(variable);
            }
        }
    }

    // property resolution (eg. bean.value) will be done by the BeanElResolver (part of the CompositeElResolver)
    // It will use the bean resolved in this resolver as base.

    return null;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:30,代码来源:VariableScopeElResolver.java

示例12: createIdentityLinkComment

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
@Override
public void createIdentityLinkComment(String taskId, String userId, String groupId, String type, boolean create, boolean forceNullUserId) {
    if (isHistoryEnabled()) {
        String authenticatedUserId = Authentication.getAuthenticatedUserId();
        CommentEntity comment = new CommentEntity();
        comment.setUserId(authenticatedUserId);
        comment.setType(CommentEntity.TYPE_EVENT);
        comment.setTime(Context.getProcessEngineConfiguration().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 });
        }
        getSession(CommentEntityManager.class).insert(comment);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:28,代码来源:DefaultHistoryManager.java

示例13: createProcessInstanceIdentityLinkComment

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
@Override
public void createProcessInstanceIdentityLinkComment(String processInstanceId, String userId, String groupId, String type, boolean create, boolean forceNullUserId) {
    if (isHistoryEnabled()) {
        String authenticatedUserId = Authentication.getAuthenticatedUserId();
        CommentEntity comment = new CommentEntity();
        comment.setUserId(authenticatedUserId);
        comment.setType(CommentEntity.TYPE_EVENT);
        comment.setTime(Context.getProcessEngineConfiguration().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 });
        }
        getSession(CommentEntityManager.class).insert(comment);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:28,代码来源:DefaultHistoryManager.java

示例14: HistoricProcessInstanceEntity

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
public HistoricProcessInstanceEntity(ExecutionEntity processInstance) {
  id = processInstance.getId();
  processInstanceId = processInstance.getId();
  businessKey = processInstance.getBusinessKey();
  processDefinitionId = processInstance.getProcessDefinitionId();
  startTime = ClockUtil.getCurrentTime();
  startUserId = Authentication.getAuthenticatedUserId();
  startActivityId = processInstance.getActivityId();
  superProcessInstanceId = processInstance.getSuperExecution() != null ? processInstance.getSuperExecution().getProcessInstanceId() : null;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:11,代码来源:HistoricProcessInstanceEntity.java

示例15: getValue

import org.activiti.engine.impl.identity.Authentication; //导入方法依赖的package包/类
public Object getValue(ELContext context, Object base, Object property)  {
  
  if (base == null) {
    String variable = (String) property; // according to javadoc, can only be a String
    
    if( (EXECUTION_KEY.equals(property) && variableScope instanceof ExecutionEntity)
            || (TASK_KEY.equals(property) && variableScope instanceof TaskEntity) ) {
      context.setPropertyResolved(true);
      return variableScope;
    } else if (EXECUTION_KEY.equals(property) && variableScope instanceof TaskEntity) {
      context.setPropertyResolved(true);
      return ((TaskEntity) variableScope).getExecution();
    } else if(LOGGED_IN_USER_KEY.equals(property)){
      context.setPropertyResolved(true);
      return Authentication.getAuthenticatedUserId();
    } else {
      if (variableScope.hasVariable(variable)) {
        context.setPropertyResolved(true); // if not set, the next elResolver in the CompositeElResolver will be called
        return variableScope.getVariable(variable);
      }        
    }
  }
  
  // property resolution (eg. bean.value) will be done by the BeanElResolver (part of the CompositeElResolver)
  // It will use the bean resolved in this resolver as base.
  
  return null;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:29,代码来源:VariableScopeElResolver.java


注:本文中的org.activiti.engine.impl.identity.Authentication.getAuthenticatedUserId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。