本文整理汇总了Java中org.activiti.engine.impl.persistence.deploy.DeploymentCache类的典型用法代码示例。如果您正苦于以下问题:Java DeploymentCache类的具体用法?Java DeploymentCache怎么用?Java DeploymentCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DeploymentCache类属于org.activiti.engine.impl.persistence.deploy包,在下文中一共展示了DeploymentCache类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deploy
import org.activiti.engine.impl.persistence.deploy.DeploymentCache; //导入依赖的package包/类
public void deploy(DeploymentEntity deployment) {
KnowledgeBuilder knowledgeBuilder = null;
DeploymentCache deploymentCache = Context
.getProcessEngineConfiguration()
.getDeploymentCache();
Map<String, ResourceEntity> resources = deployment.getResources();
for (String resourceName : resources.keySet()) {
log.info("Processing resource " + resourceName);
if (resourceName.endsWith(".drl")) { // is only parsing .drls sufficient? what about other rule dsl's? (@see ResourceType)
if (knowledgeBuilder==null) {
knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
}
ResourceEntity resourceEntity = resources.get(resourceName);
byte[] resourceBytes = resourceEntity.getBytes();
Resource droolsResource = ResourceFactory.newByteArrayResource(resourceBytes);
knowledgeBuilder.add(droolsResource, ResourceType.DRL);
}
}
if (knowledgeBuilder!=null) {
KnowledgeBase knowledgeBase = knowledgeBuilder.newKnowledgeBase();
deploymentCache.addKnowledgeBase(deployment.getId(), knowledgeBase);
}
}
示例2: execute
import org.activiti.engine.impl.persistence.deploy.DeploymentCache; //导入依赖的package包/类
public ProcessInstance execute(CommandContext commandContext) {
DeploymentCache deploymentCache = Context
.getProcessEngineConfiguration()
.getDeploymentCache();
ProcessDefinitionEntity processDefinition = null;
if (processDefinitionId!=null) {
processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiException("No process definition found for id = '" + processDefinitionId + "'");
}
} else if(processDefinitionKey != null){
processDefinition = deploymentCache.findDeployedLatestProcessDefinitionByKey(processDefinitionKey);
if (processDefinition == null) {
throw new ActivitiException("No process definition found for key '" + processDefinitionKey +"'");
}
} else {
throw new ActivitiException("processDefinitionKey and processDefinitionId are null");
}
ExecutionEntity processInstance = processDefinition.createProcessInstance(businessKey);
if (variables!=null) {
processInstance.setVariables(variables);
}
processInstance.start();
return processInstance;
}
示例3: execute
import org.activiti.engine.impl.persistence.deploy.DeploymentCache; //导入依赖的package包/类
public ProcessInstance execute(CommandContext commandContext) {
if(messageName == null) {
throw new ActivitiException("Cannot start process instance by message: message name is null");
}
MessageEventSubscriptionEntity messageEventSubscription = commandContext.getEventSubscriptionManager()
.findMessageStartEventSubscriptionByName(messageName);
if(messageEventSubscription == null) {
throw new ActivitiException("Cannot start process instance by message: no subscription to message with name '"+messageName+"' found.");
}
String processDefinitionId = messageEventSubscription.getConfiguration();
if(processDefinitionId == null) {
throw new ActivitiException("Cannot start process instance by message: subscription to message with name '"+messageName+"' is not a message start event.");
}
DeploymentCache deploymentCache = Context
.getProcessEngineConfiguration()
.getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiException("No process definition found for id '" + processDefinitionId + "'");
}
ActivityImpl startActivity = processDefinition.findActivity(messageEventSubscription.getActivityId());
ExecutionEntity processInstance = processDefinition.createProcessInstance(businessKey, startActivity);
if (processVariables != null) {
processInstance.setVariables(processVariables);
}
processInstance.start();
return processInstance;
}
示例4: execute
import org.activiti.engine.impl.persistence.deploy.DeploymentCache; //导入依赖的package包/类
public Void execute(CommandContext commandContext) {
if (processDefinitionId == null) {
throw new ActivitiIllegalArgumentException("Process definition id is null");
}
ProcessDefinitionEntity processDefinition = Context
.getCommandContext()
.getProcessDefinitionEntityManager()
.findProcessDefinitionById(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiObjectNotFoundException("No process definition found for id = '" + processDefinitionId + "'", ProcessDefinition.class);
}
// Update category
processDefinition.setCategory(category);
// Remove process definition from cache, it will be refetched later
DeploymentCache<ProcessDefinitionEntity> processDefinitionCache =
Context.getProcessEngineConfiguration().getProcessDefinitionCache();
if (processDefinitionCache != null) {
processDefinitionCache.remove(processDefinitionId);
}
return null;
}
示例5: getDeploymentCache
import org.activiti.engine.impl.persistence.deploy.DeploymentCache; //导入依赖的package包/类
public DeploymentCache getDeploymentCache() {
return deploymentCache;
}
示例6: setDeploymentCache
import org.activiti.engine.impl.persistence.deploy.DeploymentCache; //导入依赖的package包/类
public void setDeploymentCache(DeploymentCache deploymentCache) {
this.deploymentCache = deploymentCache;
}
示例7: getProcessDefinitionCache
import org.activiti.engine.impl.persistence.deploy.DeploymentCache; //导入依赖的package包/类
public DeploymentCache<ProcessDefinitionEntity> getProcessDefinitionCache() {
return processDefinitionCache;
}
示例8: setProcessDefinitionCache
import org.activiti.engine.impl.persistence.deploy.DeploymentCache; //导入依赖的package包/类
public ProcessEngineConfigurationImpl setProcessDefinitionCache(DeploymentCache<ProcessDefinitionEntity> processDefinitionCache) {
this.processDefinitionCache = processDefinitionCache;
return this;
}
示例9: getKnowledgeBaseCache
import org.activiti.engine.impl.persistence.deploy.DeploymentCache; //导入依赖的package包/类
public DeploymentCache<Object> getKnowledgeBaseCache() {
return knowledgeBaseCache;
}
示例10: setKnowledgeBaseCache
import org.activiti.engine.impl.persistence.deploy.DeploymentCache; //导入依赖的package包/类
public ProcessEngineConfigurationImpl setKnowledgeBaseCache(DeploymentCache<Object> knowledgeBaseCache) {
this.knowledgeBaseCache = knowledgeBaseCache;
return this;
}