Java Code Examples for org.camunda.bpm.engine.impl.context.Context#getProcessEngineConfiguration()
The following examples show how to use
org.camunda.bpm.engine.impl.context.Context#getProcessEngineConfiguration() .
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: SpinObjectValueSerializer.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected Object deserializeFromByteArray(byte[] bytes, String objectTypeName) throws Exception { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); DataFormatMapper mapper = dataFormat.getMapper(); DataFormatReader reader = dataFormat.getReader(); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); InputStreamReader inReader = new InputStreamReader(bais, processEngineConfiguration.getDefaultCharset()); BufferedReader bufferedReader = new BufferedReader(inReader); try { Object mappedObject = reader.readInput(bufferedReader); return mapper.mapInternalToJava(mappedObject, objectTypeName, getValidator(processEngineConfiguration)); } finally{ IoUtil.closeSilently(bais); IoUtil.closeSilently(inReader); IoUtil.closeSilently(bufferedReader); } }
Example 2
Source File: ExecutionEntity.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Override public void fireHistoricProcessStartEvent() { ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration(); HistoryLevel historyLevel = configuration.getHistoryLevel(); // TODO: This smells bad, as the rest of the history is done via the // ParseListener if (historyLevel.isHistoryEventProduced(HistoryEventTypes.PROCESS_INSTANCE_START, processInstance)) { HistoryEventProcessor.processHistoryEvents(new HistoryEventProcessor.HistoryEventCreator() { @Override public HistoryEvent createHistoryEvent(HistoryEventProducer producer) { return producer.createProcessInstanceStartEvt(processInstance); } }); } }
Example 3
Source File: DbEntityManager.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
protected void initializeEntityCache() { final JobExecutorContext jobExecutorContext = Context.getJobExecutorContext(); final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if(processEngineConfiguration != null && processEngineConfiguration.isDbEntityCacheReuseEnabled() && jobExecutorContext != null) { dbEntityCache = jobExecutorContext.getEntityCache(); if(dbEntityCache == null) { dbEntityCache = new DbEntityCache(processEngineConfiguration.getDbEntityCacheKeyMapping()); jobExecutorContext.setEntityCache(dbEntityCache); } } else { if (processEngineConfiguration != null) { dbEntityCache = new DbEntityCache(processEngineConfiguration.getDbEntityCacheKeyMapping()); } else { dbEntityCache = new DbEntityCache(); } } }
Example 4
Source File: CaseDefinitionEntity.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
/** * Returns the cached version if exists; does not update the entity from the database in that case */ protected CaseDefinitionEntity loadCaseDefinition(String caseDefinitionId) { ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration(); DeploymentCache deploymentCache = configuration.getDeploymentCache(); CaseDefinitionEntity caseDefinition = deploymentCache.findCaseDefinitionFromCache(caseDefinitionId); if (caseDefinition == null) { CommandContext commandContext = Context.getCommandContext(); CaseDefinitionManager caseDefinitionManager = commandContext.getCaseDefinitionManager(); caseDefinition = caseDefinitionManager.findCaseDefinitionById(caseDefinitionId); if (caseDefinition != null) { caseDefinition = deploymentCache.resolveCaseDefinition(caseDefinition); } } return caseDefinition; }
Example 5
Source File: AbstractVariableScope.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
/** * Checks, if Java serialization will be used and if it is allowed to be used. * @param variableName * @param value */ protected void checkJavaSerialization(String variableName, TypedValue value) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if (value instanceof SerializableValue && !processEngineConfiguration.isJavaSerializationFormatEnabled()) { SerializableValue serializableValue = (SerializableValue) value; // if Java serialization is prohibited if (!serializableValue.isDeserialized()) { String javaSerializationDataFormat = Variables.SerializationDataFormats.JAVA.getName(); String requestedDataFormat = serializableValue.getSerializationDataFormat(); if (requestedDataFormat == null) { // check if Java serializer will be used final TypedValueSerializer serializerForValue = TypedValueField.getSerializers() .findSerializerForValue(serializableValue, processEngineConfiguration.getFallbackSerializerFactory()); if (serializerForValue != null) { requestedDataFormat = serializerForValue.getSerializationDataformat(); } } if (javaSerializationDataFormat.equals(requestedDataFormat)) { throw ProcessEngineLogger.CORE_LOGGER.javaSerializationProhibitedException(variableName); } } } }
Example 6
Source File: ReportDbMetricsCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public Void execute(CommandContext commandContext) { ProcessEngineConfigurationImpl engineConfiguration = Context.getProcessEngineConfiguration(); if (!engineConfiguration.isMetricsEnabled()) { throw new ProcessEngineException("Metrics reporting is disabled"); } if (!engineConfiguration.isDbMetricsReporterActivate()) { throw new ProcessEngineException("Metrics reporting to database is disabled"); } DbMetricsReporter dbMetricsReporter = engineConfiguration.getDbMetricsReporter(); dbMetricsReporter.reportNow(); return null; }
Example 7
Source File: MyTaskFormHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void submitFormVariables(VariableMap properties, VariableScope variableScope) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); IdentityService identityService = processEngineConfiguration.getIdentityService(); RuntimeService runtimeService = processEngineConfiguration.getRuntimeService(); logAuthentication(identityService); logInstancesCount(runtimeService); }
Example 8
Source File: JobDeclaration.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public Date resolveDueDate(S context) { ProcessEngineConfiguration processEngineConfiguration = Context.getProcessEngineConfiguration(); if (processEngineConfiguration != null && (processEngineConfiguration.isJobExecutorAcquireByDueDate() || processEngineConfiguration.isEnsureJobDueDateNotNull())) { return ClockUtil.getCurrentTime(); } else { return null; } }
Example 9
Source File: MetricsDecisionEvaluationListener.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void notify(DmnDecisionEvaluationEvent evaluationEvent) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if (processEngineConfiguration != null && processEngineConfiguration.isMetricsEnabled()) { MetricsRegistry metricsRegistry = processEngineConfiguration.getMetricsRegistry(); metricsRegistry.markOccurrence(Metrics.EXECUTED_DECISION_INSTANCES, evaluationEvent.getExecutedDecisionInstances()); metricsRegistry.markOccurrence(Metrics.EXECUTED_DECISION_ELEMENTS, evaluationEvent.getExecutedDecisionElements()); } }
Example 10
Source File: RegisterProcessApplicationCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public ProcessApplicationRegistration execute(CommandContext commandContext) { commandContext.getAuthorizationManager().checkCamundaAdmin(); final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); final ProcessApplicationManager processApplicationManager = processEngineConfiguration.getProcessApplicationManager(); return processApplicationManager.registerProcessApplicationForDeployments(deploymentsToRegister, reference); }
Example 11
Source File: AbstractPersistenceSession.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void dbSchemaUpdate() { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if (!isEngineTablePresent()) { dbSchemaCreateEngine(); } if (!isHistoryTablePresent() && processEngineConfiguration.isDbHistoryUsed()) { dbSchemaCreateHistory(); } if (!isIdentityTablePresent() && processEngineConfiguration.isDbIdentityUsed()) { dbSchemaCreateIdentity(); } if (!isCmmnTablePresent() && processEngineConfiguration.isCmmnEnabled()) { dbSchemaCreateCmmn(); } if (!isCmmnHistoryTablePresent() && processEngineConfiguration.isCmmnEnabled() && processEngineConfiguration.isDbHistoryUsed()) { dbSchemaCreateCmmnHistory(); } if (!isDmnTablePresent() && processEngineConfiguration.isDmnEnabled()) { dbSchemaCreateDmn(); } if(!isDmnHistoryTablePresent() && processEngineConfiguration.isDmnEnabled() && processEngineConfiguration.isDbHistoryUsed()) { dbSchemaCreateDmnHistory(); } }
Example 12
Source File: ScriptingEnvironment.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected Map<String, List<ExecutableScript>> getEnv(String language) { ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration(); ProcessApplicationReference processApplication = Context.getCurrentProcessApplication(); Map<String, List<ExecutableScript>> result = null; if (config.isEnableFetchScriptEngineFromProcessApplication()) { if(processApplication != null) { result = getPaEnvScripts(processApplication); } } return result != null ? result : env; }
Example 13
Source File: MyStartFormHandler.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void submitFormVariables(VariableMap properties, VariableScope variableScope) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); IdentityService identityService = processEngineConfiguration.getIdentityService(); RuntimeService runtimeService = processEngineConfiguration.getRuntimeService(); logAuthentication(identityService); logInstancesCount(runtimeService); }
Example 14
Source File: ScriptBindings.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected boolean isAutoStoreScriptVariablesEnabled() { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if(processEngineConfiguration != null) { return processEngineConfiguration.isAutoStoreScriptVariables(); } return false; }
Example 15
Source File: HistoryLevelSetupCommand.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static void dbCreateHistoryLevel(CommandContext commandContext) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); HistoryLevel configuredHistoryLevel = processEngineConfiguration.getHistoryLevel(); PropertyEntity property = new PropertyEntity("historyLevel", Integer.toString(configuredHistoryLevel.getId())); commandContext.getSession(DbEntityManager.class).insert(property); LOG.creatingHistoryLevelPropertyInDatabase(configuredHistoryLevel); }
Example 16
Source File: ScriptUtil.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
/** * Returns the configured script factory in the context or a new one. */ public static ScriptFactory getScriptFactory() { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if (processEngineConfiguration != null) { return processEngineConfiguration.getScriptFactory(); } else { return new ScriptFactory(); } }
Example 17
Source File: DefaultDelegateInterceptor.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void handleInvocationInContext(final DelegateInvocation invocation) throws Exception { CommandContext commandContext = Context.getCommandContext(); boolean wasAuthorizationCheckEnabled = commandContext.isAuthorizationCheckEnabled(); boolean wasUserOperationLogEnabled = commandContext.isUserOperationLogEnabled(); BaseDelegateExecution contextExecution = invocation.getContextExecution(); ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration(); boolean popExecutionContext = false; try { if (!configuration.isAuthorizationEnabledForCustomCode()) { // the custom code should be executed without authorization commandContext.disableAuthorizationCheck(); } try { commandContext.disableUserOperationLog(); try { if (contextExecution != null && !isCurrentContextExecution(contextExecution)) { popExecutionContext = setExecutionContext(contextExecution); } invocation.proceed(); } finally { if (popExecutionContext) { Context.removeExecutionContext(); } } } finally { if (wasUserOperationLogEnabled) { commandContext.enableUserOperationLog(); } } } finally { if (wasAuthorizationCheckEnabled) { commandContext.enableAuthorizationCheck(); } } }
Example 18
Source File: TaskEntity.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void executeMetrics(String metricsName) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if(processEngineConfiguration.isMetricsEnabled()) { processEngineConfiguration.getMetricsRegistry().markOccurrence(Metrics.ACTIVTY_INSTANCE_START); } }
Example 19
Source File: HistoricJobLogManager.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected boolean isHistoryEventProduced(HistoryEventType eventType, Job job) { ProcessEngineConfigurationImpl configuration = Context.getProcessEngineConfiguration(); HistoryLevel historyLevel = configuration.getHistoryLevel(); return historyLevel.isHistoryEventProduced(eventType, job); }
Example 20
Source File: StringUtil.java From camunda-bpm-platform with Apache License 2.0 | 2 votes |
/** * Converts a byte array into a string using the current process engines default charset as * returned by {@link ProcessEngineConfigurationImpl#getDefaultCharset()}. The converted string * is empty if the provided byte array is empty or <code>null</code>. * * @param bytes the byte array * @return a string representing the bytes, empty String if byte array is <code>null</code> */ public static String fromBytes(byte[] bytes) { EnsureUtil.ensureActiveCommandContext("StringUtil.fromBytes"); ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); return fromBytes(bytes, processEngineConfiguration.getProcessEngine()); }