Java Code Examples for org.camunda.bpm.engine.impl.history.HistoryLevel#isHistoryEventProduced()

The following examples show how to use org.camunda.bpm.engine.impl.history.HistoryLevel#isHistoryEventProduced() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IdentityLinkEntity.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public void fireHistoricIdentityLinkEvent(final HistoryEventType eventType) {
  ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();

  HistoryLevel historyLevel = processEngineConfiguration.getHistoryLevel();
  if(historyLevel.isHistoryEventProduced(eventType, this)) {

    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
      @Override
      public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
        HistoryEvent event = null;
        if (HistoryEvent.IDENTITY_LINK_ADD.equals(eventType.getEventName())) {
          event = producer.createHistoricIdentityLinkAddEvent(IdentityLinkEntity.this);
        } else if (HistoryEvent.IDENTITY_LINK_DELETE.equals(eventType.getEventName())) {
          event = producer.createHistoricIdentityLinkDeleteEvent(IdentityLinkEntity.this);
        }
        return event;
      }
    });

  }
}
 
Example 2
Source File: AbstractSetProcessInstanceStateCmd.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Override
protected void triggerHistoryEvent(CommandContext commandContext){
  HistoryLevel historyLevel = commandContext.getProcessEngineConfiguration().getHistoryLevel();
  List<ProcessInstance> updatedProcessInstances = obtainProcessInstances(commandContext);
  //suspension state is not updated synchronously
  if (getNewSuspensionState() != null && updatedProcessInstances != null) {
    for (final ProcessInstance processInstance: updatedProcessInstances) {

      if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_UPDATE, processInstance)) {
        HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
          @Override
          public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
            HistoricProcessInstanceEventEntity processInstanceUpdateEvt = (HistoricProcessInstanceEventEntity)
                producer.createProcessInstanceUpdateEvt((DelegateExecution) processInstance);
            if (SuspensionState.SUSPENDED.getStateCode() == getNewSuspensionState().getStateCode()) {
              processInstanceUpdateEvt.setState(HistoricProcessInstance.STATE_SUSPENDED);
            } else {
              processInstanceUpdateEvt.setState(HistoricProcessInstance.STATE_ACTIVE);
            }
            return processInstanceUpdateEvt;
          }
        });
      }
    }
  }
}
 
Example 3
Source File: HistoricTaskInstanceManager.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public void markTaskInstanceEnded(String taskId, final String deleteReason) {
  ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();

  final TaskEntity taskEntity = Context.getCommandContext()
      .getDbEntityManager()
      .selectById(TaskEntity.class, taskId);

  HistoryLevel historyLevel = configuration.getHistoryLevel();
  if(historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_COMPLETE, taskEntity)) {

    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
      @Override
      public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
        return producer.createTaskInstanceCompleteEvt(taskEntity, deleteReason);
      }
    });
  }
}
 
Example 4
Source File: AbstractDeleteProcessInstanceCmd.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public void triggerHistoryEvent(List<ProcessInstance> subProcesslist) {
  ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
  HistoryLevel historyLevel = configuration.getHistoryLevel();

  for (final ProcessInstance processInstance : subProcesslist) {
    // TODO: This smells bad, as the rest of the history is done via the
    // ParseListener
    if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_UPDATE, processInstance)) {

      HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
        @Override
        public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
          return producer.createProcessInstanceUpdateEvt((DelegateExecution) processInstance);
        }
      });
    }
  }
}
 
Example 5
Source File: PvmExecutionImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Override
public void setProcessBusinessKey(String businessKey) {
  final PvmExecutionImpl processInstance = getProcessInstance();
  processInstance.setBusinessKey(businessKey);

  HistoryLevel historyLevel = Context
  .getCommandContext().getProcessEngineConfiguration().getHistoryLevel();
  if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_UPDATE, processInstance)) {

    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
      @Override
      public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
        return producer.createProcessInstanceUpdateEvt(processInstance);
      }
    });
  }
}
 
Example 6
Source File: MigratingIncident.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected void migrateHistory() {
  HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();

  if (historyLevel.isHistoryEventProduced(HistoryEventTypes.INCIDENT_MIGRATE, this)) {
    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
      @Override
      public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
        return producer.createHistoricIncidentMigrateEvt(incident);
      }
    });
  }
}
 
Example 7
Source File: MigratingUserTaskInstance.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected void migrateHistory() {
  HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();

  if (historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_MIGRATE, this)) {
    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
      @Override
      public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
        return producer.createTaskInstanceMigrateEvt(userTask);
      }
    });
  }
}
 
Example 8
Source File: MigratingVariableInstance.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected void migrateHistory() {
  HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();

  if (historyLevel.isHistoryEventProduced(HistoryEventTypes.VARIABLE_INSTANCE_MIGRATE, this)) {
    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
      @Override
      public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
        return producer.createHistoricVariableMigrateEvt(variable);
      }
    });
  }
}
 
Example 9
Source File: HistoricBatchManager.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void completeHistoricBatch(final BatchEntity batch) {
  ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();

  HistoryLevel historyLevel = configuration.getHistoryLevel();
  if(historyLevel.isHistoryEventProduced(HistoryEventTypes.BATCH_END, batch)) {

    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
      @Override
      public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
        return producer.createBatchEndEvent(batch);
      }
    });
  }
}
 
Example 10
Source File: HistoricBatchManager.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void createHistoricBatch(final BatchEntity batch) {
  ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();

  HistoryLevel historyLevel = configuration.getHistoryLevel();
  if(historyLevel.isHistoryEventProduced(HistoryEventTypes.BATCH_START, batch)) {

    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
      @Override
      public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
        return producer.createBatchStartEvent(batch);
      }
    });
  }
}
 
Example 11
Source File: HistoricTaskInstanceManager.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void updateHistoricTaskInstance(final TaskEntity taskEntity) {
  ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();

  HistoryLevel historyLevel = configuration.getHistoryLevel();
  if(historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_UPDATE, taskEntity)) {

    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
      @Override
      public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
        return producer.createTaskInstanceUpdateEvt(taskEntity);
      }
    });
  }
}
 
Example 12
Source File: MigratingActivityInstance.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected void migrateActivityInstanceHistory(final DelegateExecution execution) {
  HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
  if (!historyLevel.isHistoryEventProduced(HistoryEventTypes.ACTIVITY_INSTANCE_MIGRATE, this)) {
    return;
  }

  HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
    @Override
    public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
      return producer.createActivityInstanceMigrateEvt(MigratingActivityInstance.this);
    }
  });
}
 
Example 13
Source File: HistoricTaskInstanceManager.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void createHistoricTask(final TaskEntity task) {
  ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();

  HistoryLevel historyLevel = configuration.getHistoryLevel();
  if(historyLevel.isHistoryEventProduced(HistoryEventTypes.TASK_INSTANCE_CREATE, task)) {

    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
      @Override
      public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
        return producer.createTaskInstanceCreateEvt(task);
      }
    });

  }
}
 
Example 14
Source File: HistoricIncidentManager.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected boolean isHistoryEventProduced() {
  HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
  return historyLevel.isHistoryEventProduced(HistoryEventTypes.INCIDENT_CREATE, null) ||
         historyLevel.isHistoryEventProduced(HistoryEventTypes.INCIDENT_DELETE, null) ||
         historyLevel.isHistoryEventProduced(HistoryEventTypes.INCIDENT_MIGRATE, null) ||
         historyLevel.isHistoryEventProduced(HistoryEventTypes.INCIDENT_RESOLVE, null);
}
 
Example 15
Source File: ExecutionEntity.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public void fireHistoricActivityInstanceUpdate() {
  ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
  HistoryLevel historyLevel = configuration.getHistoryLevel();
  if (historyLevel.isHistoryEventProduced(HistoryEventTypes.ACTIVITY_INSTANCE_UPDATE, this)) {
    // publish update event for current activity instance (containing the id
    // of the sub process/case)
    HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
      @Override
      public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
        return producer.createActivityInstanceUpdateEvt(ExecutionEntity.this);
      }
    });
  }
}
 
Example 16
Source File: MigratingActivityInstance.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected void migrateProcessInstanceHistory(final DelegateExecution execution) {
  HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
  if (!historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_MIGRATE, this)) {
    return;
  }

  HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() {
    @Override
    public HistoryEvent createHistoryEvent(HistoryEventProducer producer) {
      return producer.createProcessInstanceMigrateEvt(execution);
    }
  });
}
 
Example 17
Source File: HistoricJobLogManager.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
protected boolean isHistoryEventProduced(HistoryEventType eventType, Job job) {
  ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
  HistoryLevel historyLevel = configuration.getHistoryLevel();
  return historyLevel.isHistoryEventProduced(eventType, job);
}
 
Example 18
Source File: HistoricIdentityLinkLogManager.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
protected boolean isHistoryEventProduced() {
  HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
  return historyLevel.isHistoryEventProduced(HistoryEventTypes.IDENTITY_LINK_ADD, null) ||
         historyLevel.isHistoryEventProduced(HistoryEventTypes.IDENTITY_LINK_DELETE, null);
}
 
Example 19
Source File: HistoricExternalTaskLogManager.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
protected boolean isHistoryEventProduced(HistoryEventType eventType, ExternalTask externalTask) {
  ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration();
  HistoryLevel historyLevel = configuration.getHistoryLevel();
  return historyLevel.isHistoryEventProduced(eventType, externalTask);
}
 
Example 20
Source File: UserOperationLogManager.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
protected boolean isHistoryEventProduced() {
  HistoryLevel historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel();
  return historyLevel.isHistoryEventProduced(HistoryEventTypes.USER_OPERATION_LOG, null);
}