public static IProcessApplicationReference GetTargetProcessApplication(IResourceDefinitionEntity definition)
        {
            var reference = GetTargetProcessApplication(definition.DeploymentId);

            if ((reference == null) && AreProcessApplicationsRegistered())
            {
                var previous = definition.PreviousDefinition;

                // do it in a iterative way instead of recursive to avoid
                // a possible StackOverflowException in cases with a lot
                // of versions of a definition
                while (previous != null)
                {
                    reference = GetTargetProcessApplication(previous.DeploymentId);

                    if (reference == null)
                    {
                        previous = previous.PreviousDefinition;
                    }
                    else
                    {
                        return(reference);
                    }
                }
            }

            return(reference);
        }
Exemple #2
0
 /// <summary>
 ///     Provide a context execution or resource definition in which context the invocation
 ///     should be performed. If both parameters are null, the invocation is performed in the
 ///     current context.
 /// </summary>
 /// <param name="contextExecution"> set to an execution </param>
 public DelegateInvocation(IBaseDelegateExecution contextExecution, IResourceDefinitionEntity contextResource)
 {
     // This constructor forces sub classes to call it, thereby making it more visible
     // whether a context switch is going to be performed for them.
     this.ContextExecution = contextExecution;
     this.ContextResource  = contextResource;
 }
        public virtual UserOperationLogContextEntryBuilder InContextOf(ExecutionEntity processInstance,
                                                                       IList <PropertyChange> propertyChanges)
        {
            if (propertyChanges == null || propertyChanges.Count == 0)
            {
                if (UserOperationLogEntryFields.OperationTypeCreate.Equals(EntryRenamed.OperationType))
                {
                    propertyChanges = new List <PropertyChange>()
                    {
                        PropertyChange.EmptyChange
                    };;
                }
            }
            EntryRenamed.PropertyChanges     = propertyChanges;
            EntryRenamed.ProcessInstanceId   = processInstance.ProcessInstanceId;
            EntryRenamed.ProcessDefinitionId = processInstance.ProcessDefinitionId;
            EntryRenamed.ExecutionId         = processInstance.Id;
            EntryRenamed.CaseInstanceId      = processInstance.CaseInstanceId;

            IResourceDefinitionEntity definition = (IResourceDefinitionEntity)processInstance.ProcessDefinition;

            if (definition != null)
            {
                EntryRenamed.ProcessDefinitionKey = definition.Key;
                EntryRenamed.DeploymentId         = definition.DeploymentId;
            }

            return(this);
        }
 protected internal virtual IResourceDefinitionEntity getPreviousDefinition(
     IResourceDefinitionEntity definitionEntity)
 // org.Camunda.bpm.Engine.impl.Repository.ResourceDefinitionEntity
 {
     return
         (((ProcessEngineConfigurationImpl)processEngineConfiguration).CommandExecutorTxRequired.Execute(
              new CommandAnonymousInnerClass(this, definitionEntity)));
 }
Exemple #5
0
 public virtual void RemoveArtifact(IResourceDefinitionEntity notDeployedArtifact)
 {
     if (deployedArtifacts != null)
     {
         IList artifacts = deployedArtifacts[notDeployedArtifact.GetType()];
         if (artifacts != null)
         {
             artifacts.Remove(notDeployedArtifact);
             if (artifacts.Count == 0)
             {
                 deployedArtifacts.Remove(notDeployedArtifact.GetType());
             }
         }
     }
 }
Exemple #6
0
        // Deployed artifacts manipulation //////////////////////////////////////////

        public virtual void AddDeployedArtifact(IResourceDefinitionEntity deployedArtifact)
        {
            if (deployedArtifacts == null)
            {
                deployedArtifacts = new Dictionary <Type, IList>();
            }

            Type  clazz     = deployedArtifact.GetType();
            IList artifacts = deployedArtifacts.ContainsKey(clazz) ? deployedArtifacts[clazz] : null;

            if (artifacts == null)
            {
                artifacts = new ArrayList();
                deployedArtifacts[clazz] = artifacts;
            }

            artifacts.Add(deployedArtifact);
        }
        public virtual UserOperationLogContextEntryBuilder InContextOf(TaskEntity task,
                                                                       IList <PropertyChange> propertyChanges)
        {
            if (propertyChanges == null || propertyChanges.Count == 0)
            {
                if (UserOperationLogEntryFields.OperationTypeCreate.Equals(EntryRenamed.OperationType))
                {
                    propertyChanges = new List <PropertyChange>()
                    {
                        PropertyChange.EmptyChange
                    };;
                }
            }
            EntryRenamed.PropertyChanges = propertyChanges;

            IResourceDefinitionEntity definition = task.ProcessDefinition;

            if (definition != null)
            {
                EntryRenamed.ProcessDefinitionKey = definition.Key;
                EntryRenamed.DeploymentId         = definition.DeploymentId;
            }
            else if (!ReferenceEquals(task.CaseDefinitionId, null))
            {
                throw new NotImplementedException();
                //definition = task.CaseDefinition;
                EntryRenamed.DeploymentId = definition.DeploymentId;
            }

            EntryRenamed.ProcessDefinitionId = task.ProcessDefinitionId;
            EntryRenamed.ProcessInstanceId   = task.ProcessInstanceId;
            EntryRenamed.ExecutionId         = task.ExecutionId;
            EntryRenamed.CaseDefinitionId    = task.CaseDefinitionId;
            EntryRenamed.CaseInstanceId      = task.CaseInstanceId;
            EntryRenamed.CaseExecutionId     = task.CaseExecutionId;
            EntryRenamed.TaskId = task.Id;

            return(this);
        }