Java Code Examples for org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity#getDeploymentId()

The following examples show how to use org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity#getDeploymentId() . 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: GetDeploymentProcessModelCmd.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public InputStream execute(final CommandContext commandContext) {
  ProcessDefinitionEntity processDefinition = Context
          .getProcessEngineConfiguration()
          .getDeploymentCache()
          .findDeployedProcessDefinitionById(processDefinitionId);

  for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
    checker.checkReadProcessDefinition(processDefinition);
  }

  final String deploymentId = processDefinition.getDeploymentId();
  final String resourceName = processDefinition.getResourceName();

  InputStream processModelStream = commandContext.runWithoutAuthorization(new Callable<InputStream>() {
    public InputStream call() throws Exception {
      return new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);
    }
  });

  return processModelStream;
}
 
Example 2
Source File: GetDeploymentProcessDiagramCmd.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public InputStream execute(final CommandContext commandContext) {
  ProcessDefinitionEntity processDefinition = Context
          .getProcessEngineConfiguration()
          .getDeploymentCache()
          .findDeployedProcessDefinitionById(processDefinitionId);

  for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
    checker.checkReadProcessDefinition(processDefinition);
  }

  final String deploymentId = processDefinition.getDeploymentId();
  final String resourceName = processDefinition.getDiagramResourceName();

  if (resourceName == null ) {
    return null;
  } else {

    InputStream processDiagramStream = commandContext.runWithoutAuthorization(new Callable<InputStream>() {
      public InputStream call() throws Exception {
        return new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);
      }
    });

    return processDiagramStream;
  }
}
 
Example 3
Source File: AbstractSetStateCmd.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected String getDeploymentIdByProcessDefinition(CommandContext commandContext, String processDefinitionId) {
  ProcessDefinitionEntity definition = commandContext.getProcessDefinitionManager().getCachedResourceDefinitionEntity(processDefinitionId);
  if (definition == null) {
    definition = commandContext.getProcessDefinitionManager().findLatestDefinitionById(processDefinitionId);
  }
  if (definition != null) {
    return definition.getDeploymentId();
  }
  return null;
}
 
Example 4
Source File: AbstractSetStateCmd.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected String getDeploymentIdByProcessDefinitionKey(CommandContext commandContext, String processDefinitionKey,
    boolean tenantIdSet, String tenantId) {
  ProcessDefinitionEntity definition = null;
  if (tenantIdSet) {
    definition = commandContext.getProcessDefinitionManager().findLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId);
  } else {
    // randomly use a latest process definition's deployment id from one of the tenants
    List<ProcessDefinitionEntity> definitions = commandContext.getProcessDefinitionManager().findLatestProcessDefinitionsByKey(processDefinitionKey);
    definition = definitions.isEmpty() ? null : definitions.get(0);
  }
  if (definition != null) {
    return definition.getDeploymentId();
  }
  return null;
}
 
Example 5
Source File: BpmnDeployer.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
protected void addTimerDeclarations(ProcessDefinitionEntity processDefinition) {
  List<TimerDeclarationImpl> timerDeclarations = (List<TimerDeclarationImpl>) processDefinition.getProperty(BpmnParse.PROPERTYNAME_START_TIMER);
  if (timerDeclarations!=null) {
    for (TimerDeclarationImpl timerDeclaration : timerDeclarations) {
      String deploymentId = processDefinition.getDeploymentId();
      timerDeclaration.createStartTimerInstance(deploymentId);
    }
  }
}