예제 #1
0
        public virtual Void execute(CommandContext commandContext)
        {
            ensureNotEmpty(typeof(BadUserRequestException), "processInstanceId", processInstanceId);

            HistoricProcessInstanceEntity instance = commandContext.HistoricProcessInstanceManager.findHistoricProcessInstance(processInstanceId);

            ensureNotNull(typeof(NotFoundException), "No historic process instance found with id: " + processInstanceId, "instance", instance);

            foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.checkDeleteHistoricVariableInstancesByProcessInstance(instance);
            }

            commandContext.HistoricDetailManager.deleteHistoricDetailsByProcessInstanceIds(Arrays.asList(processInstanceId));
            commandContext.HistoricVariableInstanceManager.deleteHistoricVariableInstanceByProcessInstanceIds(Arrays.asList(processInstanceId));

            // create user operation log
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.camunda.bpm.engine.impl.repository.ResourceDefinitionEntity<?> definition = null;
            ResourceDefinitionEntity <object> definition = null;

            try
            {
                definition = commandContext.ProcessEngineConfiguration.DeploymentCache.findDeployedProcessDefinitionById(instance.ProcessDefinitionId);
            }
            catch (NullValueException)
            {
                // definition has been deleted already
            }
            commandContext.OperationLogManager.logHistoricVariableOperation(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_DELETE_HISTORY, instance, definition, PropertyChange.EMPTY_CHANGE);

            return(null);
        }
예제 #2
0
 public virtual void checkDeleteHistoricVariableInstancesByProcessInstance(HistoricProcessInstanceEntity instance)
 {
     if (instance != null && !TenantManager.isAuthenticatedTenant(instance.TenantId))
     {
         throw LOG.exceptionCommandWithUnauthorizedTenant("delete the historic variable instances of process instance '" + instance.Id + "'");
     }
 }
예제 #3
0
        public virtual void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, string tenantId)
        {
            string byteArrayId = configuration.ConfigurationByteArrayId;

            sbyte[] configurationByteArray = findByteArrayById(byteArrayId, commandContext).Bytes;

            SetRemovalTimeBatchConfiguration batchConfiguration = readConfiguration(configurationByteArray);

            foreach (string instanceId in batchConfiguration.Ids)
            {
                HistoricProcessInstanceEntity instance = findProcessInstanceById(instanceId, commandContext);

                if (instance != null)
                {
                    if (batchConfiguration.Hierarchical && hasHierarchy(instance))
                    {
                        string rootProcessInstanceId = instance.RootProcessInstanceId;

                        HistoricProcessInstanceEntity rootInstance = findProcessInstanceById(rootProcessInstanceId, commandContext);
                        DateTime removalTime = getOrCalculateRemovalTime(batchConfiguration, rootInstance, commandContext);

                        addRemovalTimeToHierarchy(rootProcessInstanceId, removalTime, commandContext);
                    }
                    else
                    {
                        DateTime removalTime = getOrCalculateRemovalTime(batchConfiguration, instance, commandContext);

                        if (removalTime != instance.RemovalTime)
                        {
                            addRemovalTime(instanceId, removalTime, commandContext);
                        }
                    }
                }
            }
        }
예제 #4
0
            public Void execute(CommandContext commandContext)
            {
                HistoricProcessInstanceEntity historicProcessInstanceEntity = (HistoricProcessInstanceEntity)outerInstance.historyService.createHistoricProcessInstanceQuery().singleResult();

                commandContext.DbEntityManager.delete(historicProcessInstanceEntity);

                return(null);
            }
예제 #5
0
 public virtual void checkDeleteHistoricVariableInstancesByProcessInstance(HistoricProcessInstanceEntity instance)
 {
     checkDeleteHistoricProcessInstance(instance);
 }
예제 #6
0
 protected internal virtual DateTime getOrCalculateRemovalTime(SetRemovalTimeBatchConfiguration batchConfiguration, HistoricProcessInstanceEntity instance, CommandContext commandContext)
 {
     if (batchConfiguration.hasRemovalTime())
     {
         return(batchConfiguration.RemovalTime);
     }
     else if (hasBaseTime(instance, commandContext))
     {
         return(calculateRemovalTime(instance, commandContext));
     }
     else
     {
         return(null);
     }
 }
예제 #7
0
        protected internal virtual DateTime calculateRemovalTime(HistoricProcessInstanceEntity processInstance, CommandContext commandContext)
        {
            ProcessDefinition processDefinition = findProcessDefinitionById(processInstance.ProcessDefinitionId, commandContext);

            return(commandContext.ProcessEngineConfiguration.HistoryRemovalTimeProvider.calculateRemovalTime(processInstance, processDefinition));
        }
예제 #8
0
 protected internal virtual bool hasHierarchy(HistoricProcessInstanceEntity instance)
 {
     return(!string.ReferenceEquals(instance.RootProcessInstanceId, null));
 }
예제 #9
0
 protected internal virtual bool isEnded(HistoricProcessInstanceEntity instance)
 {
     return(instance.EndTime != null);
 }
예제 #10
0
 protected internal virtual bool hasBaseTime(HistoricProcessInstanceEntity instance, CommandContext commandContext)
 {
     return(isStrategyStart(commandContext) || (isStrategyEnd(commandContext) && isEnded(instance)));
 }