public virtual object Execute(ICommandContext commandContext) { if (string.IsNullOrWhiteSpace(processDefinitionId)) { throw new ActivitiIllegalArgumentException("Process definition id is null"); } IProcessDefinitionEntity processDefinition = commandContext.ProcessDefinitionEntityManager.FindById <IProcessDefinitionEntity>(processDefinitionId); if (processDefinition == null) { throw new ActivitiObjectNotFoundException("No process definition found for id = '" + processDefinitionId + "'", typeof(IProcessDefinition)); } // Update category processDefinition.Category = category; // Remove process definition from cache, it will be refetched later IDeploymentCache <ProcessDefinitionCacheEntry> processDefinitionCache = commandContext.ProcessEngineConfiguration.ProcessDefinitionCache; if (processDefinitionCache != null) { processDefinitionCache.Remove(processDefinitionId); } if (commandContext.EventDispatcher.Enabled) { commandContext.EventDispatcher.DispatchEvent(ActivitiEventBuilder.CreateEntityEvent(ActivitiEventType.ENTITY_UPDATED, processDefinition)); } return(null); }
/// <summary> /// Ensures that the process definition is cached in the appropriate places, including the /// deployment's collection of deployed artifacts and the deployment manager's cache, as well /// as caching any ProcessDefinitionInfos. /// </summary> public virtual void UpdateCachingAndArtifacts(ParsedDeployment parsedDeployment) { ICommandContext commandContext = Context.CommandContext; ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration; IDeploymentCache <ProcessDefinitionCacheEntry> processDefinitionCache = processEngineConfiguration.DeploymentManager.ProcessDefinitionCache; IDeploymentEntity deployment = parsedDeployment.Deployment; foreach (IProcessDefinitionEntity processDefinition in parsedDeployment.AllProcessDefinitions) { BpmnModel bpmnModel = parsedDeployment.GetBpmnModelForProcessDefinition(processDefinition); Process process = parsedDeployment.GetProcessModelForProcessDefinition(processDefinition); ProcessDefinitionCacheEntry cacheEntry = new ProcessDefinitionCacheEntry(processDefinition, bpmnModel, process); processDefinitionCache.Add(processDefinition.Id, cacheEntry); AddDefinitionInfoToCache(processDefinition, processEngineConfiguration, commandContext); // Add to deployment for further usage deployment.AddDeployedArtifact(processDefinition); } }
public TargetModule( ISystemClock systemClock, IExceptionHandler exceptionHandler, IConsoleWrapper <TargetModule> consoleWrapper, ICacheState <DateTimeOffset> cacheState, ITargetTypeService targetTypeService, ITargetService targetService, IDeploymentCache deploymentCache) : base(exceptionHandler) { ActionDictionary.Add(builder => builder .Add("add", AddTarget) .Add("list", ListTargets)); WriteLineAsyncAction = (format, args, logLevel) => consoleWrapper.WriteLineAsync(format, true, logLevel, args); DefaultAction = GetTarget; RequiresArguments = true; this.systemClock = systemClock; this.consoleWrapper = consoleWrapper; this.cacheState = cacheState; this.targetTypeService = targetTypeService; this.targetService = targetService; this.deploymentCache = deploymentCache; }