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


Java Expression类代码示例

本文整理汇总了Java中org.activiti.engine.delegate.Expression的典型用法代码示例。如果您正苦于以下问题:Java Expression类的具体用法?Java Expression怎么用?Java Expression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getNextClaim

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
@Override
public Map<String, List<String>> getNextClaim(String procDefId, String activityId) {
    List<TaskDefinition> taskDefinitions = getNextActivities(procDefId, activityId);
    Map<String, List<String>> map = new HashMap<>();
    for (TaskDefinition taskDefinition : taskDefinitions) {
        List<String> list = new ArrayList<>();
        if (taskDefinition.getAssigneeExpression() != null) {
            list.add(taskDefinition.getAssigneeExpression().getExpressionText());
        } else if (taskDefinition.getCandidateUserIdExpressions() != null) {
            for (Expression expression : taskDefinition.getCandidateUserIdExpressions()) {
                list.add(expression.getExpressionText());
            }
        }
        if (taskDefinition.getNameExpression() != null) {
            map.put(taskDefinition.getNameExpression().getExpressionText(), list);
        } else {
            map.put(taskDefinition.getKey(), list);
        }
    }
    return map;
}
 
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:22,代码来源:BpmActivityServiceImp.java

示例2: packageSingleActivitiInfo

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
/**
 * 封装输出信息,包括:当前节点的X、Y坐标、变量信息、任务类型、任务描述
 * @param activity
 * @param processInstance
 * @param currentActiviti
 * @return
 */
private Map<String, Object> packageSingleActivitiInfo(ActivityImpl activity, ProcessInstance processInstance,
		boolean currentActiviti) throws Exception {
	Map<String, Object> vars = new HashMap<String, Object>();
	Map<String, Object> activityInfo = new HashMap<String, Object>();
	activityInfo.put("currentActiviti", currentActiviti);
	setPosition(activity, activityInfo);
	setWidthAndHeight(activity, activityInfo);

	Map<String, Object> properties = activity.getProperties();
	vars.put("节点名称", properties.get("name"));
	vars.put("任务类型", ActUtils.parseToZhType(properties.get("type").toString()));

	ActivityBehavior activityBehavior = activity.getActivityBehavior();
	logger.debug("activityBehavior={}", activityBehavior);
	if (activityBehavior instanceof UserTaskActivityBehavior) {

		Task currentTask = null;

		// 当前节点的task
		if (currentActiviti) {
			currentTask = getCurrentTaskInfo(processInstance);
		}

		// 当前任务的分配角色
		UserTaskActivityBehavior userTaskActivityBehavior = (UserTaskActivityBehavior) activityBehavior;
		TaskDefinition taskDefinition = userTaskActivityBehavior.getTaskDefinition();
		Set<Expression> candidateGroupIdExpressions = taskDefinition.getCandidateGroupIdExpressions();
		if (!candidateGroupIdExpressions.isEmpty()) {

			// 任务的处理角色
			setTaskGroup(vars, candidateGroupIdExpressions);

			// 当前处理人
			if (currentTask != null) {
				setCurrentTaskAssignee(vars, currentTask);
			}
		}
	}

	vars.put("节点说明", properties.get("documentation"));

	String description = activity.getProcessDefinition().getDescription();
	vars.put("描述", description);

	logger.debug("trace variables: {}", vars);
	activityInfo.put("vars", vars);
	return activityInfo;
}
 
开发者ID:EleTeam,项目名称:Shop-for-JavaWeb,代码行数:56,代码来源:ActTaskService.java

示例3: getExpressionVariableAsInteger

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
/**
 * Gets an expression variable from the execution as Integer. This method will throw IllegalArgumentException if it is not a valid integer value and is a
 * required variable.
 *
 * @param expression the expression variable to get.
 * @param execution the execution that contains the variable value.
 * @param variableName the variable name
 * @param isRequired whether this variable is required
 *
 * @return the integer variable value.
 * @throws IllegalArgumentException if not a valid integer value.
 */
public Integer getExpressionVariableAsInteger(Expression expression, DelegateExecution execution, String variableName, boolean isRequired)
    throws IllegalArgumentException
{
    Integer variableInteger = null;

    String variableString = getExpressionVariableAsString(expression, execution);

    if (isRequired && StringUtils.isBlank(variableString))
    {
        throw new IllegalArgumentException("\"" + variableName + "\" must be specified.");
    }
    if (isRequired || StringUtils.isNotBlank(variableString))
    {
        try
        {
            variableInteger = Integer.parseInt(getExpressionVariableAsString(expression, execution));
        }
        catch (Exception ex)
        {
            throw new IllegalArgumentException("\"" + variableName + "\" must be a valid integer value.", ex);
        }
    }
    return variableInteger;
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:37,代码来源:ActivitiHelper.java

示例4: testGetExpressionVariableAsBooleanInvalidValue

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
@Test
public void testGetExpressionVariableAsBooleanInvalidValue()
{
    // Mock dependencies.
    Expression expression = mock(Expression.class);
    DelegateExecution execution = mock(DelegateExecution.class);
    when(expression.getValue(execution)).thenReturn(INVALID_VALUE);

    // Try to call the method under test.
    try
    {
        activitiHelper.getExpressionVariableAsBoolean(expression, execution, VARIABLE_NAME, NO_VARIABLE_REQUIRED, NO_BOOLEAN_DEFAULT_VALUE);
        fail();
    }
    catch (IllegalArgumentException e)
    {
        assertEquals(String.format("\"%s\" must be a valid boolean value of \"true\" or \"false\".", VARIABLE_NAME), e.getMessage());
    }
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:20,代码来源:ActivitiHelperTest.java

示例5: testGetExpressionVariableAsBooleanRequiredBlankValue

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
@Test
public void testGetExpressionVariableAsBooleanRequiredBlankValue()
{
    // Mock dependencies.
    Expression expression = mock(Expression.class);
    DelegateExecution execution = mock(DelegateExecution.class);
    when(expression.getValue(execution)).thenReturn(BLANK_TEXT);

    // Try to call the method under test.
    try
    {
        activitiHelper.getExpressionVariableAsBoolean(expression, execution, VARIABLE_NAME, VARIABLE_REQUIRED, NO_BOOLEAN_DEFAULT_VALUE);
        fail();
    }
    catch (IllegalArgumentException e)
    {
        assertEquals(String.format("\"%s\" must be specified.", VARIABLE_NAME), e.getMessage());
    }
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:20,代码来源:ActivitiHelperTest.java

示例6: testGetExpressionVariableAsIntegerInvalidValue

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
@Test
public void testGetExpressionVariableAsIntegerInvalidValue()
{
    // Mock dependencies.
    Expression expression = mock(Expression.class);
    DelegateExecution execution = mock(DelegateExecution.class);
    when(expression.getValue(execution)).thenReturn(INVALID_VALUE);

    // Try to call the method under test.
    try
    {
        activitiHelper.getExpressionVariableAsInteger(expression, execution, VARIABLE_NAME, VARIABLE_REQUIRED);
        fail();
    }
    catch (IllegalArgumentException e)
    {
        assertEquals(String.format("\"%s\" must be a valid integer value.", VARIABLE_NAME), e.getMessage());
    }
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:20,代码来源:ActivitiHelperTest.java

示例7: testGetExpressionVariableAsIntegerRequiredBlankValue

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
@Test
public void testGetExpressionVariableAsIntegerRequiredBlankValue()
{
    // Mock dependencies.
    Expression expression = mock(Expression.class);
    DelegateExecution execution = mock(DelegateExecution.class);
    when(expression.getValue(execution)).thenReturn(BLANK_TEXT);

    // Try to call the method under test.
    try
    {
        activitiHelper.getExpressionVariableAsInteger(expression, execution, VARIABLE_NAME, VARIABLE_REQUIRED);
        fail();
    }
    catch (IllegalArgumentException e)
    {
        assertEquals(String.format("\"%s\" must be specified.", VARIABLE_NAME), e.getMessage());
    }
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:20,代码来源:ActivitiHelperTest.java

示例8: testGetRequiredExpressionVariableAsStringBlankValue

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
@Test
public void testGetRequiredExpressionVariableAsStringBlankValue()
{
    // Mock dependencies.
    Expression expression = mock(Expression.class);
    DelegateExecution execution = mock(DelegateExecution.class);
    when(expression.getValue(execution)).thenReturn(BLANK_TEXT);

    // Try to call the method under test.
    try
    {
        activitiHelper.getRequiredExpressionVariableAsString(expression, execution, VARIABLE_NAME);
        fail();
    }
    catch (IllegalArgumentException e)
    {
        assertEquals(String.format("\"%s\" must be specified.", VARIABLE_NAME), e.getMessage());
    }
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:20,代码来源:ActivitiHelperTest.java

示例9: parseDataInputAssociation

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
protected AbstractDataAssociation parseDataInputAssociation(Element dataAssociationElement) {
  String sourceRef = dataAssociationElement.element("sourceRef").getText();
  String targetRef = dataAssociationElement.element("targetRef").getText();

  List<Element> assignments = dataAssociationElement.elements("assignment");
  if (assignments.isEmpty()) {
    return new MessageImplicitDataInputAssociation(sourceRef, targetRef);
  } else {
    SimpleDataInputAssociation dataAssociation = new SimpleDataInputAssociation(sourceRef, targetRef);

    for (Element assigmentElement : dataAssociationElement.elements("assignment")) {
      Expression from = this.expressionManager.createExpression(assigmentElement.element("from").getText());
      Expression to = this.expressionManager.createExpression(assigmentElement.element("to").getText());
      Assignment assignment = new Assignment(from, to);
      dataAssociation.addAssignment(assignment);
    }

    return dataAssociation;
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:BpmnParse.java

示例10: parseTimer

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
private TimerDeclarationImpl parseTimer(Element timerEventDefinition, ScopeImpl timerActivity, String jobHandlerType) {
  // TimeDate
  TimerDeclarationType type = TimerDeclarationType.DATE;
  Expression expression = parseExpression(timerEventDefinition, "timeDate");

  // TimeCycle
  if (expression == null) {
    type = TimerDeclarationType.CYCLE;
    expression = parseExpression(timerEventDefinition, "timeCycle");
  }

  // TimeDuration
  if (expression == null) {
    type = TimerDeclarationType.DURATION;
    expression = parseExpression(timerEventDefinition, "timeDuration");
  }

  // Parse the timer declaration
  // TODO move the timer declaration into the bpmn activity or next to the
  // TimerSession
  TimerDeclarationImpl timerDeclaration = new TimerDeclarationImpl(expression, type, jobHandlerType);
  timerDeclaration.setJobHandlerConfiguration(timerActivity.getId());
  return timerDeclaration;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:25,代码来源:BpmnParse.java

示例11: parseDataInputAssociation

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
protected AbstractDataAssociation parseDataInputAssociation(Element dataAssociationElement) {
  String sourceRef = dataAssociationElement.element("sourceRef").getText();
  String targetRef = dataAssociationElement.element("targetRef").getText();

  List<Element> assignments = dataAssociationElement.elements("assignment");
  if (assignments.isEmpty()) {
    MessageImplicitDataInputAssociation messageImplicitDataInputAssociation = new MessageImplicitDataInputAssociation(sourceRef, targetRef);
    addDataAssociationToList(dataAssociationElement, messageImplicitDataInputAssociation);
    return messageImplicitDataInputAssociation;
  } else {
    SimpleDataInputAssociation dataAssociation = new SimpleDataInputAssociation(sourceRef, targetRef);

    for (Element assigmentElement : dataAssociationElement.elements("assignment")) {
      Expression from = this.expressionManager.createExpression(assigmentElement.element("from").getText());
      Expression to = this.expressionManager.createExpression(assigmentElement.element("to").getText());
      Assignment assignment = new Assignment(from, to);
      dataAssociation.addAssignment(assignment);
    }
    addDataAssociationToList(dataAssociationElement, dataAssociation);
    return dataAssociation;
  }
}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:23,代码来源:BpmnParse.java

示例12: createDataInputAssociation

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
public AbstractDataAssociation createDataInputAssociation(BpmnParse bpmnParse, DataAssociation dataAssociationElement) {
  if (StringUtils.isEmpty(dataAssociationElement.getTargetRef())) {
    bpmnParse.getBpmnModel().addProblem("targetRef is required", dataAssociationElement);
  }
  
  if (dataAssociationElement.getAssignments().isEmpty()) {
    return new MessageImplicitDataInputAssociation(dataAssociationElement.getSourceRef(), dataAssociationElement.getTargetRef());
  } else {
    SimpleDataInputAssociation dataAssociation = new SimpleDataInputAssociation(
        dataAssociationElement.getSourceRef(), dataAssociationElement.getTargetRef());

    for (org.activiti.bpmn.model.Assignment assigmentElement : dataAssociationElement.getAssignments()) {
      if (StringUtils.isNotEmpty(assigmentElement.getFrom()) && StringUtils.isNotEmpty(assigmentElement.getTo())) {
        Expression from = bpmnParse.getExpressionManager().createExpression(assigmentElement.getFrom());
        Expression to = bpmnParse.getExpressionManager().createExpression(assigmentElement.getTo());
        Assignment assignment = new Assignment(from, to);
        dataAssociation.addAssignment(assignment);
      }
    }
    return dataAssociation;
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:23,代码来源:AbstractExternalInvocationBpmnParseHandler.java

示例13: addAuthorizationsFromIterator

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
private void addAuthorizationsFromIterator(Set<Expression> exprSet, ProcessDefinitionEntity processDefinition, ExprType exprType) {
  if (exprSet != null) {
    Iterator<Expression> iterator = exprSet.iterator();
    while (iterator.hasNext()) {
      Expression expr = (Expression) iterator.next();
      IdentityLinkEntity identityLink = new IdentityLinkEntity();
      identityLink.setProcessDef(processDefinition);
      if (exprType.equals(ExprType.USER)) {
         identityLink.setUserId(expr.toString());
      } else if (exprType.equals(ExprType.GROUP)) {
        identityLink.setGroupId(expr.toString());
      }
      identityLink.setType(IdentityLinkType.CANDIDATE);
      identityLink.insert();
    }
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:18,代码来源:BpmnDeployer.java

示例14: getExpressionString

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
protected String getExpressionString(Expression expression, VariableScope variableScope) 
{
    if (expression != null) 
    {
        return (String) expression.getValue(variableScope);
    }
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:ConvertDateToISO8601.java

示例15: doSkip

import org.activiti.engine.delegate.Expression; //导入依赖的package包/类
public void doSkip(DelegateTask delegateTask) {
    delegateTask.getExecution().setVariableLocal(
            "_ACTIVITI_SKIP_EXPRESSION_ENABLED", true);

    TaskDefinition taskDefinition = ((TaskEntity) delegateTask)
            .getTaskDefinition();
    ExpressionManager expressionManager = Context
            .getProcessEngineConfiguration().getExpressionManager();
    Expression expression = expressionManager
            .createExpression("${_ACTIVITI_SKIP_EXPRESSION_ENABLED}");
    taskDefinition.setSkipExpression(expression);
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:13,代码来源:SkipEventListener.java


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