本文整理汇总了Java中org.activiti.engine.impl.pvm.process.ActivityImpl.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java ActivityImpl.getProperty方法的具体用法?Java ActivityImpl.getProperty怎么用?Java ActivityImpl.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.pvm.process.ActivityImpl
的用法示例。
在下文中一共展示了ActivityImpl.getProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
/**
* 退回流程.
*
* @return 0-退回成功 1-流程结束 2-下一结点已经通过,不能退回
*/
public Integer execute(CommandContext commandContext) {
// 获得任务
TaskEntity taskEntity = this.findTask(commandContext);
// 找到想要回退到的节点
ActivityImpl targetActivity = this.findTargetActivity(commandContext,
taskEntity);
logger.info("rollback to {}", this.activityId);
logger.info("{}", targetActivity.getProperties());
String type = (String) targetActivity.getProperty("type");
if ("userTask".equals(type)) {
logger.info("rollback to userTask");
this.rollbackUserTask(commandContext);
} else if ("startEvent".equals(type)) {
logger.info("rollback to startEvent");
this.rollbackStartEvent(commandContext);
} else {
throw new IllegalStateException("cannot rollback " + type);
}
return 0;
}
示例2: isVote
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
/**
* 是否会签任务.
*/
public boolean isVote(DelegateTask delegateTask) {
ExecutionEntity executionEntity = (ExecutionEntity) delegateTask
.getExecution();
ActivityImpl activityImpl = executionEntity.getActivity();
return activityImpl.getProperty("multiInstance") != null;
}
示例3: execute
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
@Override
public void execute(InterpretableExecution execution) {
ActivityImpl activity = (ActivityImpl) execution.getActivity();
ActivityBehavior activityBehavior = activity.getActivityBehavior();
if (activityBehavior == null) {
throw new PvmException("no behavior specified in " + activity);
}
LOGGER.debug("{} executes {}: {}", execution, activity, activityBehavior.getClass().getName());
try {
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createActivityEvent(FlowableEngineEventType.ACTIVITY_STARTED,
execution.getActivity().getId(),
(String) execution.getActivity().getProperty("name"),
execution.getId(),
execution.getProcessInstanceId(),
execution.getProcessDefinitionId(),
(String) activity.getProperties().get("type"),
activity.getActivityBehavior().getClass().getCanonicalName()));
}
activityBehavior.execute(execution);
} catch (ActivitiException e) {
throw e;
} catch (Throwable t) {
LogMDC.putMDCExecution(execution);
throw new ActivitiActivityExecutionException("couldn't execute activity <" + activity.getProperty("type") + " id=\"" + activity.getId() + "\" ...>: " + t.getMessage(), t);
}
}
示例4: setActivity
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
@Override
public void setActivity(ActivityImpl activity) {
this.activity = activity;
if (activity != null) {
this.activityId = activity.getId();
this.activityName = (String) activity.getProperty("name");
} else {
this.activityId = null;
this.activityName = null;
}
}
示例5: createAssociation
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
protected void createAssociation(BpmnParse bpmnParse, Association association, ScopeImpl parentScope) {
BpmnModel bpmnModel = bpmnParse.getBpmnModel();
if (bpmnModel.getArtifact(association.getSourceRef()) != null ||
bpmnModel.getArtifact(association.getTargetRef()) != null) {
// connected to a text annotation so skipping it
return;
}
ActivityImpl sourceActivity = parentScope.findActivity(association.getSourceRef());
ActivityImpl targetActivity = parentScope.findActivity(association.getTargetRef());
// an association may reference elements that are not parsed as activities (like for instance
// text annotations so do not throw an exception if sourceActivity or targetActivity are null)
// However, we make sure they reference 'something':
if (sourceActivity == null) {
// bpmnModel.addProblem("Invalid reference sourceRef '" + association.getSourceRef() + "' of association element ", association.getId());
} else if (targetActivity == null) {
// bpmnModel.addProblem("Invalid reference targetRef '" + association.getTargetRef() + "' of association element ", association.getId());
} else {
if (sourceActivity.getProperty("type").equals("compensationBoundaryCatch")) {
Object isForCompensation = targetActivity.getProperty(PROPERTYNAME_IS_FOR_COMPENSATION);
if (isForCompensation == null || !(Boolean) isForCompensation) {
LOGGER.warn("compensation boundary catch must be connected to element with isForCompensation=true");
} else {
ActivityImpl compensatedActivity = sourceActivity.getParentActivity();
compensatedActivity.setProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID, targetActivity.getId());
}
}
}
}
示例6: handleEvent
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入方法依赖的package包/类
@Override
public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) {
String configuration = eventSubscription.getConfiguration();
if (configuration == null) {
throw new ActivitiException("Compensating execution not set for compensate event subscription with id " + eventSubscription.getId());
}
ExecutionEntity compensatingExecution = commandContext.getExecutionEntityManager()
.findExecutionById(configuration);
ActivityImpl compensationHandler = eventSubscription.getActivity();
if ((compensationHandler.getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION) == null
|| !(Boolean) compensationHandler.getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION))
&& compensationHandler.isScope()) {
// descend into scope:
List<CompensateEventSubscriptionEntity> eventsForThisScope = compensatingExecution.getCompensateEventSubscriptions();
ScopeUtil.throwCompensationEvent(eventsForThisScope, compensatingExecution, false);
} else {
try {
if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createActivityEvent(FlowableEngineEventType.ACTIVITY_COMPENSATE,
compensationHandler.getId(),
(String) compensationHandler.getProperty("name"),
compensatingExecution.getId(),
compensatingExecution.getProcessInstanceId(),
compensatingExecution.getProcessDefinitionId(),
(String) compensatingExecution.getActivity().getProperties().get("type"),
compensatingExecution.getActivity().getActivityBehavior().getClass().getCanonicalName()));
}
compensatingExecution.setActivity(compensationHandler);
// executing the atomic operation makes sure activity start events are fired
compensatingExecution.performOperation(AtomicOperation.ACTIVITY_START);
} catch (Exception e) {
throw new ActivitiException("Error while handling compensation event " + eventSubscription, e);
}
}
}