org.camunda.bpm.application.PostDeploy Java Examples

The following examples show how to use org.camunda.bpm.application.PostDeploy. 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: PostDeployRegistrationPa.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@PostDeploy
public void registerProcessApplication(ProcessEngine processEngine) {

  // lookup existing deployment
  ProcessDefinition processDefinition = processEngine.getRepositoryService()
    .createProcessDefinitionQuery()
    .processDefinitionKey("startToEnd")
    .latestVersion()
    .singleResult();

  deploymentId = processDefinition.getDeploymentId();

  // register with the process engine
  processEngine.getManagementService()
    .registerProcessApplication(deploymentId, getReference());


  isPostDeployInvoked = true;
}
 
Example #2
Source File: InvoiceProcessApplication.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
/**
 * In a @PostDeploy Hook you can interact with the process engine and access
 * the processes the application has deployed.
 */
@PostDeploy
public void startFirstProcess(ProcessEngine processEngine) {
  createUsers(processEngine);

  //enable metric reporting
  ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
  processEngineConfiguration.setDbMetricsReporterActivate(true);
  processEngineConfiguration.getDbMetricsReporter().setReporterId("REPORTER");

  startProcessInstances(processEngine, "invoice", 1);
  startProcessInstances(processEngine, "invoice", null);

  //disable reporting
  processEngineConfiguration.setDbMetricsReporterActivate(false);
}
 
Example #3
Source File: ProcessApplicationStartService.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void invokePostDeploy(final ProcessApplicationInterface processApplication) throws ClassNotFoundException, StartException {
  Class<?> paClass = getPaClass(postDeployDescription);
  final Method postDeployMethod = InjectionUtil.detectAnnotatedMethod(paClass, PostDeploy.class);

  if(postDeployMethod != null) {
    try {
      processApplication.execute(new Callable<Void>() {
        @Override
        public Void call() throws Exception {
          postDeployMethod.invoke(processApplication.getRawObject(), getInjections(postDeployMethod));
          return null;
        }
      });
    }catch(Exception e) {
      throw new StartException("Exception while invoking the @PostDeploy method ", e);
    }
  }

}
 
Example #4
Source File: ProcessApplicationStartService.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void invokePostDeploy(final ProcessApplicationInterface processApplication) throws ClassNotFoundException, StartException {
  Class<?> paClass = getPaClass(postDeployDescription);
  final Method postDeployMethod = InjectionUtil.detectAnnotatedMethod(paClass, PostDeploy.class);

  if(postDeployMethod != null) {
    try {
      processApplication.execute(new Callable<Void>() {
        @Override
        public Void call() throws Exception {
          postDeployMethod.invoke(processApplication.getRawObject(), getInjections(postDeployMethod));
          return null;
        }
      });
    }catch(Exception e) {
      throw new StartException("Exception while invoking the @PostDeploy method ", e);
    }
  }

}
 
Example #5
Source File: PrintServiceProcessApplication.java    From camunda-bpm-mail with Apache License 2.0 5 votes vote down vote up
@PostDeploy
public void startService(ProcessEngine processEngine) throws Exception {
  RuntimeService runtimeService = processEngine.getRuntimeService();

  configuration = MailConfigurationFactory.getConfiguration();
  notificationService = new MailNotificationService(configuration);

  notificationService.registerMailHandler(mail -> {
    runtimeService.startProcessInstanceByKey("printProcess",
        Variables.createVariables()
          .putValue("mail", mail)
          .putValue("invoice", getInvoicePath()));
  });

  notificationService.start();
}
 
Example #6
Source File: CamundaBpmProcessApplication.java    From camunda-archetypes with Apache License 2.0 5 votes vote down vote up
/**
   * In a @PostDeploy Hook you can interact with the process engine and access 
   * the processes the application has deployed. 
   */
  @PostDeploy
  public void onDeploymentFinished(ProcessEngine processEngine) {

    // start an initial process instance
//    Map<String, Object> variables = new HashMap<String, Object>();
//    variables.put("name", "John");
//    
//    processEngine.getRuntimeService().startProcessInstanceByKey(PROCESS_DEFINITION_KEY, variables);
  }
 
Example #7
Source File: CamundaBpmProcessApplication.java    From camunda-archetypes with Apache License 2.0 5 votes vote down vote up
/**
   * In a @PostDeploy Hook you can interact with the process engine and access 
   * the processes the application has deployed. 
   */
  @PostDeploy
  public void onDeploymentFinished(ProcessEngine processEngine) {
//    LicenseHelper.setLicense(processEngine);
//    createDefaultUsers(processEngine);
//    addGroup(processEngine, "Agent", "Agent", "demo");
//    addFilterUserAuthorization(processEngine, "demo", FILTER_myTasks, FILTER_groupTasksFilter, FILTER_followUp, FILTER_overdue, FILTER_allTasksFilter);

    // start an initial process instance
//    Map<String, Object> variables = new HashMap<String, Object>();
//    variables.put("name", "John");
//    
//    processEngine.getRuntimeService().startProcessInstanceByKey(PROCESS_DEFINITION_KEY, variables);
  }
 
Example #8
Source File: PostDeployWithNestedContext.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@PostDeploy
public void registerProcessApplication(ProcessEngine processEngine) {
  deployCalled = true;
  applicationContext.publishEvent(new MyEvent(this));
}
 
Example #9
Source File: ReferenceStoringProcessApplication.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@PostDeploy
public void postDeploy() {
  INSTANCE = this;
}
 
Example #10
Source File: CustomEjbProcessApplication.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@PostDeploy
public void postDeploy(ProcessEngine processEngine) {
  Assert.assertNotNull(processEngine);
}
 
Example #11
Source File: PostDeployInjectApp.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@PostDeploy
public void injectDefaultEngine(ProcessEngine processEngine, List<ProcessEngine> processEngines, ProcessApplicationInfo processApplicationInfo) {
  PostDeployInjectApp.processEngine = processEngine;
  PostDeployInjectApp.processEngines = processEngines;
  PostDeployInjectApp.processApplicationInfo = processApplicationInfo;
}
 
Example #12
Source File: PostDeployFailureApp.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@PostDeploy
public void fail() {
  throw new RuntimeException("expected exception");
}
 
Example #13
Source File: CustomSpringServletProcessApplication.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@PostDeploy
public void postDeploy() {
  isPostDeployInvoked = true;
}
 
Example #14
Source File: SpringBootProcessApplication.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@PostDeploy
public void onPostDeploy(ProcessEngine processEngine) {
  eventPublisher.publishEvent(new PostDeployEvent(processEngine));
}
 
Example #15
Source File: MyProcessApplication.java    From camunda-bpm-platform-osgi with Apache License 2.0 4 votes vote down vote up
/**
 * @param processEngine
 */
@PostDeploy
public void sayHello(ProcessEngine processEngine) {
}
 
Example #16
Source File: SpringBootProcessApplication.java    From camunda-bpm-spring-boot-starter with Apache License 2.0 4 votes vote down vote up
@PostDeploy
public void onPostDeploy(ProcessEngine processEngine) {
  eventPublisher.publishEvent(new PostDeployEvent(processEngine));
}
 
Example #17
Source File: PaDataformatAndPostDeployApp.java    From camunda-bpm-platform with Apache License 2.0 2 votes vote down vote up
@PostDeploy
public void onPaDeployed(ProcessEngine e) throws Exception {

  assertNotNull(getVariableSerializers());

}