本文整理汇总了Java中org.activiti.engine.ActivitiException类的典型用法代码示例。如果您正苦于以下问题:Java ActivitiException类的具体用法?Java ActivitiException怎么用?Java ActivitiException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActivitiException类属于org.activiti.engine包,在下文中一共展示了ActivitiException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setValue
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
@Override
public void setValue(Object value, ValueFields valueFields)
{
if (value != null)
{
if (!(value instanceof ActivitiScriptNodeList))
{
throw new ActivitiException("Passed value is not an instance of ActivitiScriptNodeList, cannot set variable value.");
}
// Extract all node references
List<NodeRef> nodeRefs = ((ActivitiScriptNodeList) value).getNodeReferences();
// Save the list as a serializable
super.setValue(nodeRefs, valueFields);
}
}
示例2: getValue
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Object getValue(ValueFields valueFields)
{
Object serializable = super.getValue(valueFields);
if (serializable == null)
{
return null;
}
if (!(serializable instanceof List<?>))
{
throw new ActivitiException("Serializable stored in variable is not instance of List<NodeRef>, cannot get value.");
}
ActivitiScriptNodeList scriptNodes = new ActivitiScriptNodeList();
// Wrap all node references in an ActivitiScriptNode
List<NodeRef> nodeRefs =(List<NodeRef>) serializable;
for (NodeRef ref : nodeRefs)
{
scriptNodes.add(new ActivitiScriptNode(ref, serviceRegistry));
}
return scriptNodes;
}
示例3: setValue
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
@Override
public void setValue(Object value, ValueFields valueFields)
{
String textValue = null;
if (value != null)
{
if (!(value instanceof ActivitiScriptNode))
{
throw new ActivitiException("Passed value is not an instance of ActivitiScriptNode, cannot set variable value.");
}
NodeRef reference = (((ActivitiScriptNode)value).getNodeRef());
if (reference != null)
{
// Use the string representation of the NodeRef
textValue = reference.toString();
}
}
valueFields.setTextValue(textValue);
}
示例4: getActiveWorkflows
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public List<WorkflowInstance> getActiveWorkflows()
{
try
{
return getWorkflows(new WorkflowInstanceQuery(true));
}
catch(ActivitiException ae)
{
String message = messageService.getMessage(ERR_GET_ACTIVE_WORKFLOW_INSTS, "");
if(logger.isDebugEnabled())
{
logger.debug(message, ae);
}
throw new WorkflowException(message, ae);
}
}
示例5: getCompletedWorkflows
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<WorkflowInstance> getCompletedWorkflows()
{
try
{
return getWorkflows(new WorkflowInstanceQuery(false));
}
catch(ActivitiException ae)
{
String message = messageService.getMessage(ERR_GET_COMPLETED_WORKFLOW_INSTS, "");
if(logger.isDebugEnabled())
{
logger.debug(message, ae);
}
throw new WorkflowException(message, ae);
}
}
示例6: getWorkflows
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<WorkflowInstance> getWorkflows()
{
try
{
return getWorkflows(new WorkflowInstanceQuery());
}
catch(ActivitiException ae)
{
String message = messageService.getMessage(ERR_GET_WORKFLOW_INSTS, "");
if(logger.isDebugEnabled())
{
logger.debug(message, ae);
}
throw new WorkflowException(message, ae);
}
}
示例7: getAllDefinitions
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public List<WorkflowDefinition> getAllDefinitions()
{
try
{
ProcessDefinitionQuery query = repoService.createProcessDefinitionQuery();
if(activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && !TenantUtil.isCurrentDomainDefault())
{
query.processDefinitionKeyLike("@" + TenantUtil.getCurrentDomain() + "%");
}
return getValidWorkflowDefinitions(query.list());
}
catch (ActivitiException ae)
{
String msg = messageService.getMessage(ERR_GET_WORKFLOW_DEF);
if(logger.isDebugEnabled())
{
logger.debug(msg, ae);
}
throw new WorkflowException(msg, ae);
}
}
示例8: getAllDefinitionsByName
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public List<WorkflowDefinition> getAllDefinitionsByName(String workflowName)
{
try
{
String key = factory.getProcessKey(workflowName);
List<ProcessDefinition> definitions = repoService.createProcessDefinitionQuery()
.processDefinitionKey(key)
.list();
return getValidWorkflowDefinitions(definitions);
}
catch (ActivitiException ae)
{
String msg = messageService.getMessage(ERR_GET_ALL_DEFS_BY_NAME, workflowName);
if(logger.isDebugEnabled())
{
logger.debug(msg, ae);
}
throw new WorkflowException(msg, ae);
}
}
示例9: getDefinitionByName
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public WorkflowDefinition getDefinitionByName(String workflowName)
{
try
{
String key = factory.getLocalEngineId(workflowName);
if(activitiUtil.isMultiTenantWorkflowDeploymentEnabled())
{
key = factory.getDomainProcessKey(workflowName);
}
ProcessDefinition definition = activitiUtil.getProcessDefinitionByKey(key);
return typeConverter.convert(definition);
}
catch (ActivitiException ae)
{
String msg = messageService.getMessage(ERR_GET_WORKFLOW_DEF_BY_NAME, workflowName);
if(logger.isDebugEnabled())
{
logger.debug(msg, ae);
}
throw new WorkflowException(msg, ae);
}
}
示例10: getDefinitions
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public List<WorkflowDefinition> getDefinitions()
{
try
{
ProcessDefinitionQuery query = repoService.createProcessDefinitionQuery().latestVersion();
if(activitiUtil.isMultiTenantWorkflowDeploymentEnabled() && !TenantUtil.isCurrentDomainDefault())
{
query.processDefinitionKeyLike("@" + TenantUtil.getCurrentDomain() + "%");
}
return getValidWorkflowDefinitions(query.list());
}
catch (ActivitiException ae)
{
String msg = messageService.getMessage(ERR_GET_WORKFLOW_DEF);
if(logger.isDebugEnabled())
{
logger.debug(msg, ae);
}
throw new WorkflowException(msg, ae);
}
}
示例11: getWorkflowPaths
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public List<WorkflowPath> getWorkflowPaths(String workflowId)
{
try
{
String processInstanceId = createLocalId(workflowId);
List<Execution> executions = runtimeService
.createExecutionQuery()
.processInstanceId(processInstanceId)
.list();
return typeConverter.convertExecution(executions);
}
catch (ActivitiException ae)
{
String msg = messageService.getMessage(ERR_GET_WORKFLOW_PATHS);
if(logger.isDebugEnabled())
{
logger.debug(msg, ae);
}
throw new WorkflowException(msg, ae);
}
}
示例12: testRollbackFromActiviti
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
/**
* Start a process and then trigger a rollback by throwing an exception in Alfresco NodeService.
* Check that the process instance was rolled back.
*/
public void testRollbackFromActiviti()
{
RetryingTransactionCallback<Void> callback = new RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable
{
nodeService.addAspect(workingNodeRef, ASPECT, null);
assertTrue("The node should have the aspect!", nodeService.hasAspect(workingNodeRef, ASPECT));
try
{
runtime.signal("Fake Id");
fail("Should throw an Exception here!");
}
catch (ActivitiException e)
{
// Expected, but absorbed
}
return null;
}
};
txnHelper.doInTransaction(callback);
assertFalse("The node should not have the aspect!", nodeService.hasAspect(workingNodeRef, ASPECT));
}
示例13: resolveDuedate
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
public Date resolveDuedate(String duedate, int maxIterations) {
String textWithoutBusiness = duedate;
boolean isBusinessTime = textWithoutBusiness.startsWith("business");
if (isBusinessTime) {
textWithoutBusiness = textWithoutBusiness.substring(
"business".length()).trim();
}
try {
if (textWithoutBusiness.startsWith("R")) {
return new DurationUtil(duedate, this).getDateAfter();
} else {
CronExpression ce = new CronExpression(duedate, null);
return ce.getTimeAfter(new Date());
}
} catch (Exception e) {
throw new ActivitiException("Failed to parse cron expression: "
+ duedate, e);
}
}
示例14: removeSequentialInstance
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
/**
* <li>冲串行列表中移除未完成的用户(当前执行的用户无法移除)
*/
private void removeSequentialInstance() {
ExecutionEntity executionEntity = getActivieExecutions().get(0);
Collection<String> col = (Collection<String>) executionEntity
.getVariable(collectionVariableName);
log.info("移除前审批列表 : {}", col.toString());
col.remove(assignee);
executionEntity.setVariable(collectionVariableName, col);
setLoopVariable(executionEntity, "nrOfInstances",
(Integer) executionEntity.getVariableLocal("nrOfInstances") - 1);
// 如果串行要删除的人是当前active执行,
if (executionEntity.getVariableLocal(collectionElementVariableName)
.equals(assignee)) {
throw new ActivitiException("当前正在执行的实例,无法移除!");
}
log.info("移除后审批列表 : {}", col.toString());
}
示例15: executeHttpRequest
import org.activiti.engine.ActivitiException; //导入依赖的package包/类
protected HttpResponse executeHttpRequest(HttpRequestBase httpRequest, String method) {
CloseableHttpResponse response = null;
try {
response = httpClient.execute(httpRequest);
} catch (IOException e) {
throw new ActivitiException("error while executing http request: " + method + " " + httpRequest.getURI(),
e);
}
if (response.getStatusLine().getStatusCode() >= 400) {
throw new ActivitiException("error while executing http request " + method + " " + httpRequest.getURI()
+ " with status code: " + response.getStatusLine().getStatusCode());
}
return response;
}