Search in sources :

Example 1 with ProcessEngineImpl

use of org.camunda.bpm.engine.impl.ProcessEngineImpl in project camunda-bpm-platform by camunda.

the class DbSchemaPrune method main.

public static void main(String[] args) {
    ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
    CommandExecutor commandExecutor = processEngine.getProcessEngineConfiguration().getCommandExecutorTxRequired();
    commandExecutor.execute(new Command<Object>() {

        public Object execute(CommandContext commandContext) {
            commandContext.getSession(PersistenceSession.class).dbSchemaPrune();
            return null;
        }
    });
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) CommandExecutor(org.camunda.bpm.engine.impl.interceptor.CommandExecutor) ProcessEngineImpl(org.camunda.bpm.engine.impl.ProcessEngineImpl)

Example 2 with ProcessEngineImpl

use of org.camunda.bpm.engine.impl.ProcessEngineImpl in project camunda-bpm-platform by camunda.

the class DbSchemaDrop method main.

public static void main(String[] args) {
    ProcessEngineImpl processEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
    CommandExecutor commandExecutor = processEngine.getProcessEngineConfiguration().getCommandExecutorTxRequired();
    commandExecutor.execute(new Command<Object>() {

        public Object execute(CommandContext commandContext) {
            commandContext.getSession(PersistenceSession.class).dbSchemaDrop();
            return null;
        }
    });
    processEngine.close();
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) CommandExecutor(org.camunda.bpm.engine.impl.interceptor.CommandExecutor) ProcessEngineImpl(org.camunda.bpm.engine.impl.ProcessEngineImpl)

Example 3 with ProcessEngineImpl

use of org.camunda.bpm.engine.impl.ProcessEngineImpl in project camunda-bpm-platform by camunda.

the class StringUtil method fromBytes.

/**
 * converts a byte array into a string using the provided process engine's default charset as
 * returned by {@link ProcessEngineConfigurationImpl#getDefaultCharset()}
 *
 * @param bytes the byte array
 * @param processEngine the process engine
 * @return a string representing the bytes
 */
public static String fromBytes(byte[] bytes, ProcessEngine processEngine) {
    ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
    Charset charset = processEngineConfiguration.getDefaultCharset();
    return new String(bytes, charset);
}
Also used : Charset(java.nio.charset.Charset) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ProcessEngineImpl(org.camunda.bpm.engine.impl.ProcessEngineImpl)

Example 4 with ProcessEngineImpl

use of org.camunda.bpm.engine.impl.ProcessEngineImpl in project camunda-bpm-platform by camunda.

the class StringUtil method toByteArray.

/**
 * Gets the bytes from a string using the provided process engine's default charset
 *
 * @param string the string to get the bytes form
 * @param processEngine the process engine to use
 * @return the byte array
 */
public static byte[] toByteArray(String string, ProcessEngine processEngine) {
    ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
    Charset charset = processEngineConfiguration.getDefaultCharset();
    return string.getBytes(charset);
}
Also used : Charset(java.nio.charset.Charset) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ProcessEngineImpl(org.camunda.bpm.engine.impl.ProcessEngineImpl)

Example 5 with ProcessEngineImpl

use of org.camunda.bpm.engine.impl.ProcessEngineImpl in project camunda-bpm-platform by camunda.

the class DatabaseHistoryPropertyAutoTest method usesDefaultValueAuditWhenNoValueIsConfigured.

@Test
public void usesDefaultValueAuditWhenNoValueIsConfigured() {
    final ProcessEngineConfigurationImpl config = config("true", ProcessEngineConfiguration.HISTORY_AUTO);
    ProcessEngineImpl processEngine = buildEngine(config);
    final Integer level = config.getCommandExecutorSchemaOperations().execute(new Command<Integer>() {

        @Override
        public Integer execute(CommandContext commandContext) {
            return HistoryLevelSetupCommand.databaseHistoryLevel(commandContext);
        }
    });
    assertThat(level, equalTo(HistoryLevel.HISTORY_LEVEL_AUDIT.getId()));
    assertThat(processEngine.getProcessEngineConfiguration().getHistoryLevel(), equalTo(HistoryLevel.HISTORY_LEVEL_AUDIT));
}
Also used : CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ProcessEngineImpl(org.camunda.bpm.engine.impl.ProcessEngineImpl) Test(org.junit.Test)

Aggregations

ProcessEngineImpl (org.camunda.bpm.engine.impl.ProcessEngineImpl)17 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)7 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)5 CommandExecutor (org.camunda.bpm.engine.impl.interceptor.CommandExecutor)3 Charset (java.nio.charset.Charset)2 CachePurgeReport (org.camunda.bpm.engine.impl.persistence.deploy.cache.CachePurgeReport)2 Test (org.junit.Test)2 Date (java.util.Date)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1 ProcessEngineConfiguration (org.camunda.bpm.engine.ProcessEngineConfiguration)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 RepositoryService (org.camunda.bpm.engine.RepositoryService)1 ManagementServiceImpl (org.camunda.bpm.engine.impl.ManagementServiceImpl)1 StandaloneInMemProcessEngineConfiguration (org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration)1 AcquireJobsCmd (org.camunda.bpm.engine.impl.cmd.AcquireJobsCmd)1 PersistenceSession (org.camunda.bpm.engine.impl.db.PersistenceSession)1 JobExecutor (org.camunda.bpm.engine.impl.jobexecutor.JobExecutor)1 DatabasePurgeReport (org.camunda.bpm.engine.impl.management.DatabasePurgeReport)1 PurgeReport (org.camunda.bpm.engine.impl.management.PurgeReport)1 Deployment (org.camunda.bpm.engine.repository.Deployment)1