code
stringlengths
25
201k
docstring
stringlengths
19
96.2k
func_name
stringlengths
0
235
language
stringclasses
1 value
repo
stringlengths
8
51
path
stringlengths
11
314
url
stringlengths
62
377
license
stringclasses
7 values
private void stopProcessEngine(String serviceName, PlatformServiceContainer serviceContainer) { try { serviceContainer.stopService(serviceName); } catch(Exception e) { LOG.exceptionWhileStopping("Process Engine", serviceName, e); } }
Stops a process engine, failures are logged but no exceptions are thrown.
stopProcessEngine
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/deployment/StopProcessEnginesStep.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/deployment/StopProcessEnginesStep.java
Apache-2.0
public static Map<String, byte[]> findResources(ClassLoader classLoader, String paResourceRootPath, URL metaFileUrl) { return findResources(classLoader, paResourceRootPath, metaFileUrl, null); }
@param classLoader the classloader to scan @param paResourceRootPath see {@link ProcessArchiveXml#PROP_RESOURCE_ROOT_PATH} @param metaFileUrl the URL to the META-INF/processes.xml file @return a Map of process definitions
findResources
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/deployment/scanning/ProcessApplicationScanningUtil.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/deployment/scanning/ProcessApplicationScanningUtil.java
Apache-2.0
protected static boolean checkDiagram(String fileName, String modelFileName, String[] diagramSuffixes, String[] modelSuffixes) { for (String modelSuffix : modelSuffixes) { if (modelFileName.endsWith(modelSuffix)) { String caseFilePrefix = modelFileName.substring(0, modelFileName.length() - modelSuffix.length()); if (fileName.startsWith(caseFilePrefix)) { for (String diagramResourceSuffix : diagramSuffixes) { if (fileName.endsWith(diagramResourceSuffix)) { return true; } } } } } return false; }
Checks, whether a filename is a diagram for the given modelFileName. @param fileName filename to check. @param modelFileName model file name. @param diagramSuffixes suffixes of the diagram files. @param modelSuffixes suffixes of model files. @return true, if a file is a diagram for the model.
checkDiagram
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/deployment/scanning/ProcessApplicationScanningUtil.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/deployment/scanning/ProcessApplicationScanningUtil.java
Apache-2.0
@SuppressWarnings("unchecked") public <S> List<PlatformService<S>> getServicesByType(ServiceType type) { // query the MBeanServer for all services of the given type Set<String> serviceNames = getServiceNames(type); List<PlatformService<S>> res = new ArrayList<PlatformService<S>>(); for (String serviceName : serviceNames) { res.add((PlatformService<S>) servicesByName.get(getObjectName(serviceName))); } return res; }
@return all services for a specific {@link ServiceType}
getServicesByType
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/jmx/MBeanServiceContainer.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/jmx/MBeanServiceContainer.java
Apache-2.0
public Set<String> getServiceNames(ServiceType type) { String typeName = composeLocalName(type, "*"); ObjectName typeObjectName = getObjectName(typeName); Set<ObjectName> resultNames = getmBeanServer().queryNames(typeObjectName, null); Set<String> result= new HashSet<String>(); for (ObjectName objectName : resultNames) { result.add(objectName.toString()); } return result; }
@return the service names ( {@link ObjectName} ) for all services for a given type
getServiceNames
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/jmx/MBeanServiceContainer.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/jmx/MBeanServiceContainer.java
Apache-2.0
public void start(PlatformServiceContainer contanier) { processEngine = processEngineConfiguration.buildProcessEngine(); }
<p>Represents a managed process engine that is started / stopped inside the {@link MBeanServiceContainer}</p> @author Daniel Meyer
start
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/jmx/services/JmxManagedProcessEngineController.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/jmx/services/JmxManagedProcessEngineController.java
Apache-2.0
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { return BpmPlatform.getProcessApplicationService(); }
<p>{@link ObjectFactory} that can be used for binding the {@link ProcessApplicationService} into JNDI</p> @author Roman Smirnov @author Daniel Meyer
getObjectInstance
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/jndi/ProcessApplicationServiceObjectFactory.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/jndi/ProcessApplicationServiceObjectFactory.java
Apache-2.0
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { return BpmPlatform.getProcessEngineService(); }
<p>{@link ObjectFactory} that can be used for binding the {@link ProcessEngineService} into JNDI</p> @author Roman Smirnov @author Daniel Meyer
getObjectInstance
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/jndi/ProcessEngineServiceObjectFactory.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/jndi/ProcessEngineServiceObjectFactory.java
Apache-2.0
protected void parseRootElement() { JobExecutorXmlImpl jobExecutor = new JobExecutorXmlImpl(); List<ProcessEngineXml> processEngines = new ArrayList<ProcessEngineXml>(); for (Element element : rootElement.elements()) { if(JOB_EXECUTOR.equals(element.getTagName())) { parseJobExecutor(element, jobExecutor); } else if(PROCESS_ENGINE.equals(element.getTagName())) { parseProcessEngine(element, processEngines); } } bpmPlatformXml = new BpmPlatformXmlImpl(jobExecutor, processEngines); }
We know this is a <code>&lt;bpm-platform ../&gt;</code> element
parseRootElement
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/BpmPlatformXmlParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/metadata/BpmPlatformXmlParse.java
Apache-2.0
protected void parseJobExecutor(Element element, JobExecutorXmlImpl jobExecutorXml) { List<JobAcquisitionXml> jobAcquisitions = new ArrayList<JobAcquisitionXml>(); Map<String, String> properties = new HashMap<String, String>(); for (Element childElement : element.elements()) { if(JOB_ACQUISITION.equals(childElement.getTagName())) { parseJobAcquisition(childElement, jobAcquisitions); }else if(PROPERTIES.equals(childElement.getTagName())){ parseProperties(childElement, properties); } } jobExecutorXml.setJobAcquisitions(jobAcquisitions); jobExecutorXml.setProperties(properties); }
parse a <code>&lt;job-executor .../&gt;</code> element and add it to the list of parsed elements
parseJobExecutor
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/BpmPlatformXmlParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/metadata/BpmPlatformXmlParse.java
Apache-2.0
public Parse execute() { super.execute(); try { parseRootElement(); } catch (Exception e) { throw LOG.unknownExceptionWhileParsingDeploymentDescriptor(e); } finally { if (hasWarnings()) { logWarnings(); } if (hasErrors()) { throwExceptionForErrors(); } } return this; }
<p>{@link Parse} implementation for Deployment Metadata.</p> <p>This class is NOT Threadsafe</p> @author Daniel Meyer
execute
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/DeploymentMetadataParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/metadata/DeploymentMetadataParse.java
Apache-2.0
protected void parseProcessEngine(Element element, List<ProcessEngineXml> parsedProcessEngines) { ProcessEngineXmlImpl processEngine = new ProcessEngineXmlImpl(); // set name processEngine.setName(element.attribute(NAME)); // set default String defaultValue = element.attribute(DEFAULT); if(defaultValue == null || defaultValue.isEmpty()) { processEngine.setDefault(false); } else { processEngine.setDefault(Boolean.parseBoolean(defaultValue)); } Map<String, String> properties = new HashMap<String, String>(); List<ProcessEnginePluginXml> plugins = new ArrayList<ProcessEnginePluginXml>(); for (Element childElement : element.elements()) { if(CONFIGURATION.equals(childElement.getTagName())) { processEngine.setConfigurationClass(childElement.getText()); } else if(DATASOURCE.equals(childElement.getTagName())) { processEngine.setDatasource(childElement.getText()); } else if(JOB_ACQUISITION.equals(childElement.getTagName())) { processEngine.setJobAcquisitionName(childElement.getText()); } else if(PROPERTIES.equals(childElement.getTagName())) { parseProperties(childElement, properties); } else if(PLUGINS.equals(childElement.getTagName())) { parseProcessEnginePlugins(childElement, plugins); } } // set collected properties processEngine.setProperties(properties); // set plugins processEngine.setPlugins(plugins); // add the process engine to the list of parsed engines. parsedProcessEngines.add(processEngine); }
parse a <code>&lt;process-engine .../&gt;</code> element and add it to the list of parsed elements
parseProcessEngine
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/DeploymentMetadataParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/metadata/DeploymentMetadataParse.java
Apache-2.0
protected void parseProcessEnginePlugins(Element element, List<ProcessEnginePluginXml> plugins) { for (Element chidElement : element.elements()) { if(PLUGIN.equals(chidElement.getTagName())) { parseProcessEnginePlugin(chidElement, plugins); } } }
Transform a <code>&lt;plugins ... /&gt;</code> structure.
parseProcessEnginePlugins
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/DeploymentMetadataParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/metadata/DeploymentMetadataParse.java
Apache-2.0
protected void parseProcessEnginePlugin(Element element, List<ProcessEnginePluginXml> plugins) { ProcessEnginePluginXmlImpl plugin = new ProcessEnginePluginXmlImpl(); Map<String, String> properties = new HashMap<String, String>(); for (Element childElement : element.elements()) { if(PLUGIN_CLASS.equals(childElement.getTagName())) { plugin.setPluginClass(childElement.getText()); } else if(PROPERTIES.equals(childElement.getTagName())) { parseProperties(childElement, properties); } } plugin.setProperties(properties); plugins.add(plugin); }
Transform a <code>&lt;plugin ... /&gt;</code> structure.
parseProcessEnginePlugin
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/DeploymentMetadataParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/metadata/DeploymentMetadataParse.java
Apache-2.0
protected void parseProperties(Element element, Map<String, String> properties) { for (Element childElement : element.elements()) { if(PROPERTY.equals(childElement.getTagName())) { String resolved = PropertyHelper.resolveProperty(System.getProperties(), childElement.getText()); properties.put(childElement.attribute(NAME), resolved); } } }
Transform a <pre> &lt;properties&gt; &lt;property name="name"&gt;value&lt;/property&gt; &lt;/properties&gt; </pre> structure into a properties {@link Map} Supports resolution of Ant-style placeholders against system properties.
parseProperties
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/DeploymentMetadataParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/metadata/DeploymentMetadataParse.java
Apache-2.0
public static boolean getBooleanProperty(Map<String, String> properties, String name, boolean defaultValue) { String value = properties.get(name); if(value == null) { return defaultValue; } else { return Boolean.parseBoolean(value); } }
Regex for Ant-style property placeholders
getBooleanProperty
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java
Apache-2.0
public static void applyProperties(Object configuration, Map<String, String> properties, String namingStrategy) { for (Map.Entry<String, String> property : properties.entrySet()) { String key = property.getKey(); if (!CAMEL_CASE.equals(namingStrategy)) { key = convertToCamelCase(key, namingStrategy); } applyProperty(configuration, key, property.getValue()); } }
Sets an objects fields via reflection from String values. Depending on the field's type the respective values are converted to int or boolean. This method allows to specify a property naming strategy, i.e., if a property is written in <code>camelCase</code>, <code>kebab-case</code>, or <code>snake_case</code>. @param configuration @param properties @param namingStrategy can be either {@link PropertyHelper#KEBAB_CASE}, {@link PropertyHelper#SNAKE_CASE}, or {@link PropertyHelper#CAMEL_CASE}. @throws ProcessEngineException if a property is supplied that matches no field or if the field's type is not String, nor int, nor boolean.
applyProperties
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java
Apache-2.0
public static void applyProperties(Object configuration, Map<String, String> properties) { applyProperties(configuration, properties, CAMEL_CASE); }
Sets an objects fields via reflection from String values. Depending on the field's type the respective values are converted to int or boolean. @param configuration @param properties @throws ProcessEngineException if a property is supplied that matches no field or if the field's type is not String, nor int, nor boolean.
applyProperties
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java
Apache-2.0
public void cancelOperationStep(DeploymentOperation operationContext){ // default behavior is to to nothing if the step fails }
<p>An atomic step that is part of a composite {@link DeploymentOperation}.</p> @author Daniel Meyer
cancelOperationStep
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/spi/DeploymentOperationStep.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/spi/DeploymentOperationStep.java
Apache-2.0
public String getTypeName() { return serviceRealm; }
The service types managed by this container.
getTypeName
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/spi/ServiceTypes.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/container/impl/spi/ServiceTypes.java
Apache-2.0
@Deprecated public String getResourceType() { String resourceType = null; if (missingAuthorizations.size() == 1) { resourceType = missingAuthorizations.get(0).getResourceType(); } return resourceType; }
@return the type of the resource if there is only one {@link MissingAuthorization}, {@code null} otherwise @deprecated Use {@link #getMissingAuthorizations()} to get the type of the resource of the {@link MissingAuthorization}(s). This method may be removed in future versions.
getResourceType
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
Apache-2.0
@Deprecated public String getViolatedPermissionName() { if (missingAuthorizations.size() == 1) { return missingAuthorizations.get(0).getViolatedPermissionName(); } return null; }
@return the type of the violated permission name if there is only one {@link MissingAuthorization}, {@code null} otherwise @deprecated Use {@link #getMissingAuthorizations()} to get the violated permission name of the {@link MissingAuthorization}(s). This method may be removed in future versions.
getViolatedPermissionName
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
Apache-2.0
public String getUserId() { return userId; }
@return id of the user in which context the request was made and who misses authorizations to perform it successfully
getUserId
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
Apache-2.0
@Deprecated public String getResourceId() { if (missingAuthorizations.size() == 1) { return missingAuthorizations.get(0).getResourceId(); } return null; }
@return the id of the resource if there is only one {@link MissingAuthorization}, {@code null} otherwise @deprecated Use {@link #getMissingAuthorizations()} to get the id of the resource of the {@link MissingAuthorization}(s). This method may be removed in future versions.
getResourceId
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
Apache-2.0
public List<MissingAuthorization> getMissingAuthorizations() { return Collections.unmodifiableList(missingAuthorizations); }
@return Disjunctive list of {@link MissingAuthorization} from which a user needs to have at least one for the authorization to pass
getMissingAuthorizations
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
Apache-2.0
private static String generateExceptionMessage(String userId, List<MissingAuthorization> missingAuthorizations) { StringBuilder sBuilder = new StringBuilder(); sBuilder.append("The user with id '"); sBuilder.append(userId); sBuilder.append("' does not have one of the following permissions: "); sBuilder.append(generateMissingAuthorizationsList(missingAuthorizations)); return sBuilder.toString(); }
Generate exception message from the missing authorizations. @param userId to use @param missingAuthorizations to use @return The prepared exception message
generateExceptionMessage
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
Apache-2.0
public static String generateMissingAuthorizationsList(List<MissingAuthorization> missingAuthorizations) { StringBuilder sBuilder = new StringBuilder(); boolean first = true; for(MissingAuthorization missingAuthorization: missingAuthorizations) { if (!first) { sBuilder.append(" or "); } else { first = false; } sBuilder.append(generateMissingAuthorizationMessage(missingAuthorization)); } return sBuilder.toString(); }
Generate a String containing a list of missing authorizations. @param missingAuthorizations
generateMissingAuthorizationsList
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
Apache-2.0
private static String generateMissingAuthorizationMessage(MissingAuthorization exceptionInfo) { StringBuilder builder = new StringBuilder(); String permissionName = exceptionInfo.getViolatedPermissionName(); String resourceType = exceptionInfo.getResourceType(); String resourceId = exceptionInfo.getResourceId(); builder.append("'"); builder.append(permissionName); builder.append("' permission on resource '"); builder.append((resourceId != null ? (resourceId+"' of type '") : "" )); builder.append(resourceType); builder.append("'"); return builder.toString(); }
Generated exception message for the missing authorization. @param exceptionInfo to use
generateMissingAuthorizationMessage
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/AuthorizationException.java
Apache-2.0
public Element getElement() { return element; }
Exception during the parsing of an BPMN model.
getElement
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/BpmnParseException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/BpmnParseException.java
Apache-2.0
public String getClassName() { return className; }
Returns the name of the class this exception is related to.
getClassName
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/ClassLoadingException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/ClassLoadingException.java
Apache-2.0
public Integer getJdbcStatementTimeout() { return jdbcStatementTimeout; }
Gets the number of seconds the jdbc driver will wait for a response from the database.
getJdbcStatementTimeout
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/ProcessEngineConfiguration.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/ProcessEngineConfiguration.java
Apache-2.0
public void setCode(int code) { this.code = code; }
<p>The exception code can be set via delegation code. <p>Setting an error code on the exception in delegation code always overrides the exception code from a custom {@link ExceptionCodeProvider}. <p>Your business logic can react to the exception code exposed via {@link #getCode} when calling Camunda Java API and is even exposed to the REST API when an error occurs.
setCode
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/ProcessEngineException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/ProcessEngineException.java
Apache-2.0
public int getCode() { return code; }
<p>Accessor of the exception error code. <p>If not changed via {@link #setCode}, default code is {@link BuiltinExceptionCode#FALLBACK} which is always overridden by a custom or built-in error code provider. <p>You can implement a custom {@link ExceptionCodeProvider} and register it in the {@link ProcessEngineConfigurationImpl} via the {@code customExceptionCodeProvider} property.
getCode
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/ProcessEngineException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/ProcessEngineException.java
Apache-2.0
public static void registerProcessEngine(ProcessEngine processEngine) { processEngines.put(processEngine.getName(), processEngine); }
Registers the given process engine. No {@link ProcessEngineInfo} will be available for this process engine. An engine that is registered will be closed when the {@link ProcessEngines#destroy()} is called.
registerProcessEngine
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/ProcessEngines.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/ProcessEngines.java
Apache-2.0
public static ProcessEngine getProcessEngine(String processEngineName, boolean forceCreate) { if (!isInitialized) { init(forceCreate); } return processEngines.get(processEngineName); }
obtain a process engine by name. @param processEngineName is the name of the process engine or null for the default process engine.
getProcessEngine
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/ProcessEngines.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/ProcessEngines.java
Apache-2.0
public static ProcessEngineInfo retry(String resourceUrl) { try { return initProcessEngineFromResource(new URL(resourceUrl)); } catch (MalformedURLException e) { throw new ProcessEngineException("invalid url: "+resourceUrl, e); } }
retries to initialize a process engine that previously failed.
retry
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/ProcessEngines.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/ProcessEngines.java
Apache-2.0
public static Map<String, ProcessEngine> getProcessEngines() { return processEngines; }
provides access to process engine to application clients in a managed server environment.
getProcessEngines
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/ProcessEngines.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/ProcessEngines.java
Apache-2.0
public synchronized static void destroy() { if (isInitialized) { Map<String, ProcessEngine> engines = new HashMap<String, ProcessEngine>(processEngines); processEngines = new HashMap<String, ProcessEngine>(); for (String processEngineName: engines.keySet()) { ProcessEngine processEngine = engines.get(processEngineName); try { processEngine.close(); } catch (Exception e) { LOG.exceptionWhileClosingProcessEngine(processEngineName==null ? "the default process engine" : "process engine "+processEngineName, e); } } processEngineInfosByName.clear(); processEngineInfosByResourceUrl.clear(); processEngineInfos.clear(); isInitialized = false; } }
closes all process engines. This method should be called when the server shuts down.
destroy
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/ProcessEngines.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/ProcessEngines.java
Apache-2.0
public String getLibraryVersion() { return libraryVersion; }
The version of the Activiti library used.
getLibraryVersion
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/WrongDbException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/WrongDbException.java
Apache-2.0
public String getDbVersion() { return dbVersion; }
The version of the Activiti library that was used to create the database schema.
getDbVersion
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/WrongDbException.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/WrongDbException.java
Apache-2.0
public static DelegateExecution getCurrentDelegationExecution() { BpmnExecutionContext bpmnExecutionContext = Context.getBpmnExecutionContext(); ExecutionEntity executionEntity = null; if (bpmnExecutionContext != null) { executionEntity = bpmnExecutionContext.getExecution(); } return executionEntity; }
Returns the current delegation execution or null if the execution is not available. @return the current delegation execution or null if not available
getCurrentDelegationExecution
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/context/DelegateExecutionContext.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/context/DelegateExecutionContext.java
Apache-2.0
public static <T> T withNewProcessEngineContext(Callable<T> callable) throws Exception { try { requiresNew(); return callable.call(); } finally { clear(); } }
<p>Takes a callable and executes all engine API invocations within that callable in a new Process Engine Context. Please see the {@link ProcessEngineContext} class documentation for a more detailed description on the purpose of this method.</p> An alternative to calling: <code> try { requiresNew(); callable.call(); } finally { clear(); } </code> @param callable the callable to execute @return what is defined by the callable passed to the method @throws Exception
withNewProcessEngineContext
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/context/ProcessEngineContext.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/context/ProcessEngineContext.java
Apache-2.0
default boolean execute(String candidatePassword, User user) { return execute(candidatePassword); }
Checks the given password and the user against this rule. @param candidatePassword which is checked against a password policy @param user to be taken into account when checking the candidate password. Can be {@code null} when {@link IdentityService#checkPassword(String, String)} is called. @return <code>true</code> if the given password matches this rule. <code>false</code> if the given password is not compliant with this rule.
execute
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/identity/PasswordPolicyRule.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/identity/PasswordPolicyRule.java
Apache-2.0
protected Collection<DefinitionEntity> transformResource(DeploymentEntity deployment, ResourceEntity resource, Properties properties) { String resourceName = resource.getName(); List<DefinitionEntity> definitions = transformDefinitions(deployment, resource, properties); for (DefinitionEntity definition : definitions) { definition.setResourceName(resourceName); String diagramResourceName = getDiagramResourceForDefinition(deployment, resourceName, definition, deployment.getResources()); if (diagramResourceName != null) { definition.setDiagramResourceName(diagramResourceName); } } return definitions; }
@return the list of resource suffixes for this cacheDeployer
transformResource
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java
Apache-2.0
protected void persistedDefinitionLoaded(DeploymentEntity deployment, DefinitionEntity definition, DefinitionEntity persistedDefinition) { // do nothing; }
Called when a previous version of a definition was loaded from the persistent store. @param deployment the deployment of the definition @param definition the definition entity @param persistedDefinition the loaded definition entity
persistedDefinitionLoaded
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java
Apache-2.0
protected void registerDefinition(DeploymentEntity deployment, DefinitionEntity definition, Properties properties) { DeploymentCache deploymentCache = getDeploymentCache(); // Add to cache addDefinitionToDeploymentCache(deploymentCache, definition); definitionAddedToDeploymentCache(deployment, definition, properties); // Add to deployment for further usage deployment.addDeployedArtifact(definition); }
Persist definition entity into the database. @param definition the definition entity
registerDefinition
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java
Apache-2.0
protected void definitionAddedToDeploymentCache(DeploymentEntity deployment, DefinitionEntity definition, Properties properties) { // do nothing }
Called after a definition was added to the deployment cache. @param deployment the deployment of the definition @param definition the definition entity
definitionAddedToDeploymentCache
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java
Apache-2.0
protected int getNextVersion(DeploymentEntity deployment, DefinitionEntity newDefinition, DefinitionEntity latestDefinition) { int result = 1; if (latestDefinition != null) { int latestVersion = latestDefinition.getVersion(); result = latestVersion + 1; } return result; }
per default we increment the latest definition version by one - but you might want to hook in some own logic here, e.g. to align definition versions with deployment / build versions.
getNextVersion
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/AbstractDefinitionDeployer.java
Apache-2.0
protected boolean hasExcludingConditions() { return false; }
Whether or not the query has excluding conditions. If the query has excluding conditions, (e.g. task due date before and after are excluding), the SQL query is avoided and a default result is returned. The returned result is the same as if the SQL was executed and there were no entries. @return {@code true} if the query does have excluding conditions, {@code false} otherwise
hasExcludingConditions
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/AbstractQuery.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/AbstractQuery.java
Apache-2.0
protected boolean isLeaf(ExecutionEntity execution) { if (CompensationBehavior.isCompensationThrowing(execution)) { return true; } else { return !execution.isEventScope() && execution.getNonEventScopeExecutions().isEmpty(); } }
event-scope executions are not considered in this mapping and must be ignored
isLeaf
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/ActivityExecutionTreeMapping.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/ActivityExecutionTreeMapping.java
Apache-2.0
private boolean containsIncompatiblePermissions() { return queryByPermission && resourcesIntersection.isEmpty(); }
check whether there are any compatible resources for all of the filtered permission parameters
containsIncompatiblePermissions
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/AuthorizationQueryImpl.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/AuthorizationQueryImpl.java
Apache-2.0
@Override public <T> T getArtifact(Class<T> clazz) { try { return clazz.newInstance(); } catch (Exception e) { throw new ProcessEngineException("couldn't instantiate class " + clazz.getName(), e); } }
Default ArtifactService implementation. This version uses Class.newInstance() to create new Artifacts. This is the default behaviour like has been in old camunda/activity versions. @since 7.2.0 @author <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
getArtifact
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/DefaultArtifactFactory.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/DefaultArtifactFactory.java
Apache-2.0
public long getDefaultPriority() { return DEFAULT_PRIORITY; }
Returns the default priority. @return the default priority
getDefaultPriority
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java
Apache-2.0
public long getDefaultPriorityOnResolutionFailure() { return DEFAULT_PRIORITY_ON_RESOLUTION_FAILURE; }
Returns the default priority in case of resolution failure. @return the default priority
getDefaultPriorityOnResolutionFailure
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java
Apache-2.0
protected Long getProcessDefinedPriority(ProcessDefinitionImpl processDefinition, String propertyKey, ExecutionEntity execution, String errorMsgHead) { if (processDefinition != null) { ParameterValueProvider priorityProvider = (ParameterValueProvider) processDefinition.getProperty(propertyKey); if (priorityProvider != null) { return evaluateValueProvider(priorityProvider, execution, errorMsgHead); } } return null; }
Returns the priority which is defined in the given process definition. The priority value is identified with the given propertyKey. Returns null if the process definition is null or no priority was defined. @param processDefinition the process definition that should contains the priority @param propertyKey the key which identifies the property @param execution the current execution @param errorMsgHead the error message header which is used if the evaluation fails @return the priority defined in the given process
getProcessDefinedPriority
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java
Apache-2.0
protected boolean isSymptomOfContextSwitchFailure(Throwable t, ExecutionEntity contextExecution) { // a context switch failure can occur, if the current engine has no PA registration for the deployment // subclasses may assert the actual throwable to narrow down the diagnose return ProcessApplicationContextUtil.getTargetProcessApplication(contextExecution) == null; }
Logs the exception which was thrown if the priority can not be determined. @param execution the current execution entity @param value the current value @param e the exception which was catched
isSymptomOfContextSwitchFailure
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java
Apache-2.0
protected boolean isValidLongValue(Number value) { return value instanceof Short || value instanceof Integer || value instanceof Long; }
Checks if the given number is a valid long value. @param value the number which should be checked @return true if is a valid long value, false otherwise
isValidLongValue
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/DefaultPriorityProvider.java
Apache-2.0
public boolean addWebappToTelemetry(String webapp) { DiagnosticsRegistry telemetryRegistry = ((ProcessEngineConfigurationImpl) processEngineConfiguration).getDiagnosticsRegistry(); if (telemetryRegistry != null) { telemetryRegistry.addWebapp(webapp); return true; } return false; }
Adds the web application name to the telemetry data of the engine. @param webapp the web application that is used with the engine @return whether the web application was successfully added or not
addWebappToTelemetry
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/ManagementServiceImpl.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/ManagementServiceImpl.java
Apache-2.0
public void addApplicationServerInfoToTelemetry(String appServerInfo) { DiagnosticsRegistry telemetryRegistry = ((ProcessEngineConfigurationImpl) processEngineConfiguration).getDiagnosticsRegistry(); if (telemetryRegistry != null) { telemetryRegistry.setApplicationServer(appServerInfo); } }
Adds the application server information to the telemetry data of the engine. @param appServerInfo a String containing information about the application server
addApplicationServerInfoToTelemetry
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/ManagementServiceImpl.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/ManagementServiceImpl.java
Apache-2.0
public Void execute(CommandContext commandContext) { String databaseSchemaUpdate = Context.getProcessEngineConfiguration().getDatabaseSchemaUpdate(); PersistenceSession persistenceSession = commandContext.getSession(PersistenceSession.class); if (ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE.equals(databaseSchemaUpdate)) { try { persistenceSession.dbSchemaDrop(); } catch (RuntimeException e) { // ignore } } if ( ProcessEngineConfiguration.DB_SCHEMA_UPDATE_CREATE_DROP.equals(databaseSchemaUpdate) || ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE.equals(databaseSchemaUpdate) || ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_CREATE.equals(databaseSchemaUpdate) ) { persistenceSession.dbSchemaCreate(); } else if (ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE.equals(databaseSchemaUpdate)) { persistenceSession.dbSchemaCheckVersion(); } else if (ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE.equals(databaseSchemaUpdate)) { persistenceSession.dbSchemaUpdate(); } return null; }
@author Tom Baeyens @author Roman Smirnov @author Sebastian Menski @author Daniel Meyer
execute
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/SchemaOperationsProcessEngineBuild.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/SchemaOperationsProcessEngineBuild.java
Apache-2.0
public boolean isProcessInstanceVariable() { return isProcessInstanceVariable; }
<p>The parameters <code>isTaskVariable</code> and <code> isProcessInstanceVariable</code> have the following meaning:</p> <ul> <li>if <code>isTaskVariable == true</code>: only query after task variables</li> <li>if <code>isTaskVariable == false && isProcessInstanceVariable == true</code>: only query after process instance variables</li> <li>if <code>isTaskVariable == false && isProcessInstanceVariable == false</code>: only query after case instance variables</li> </ul>
isProcessInstanceVariable
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/TaskQueryVariableValue.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/TaskQueryVariableValue.java
Apache-2.0
public void addDeploymentMappings(List<ImmutablePair<String, String>> mappings) { addDeploymentMappings(mappings, null); }
Add mappings of deployment ids to resource ids to the overall element mapping list. @param mappings the mappings to add
addDeploymentMappings
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/batch/BatchElementConfiguration.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/batch/BatchElementConfiguration.java
Apache-2.0
public void addDeploymentMappings(List<ImmutablePair<String, String>> mappingsList, Collection<String> idList) { if (ids != null) { ids = null; mappings = null; } Set<String> missingIds = idList == null ? null : new HashSet<>(idList); mappingsList.forEach(pair -> { String deploymentId = pair.getLeft(); Set<String> idSet = collectedMappings.get(deploymentId); if (idSet == null) { idSet = new HashSet<>(); collectedMappings.put(deploymentId, idSet); } idSet.add(pair.getRight()); if (missingIds != null) { missingIds.remove(pair.getRight()); } }); // add missing ids to "null" deployment id if (missingIds != null && !missingIds.isEmpty()) { Set<String> nullIds = collectedMappings.get(null); if (nullIds == null) { nullIds = new HashSet<>(); collectedMappings.put(null, nullIds); } nullIds.addAll(missingIds); } }
Add mappings of deployment ids to resource ids to the overall element mapping list. All elements from <code>idList</code> that are not part of the mappings will be added to the list of <code>null</code> deployment id mappings. @param mappingsList the mappings to add @param idList the list of ids to check for missing elements concerning the mappings to add
addDeploymentMappings
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/batch/BatchElementConfiguration.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/batch/BatchElementConfiguration.java
Apache-2.0
public List<String> getIds() { if (ids == null) { createDeploymentMappings(); } return ids; }
@return the list of ids that are mapped to deployment ids, ordered by deployment id
getIds
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/batch/BatchElementConfiguration.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/batch/BatchElementConfiguration.java
Apache-2.0
public void performDefaultOutgoingBehavior(ActivityExecution activityExecution) { performOutgoingBehavior(activityExecution, true); }
Performs the default outgoing BPMN 2.0 behavior, which is having parallel paths of executions for the outgoing sequence flow. More precisely: every sequence flow that has a condition which evaluates to true (or which doesn't have a condition), is selected for continuation of the process instance. If multiple sequencer flow are selected, multiple, parallel paths of executions are created.
performDefaultOutgoingBehavior
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/BpmnActivityBehavior.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/BpmnActivityBehavior.java
Apache-2.0
public void performIgnoreConditionsOutgoingBehavior(ActivityExecution activityExecution) { performOutgoingBehavior(activityExecution, false); }
Performs the default outgoing BPMN 2.0 behavior (@see {@link #performDefaultOutgoingBehavior(ActivityExecution)}), but without checking the conditions on the outgoing sequence flow. This means that every outgoing sequence flow is selected for continuing the process instance, regardless of having a condition or not. In case of multiple outgoing sequence flow, multiple parallel paths of executions will be created.
performIgnoreConditionsOutgoingBehavior
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/BpmnActivityBehavior.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/BpmnActivityBehavior.java
Apache-2.0
public void signal(ActivityExecution execution, String signalName, Object signalData) throws Exception { if (LegacyBehavior.signalCancelBoundaryEvent(signalName)) { // join compensating executions if (!execution.hasChildren()) { leave(execution); } else { ((ExecutionEntity)execution).forceUpdate(); } } else { super.signal(execution, signalName, signalData); } }
See CancelEndEventActivityBehavior: the cancel end event interrupts the scope and performs compensation. @author Daniel Meyer
signal
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/CancelBoundaryEventActivityBehavior.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/CancelBoundaryEventActivityBehavior.java
Apache-2.0
@Override public void doLeave(ActivityExecution execution) { LOG.leavingActivity(execution.getActivity().getId()); PvmTransition outgoingSeqFlow = null; String defaultSequenceFlow = (String) execution.getActivity().getProperty("default"); Iterator<PvmTransition> transitionIterator = execution.getActivity().getOutgoingTransitions().iterator(); while (outgoingSeqFlow == null && transitionIterator.hasNext()) { PvmTransition seqFlow = transitionIterator.next(); Condition condition = (Condition) seqFlow.getProperty(BpmnParse.PROPERTYNAME_CONDITION); if ( (condition == null && (defaultSequenceFlow == null || !defaultSequenceFlow.equals(seqFlow.getId())) ) || (condition != null && condition.evaluate(execution)) ) { LOG.outgoingSequenceFlowSelected(seqFlow.getId()); outgoingSeqFlow = seqFlow; } } if (outgoingSeqFlow != null) { execution.leaveActivityViaTransition(outgoingSeqFlow); } else { if (defaultSequenceFlow != null) { PvmTransition defaultTransition = execution.getActivity().findOutgoingTransition(defaultSequenceFlow); if (defaultTransition != null) { execution.leaveActivityViaTransition(defaultTransition); } else { throw LOG.missingDefaultFlowException(execution.getActivity().getId(), defaultSequenceFlow); } } else { //No sequence flow could be found, not even a default one throw LOG.stuckExecutionException(execution.getActivity().getId()); } } }
The default behaviour of BPMN, taking every outgoing sequence flow (where the condition evaluates to true), is not valid for an exclusive gateway. Hence, this behaviour is overriden and replaced by the correct behavior: selecting the first sequence flow which condition evaluates to true (or which hasn't got a condition) and leaving the activity through that sequence flow. If no sequence flow is selected (ie all conditions evaluate to false), then the default sequence flow is taken (if defined).
doLeave
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/ExclusiveGatewayActivityBehavior.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/ExclusiveGatewayActivityBehavior.java
Apache-2.0
protected void lockConcurrentRoot(ActivityExecution execution) { ActivityExecution concurrentRoot = null; if (execution.isConcurrent()) { concurrentRoot = execution.getParent(); } else { concurrentRoot = execution; } ((ExecutionEntity)concurrentRoot).forceUpdate(); }
super class for all gateway activity implementations. @author Joram Barrez
lockConcurrentRoot
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/GatewayActivityBehavior.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/GatewayActivityBehavior.java
Apache-2.0
public void execute(ActivityExecution execution) throws Exception { // Join PvmActivity activity = execution.getActivity(); List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions(); execution.inactivate(); lockConcurrentRoot(execution); List<ActivityExecution> joinedExecutions = execution.findInactiveConcurrentExecutions(activity); int nbrOfExecutionsToJoin = execution.getActivity().getIncomingTransitions().size(); int nbrOfExecutionsJoined = joinedExecutions.size(); if (nbrOfExecutionsJoined==nbrOfExecutionsToJoin) { // Fork LOG.activityActivation(activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin); execution.leaveActivityViaTransitions(outgoingTransitions, joinedExecutions); } else { LOG.noActivityActivation(activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin); } }
Implementation of the Parallel Gateway/AND gateway as definined in the BPMN 2.0 specification. The Parallel Gateway can be used for splitting a path of execution into multiple paths of executions (AND-split/fork behavior), one for every outgoing sequence flow. The Parallel Gateway can also be used for merging or joining paths of execution (AND-join). In this case, on every incoming sequence flow an execution needs to arrive, before leaving the Parallel Gateway (and potentially then doing the fork behavior in case of multiple outgoing sequence flow). Note that there is a slight difference to spec (p. 436): "The parallel gateway is activated if there is at least one Token on each incoming sequence flow." We only check the number of incoming tokens to the number of sequenceflow. So if two tokens would arrive through the same sequence flow, our implementation would activate the gateway. Note that a Parallel Gateway having one incoming and multiple ougoing sequence flow, is the same as having multiple outgoing sequence flow on a given activity. However, a parallel gateway does NOT check conditions on the outgoing sequence flow. @author Joram Barrez @author Tom Baeyens
execute
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/ParallelGatewayActivityBehavior.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/ParallelGatewayActivityBehavior.java
Apache-2.0
@Override public void performExecution(ActivityExecution execution) throws Exception { // Do nothing: waitstate behavior }
A receive task is a wait state that waits for the receival of some message. Currently, the only message that is supported is the external trigger, given by calling the {@link RuntimeService#signal(String)} operation. @author Joram Barrez
performExecution
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/ReceiveTaskActivityBehavior.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/ReceiveTaskActivityBehavior.java
Apache-2.0
protected void preExecution(ActivityExecution execution) throws Exception { activityInstanceId = execution.getActivityInstanceId(); }
The method which will be called before the execution is performed. @param execution the execution which is used during execution @throws Exception
preExecution
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/TaskActivityBehavior.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/TaskActivityBehavior.java
Apache-2.0
@Override public void execute(ActivityExecution execution) throws Exception { performExecution(execution); }
The method which will be called after performing the execution. @param execution the execution @throws Exception
execute
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/TaskActivityBehavior.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/TaskActivityBehavior.java
Apache-2.0
public void execute(ActivityExecution execution) throws Exception { // we are the last execution inside this scope: calling end() ends this scope. execution.end(true); }
<p>The BPMN terminate End Event.</p> <p>The start behavior of the terminate end event is {@link ActivityStartBehavior#INTERRUPT_FLOW_SCOPE}. as a result, the current scope will be interrupted (all concurrent executions cancelled) and this behavior is entered with the scope execution.</p> @author Daniel Meyer @author Roman Smirnov
execute
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/TerminateEndEventActivityBehavior.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/TerminateEndEventActivityBehavior.java
Apache-2.0
public DiagramLayout getProcessDiagramLayout(InputStream bpmnXmlStream, InputStream imageStream) { Document bpmnModel = parseXml(bpmnXmlStream); return getBpmnProcessDiagramLayout(bpmnModel, imageStream); }
Provides positions and dimensions of elements in a process diagram as provided by {@link RepositoryService#getProcessDiagram(String)}. Currently, it only supports BPMN 2.0 models. @param bpmnXmlStream BPMN 2.0 XML file @param imageStream BPMN 2.0 diagram in PNG format (JPEG and other formats supported by {@link ImageIO} may also work) @return Layout of the process diagram @return null when parameter imageStream is null
getProcessDiagramLayout
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/diagram/ProcessDiagramLayoutFactory.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/diagram/ProcessDiagramLayoutFactory.java
Apache-2.0
protected static ActivityImpl getEventScopeCompensationHandler(ExecutionEntity execution) { ActivityImpl activity = execution.getActivity(); ActivityImpl compensationHandler = activity.findCompensationHandler(); if (compensationHandler != null && compensationHandler.isSubProcessScope()) { // subprocess with inner compensation event subprocess return compensationHandler; } else { // subprocess without compensation handler or // multi instance activity return activity; } }
In the context when an event scope execution is created (i.e. a scope such as a subprocess has completed), this method returns the compensation handler activity that is going to be executed when by the event scope execution. This method is not relevant when the scope has a boundary compensation handler.
getEventScopeCompensationHandler
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/helper/CompensationUtil.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/helper/CompensationUtil.java
Apache-2.0
public static void propagateEscalation(ActivityExecution execution, String escalationCode) { EscalationEventDefinition escalationEventDefinition = executeEscalation(execution, escalationCode); if (escalationEventDefinition == null ) { throw LOG.missingBoundaryCatchEventEscalation(execution.getActivity().getId(), escalationCode); } }
Helper class handling the propagation of escalation.
propagateEscalation
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/helper/EscalationHandler.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/helper/EscalationHandler.java
Apache-2.0
public void notify(DelegateExecution execution) throws Exception { // Return value of expression is ignored expression.getValue(execution); }
An {@link ExecutionListener} that evaluates a {@link Expression} when notified. @author Frederik Heremans
notify
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/listener/ExpressionExecutionListener.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/listener/ExpressionExecutionListener.java
Apache-2.0
@Override public void parseIoMapping(Element extensionElements, ActivityImpl activity, IoMapping inputOutput) { }
Abstract base class for implementing a {@link BpmnParseListener} without being forced to implement all methods provided, which makes the implementation more robust to future changes. @author ruecker
parseIoMapping
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/AbstractBpmnParseListener.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/AbstractBpmnParseListener.java
Apache-2.0
public void parseMessages() { for (Element messageElement : rootElement.elements("message")) { String id = messageElement.attribute("id"); String messageName = messageElement.attribute("name"); Expression messageExpression = null; if (messageName != null) { messageExpression = expressionManager.createExpression(messageName); } MessageDefinition messageDefinition = new MessageDefinition(this.targetNamespace + ":" + id, messageExpression); this.messages.put(messageDefinition.getId(), messageDefinition); } }
Parses the messages of the given definitions file. Messages are not contained within a process element, but they can be referenced from inner process elements.
parseMessages
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public void parseProcessDefinitions() { for (Element processElement : rootElement.elements("process")) { boolean isExecutable = !deployment.isNew(); String isExecutableStr = processElement.attribute("isExecutable"); if (isExecutableStr != null) { isExecutable = Boolean.parseBoolean(isExecutableStr); if (!isExecutable) { LOG.ignoringNonExecutableProcess(processElement.attribute("id")); } } else { LOG.missingIsExecutableAttribute(processElement.attribute("id")); } // Only process executable processes if (isExecutable) { processDefinitions.add(parseProcess(processElement)); } } }
Parses all the process definitions defined within the 'definitions' root element.
parseProcessDefinitions
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public void parseCollaboration() { Element collaboration = rootElement.element("collaboration"); if (collaboration != null) { for (Element participant : collaboration.elements("participant")) { String processRef = participant.attribute("processRef"); if (processRef != null) { ProcessDefinitionImpl procDef = getProcessDefinition(processRef); if (procDef != null) { // Set participant process on the procDef, so it can get rendered // later on if needed ParticipantProcess participantProcess = new ParticipantProcess(); participantProcess.setId(participant.attribute("id")); participantProcess.setName(participant.attribute("name")); procDef.setParticipantProcess(participantProcess); participantProcesses.put(participantProcess.getId(), processRef); } } } } }
Parses the collaboration definition defined within the 'definitions' root element and get all participants to lookup their process references during DI parsing.
parseCollaboration
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
protected void setErrorCodeVariableOnErrorEventDefinition(Element errorEventDefinition, ErrorEventDefinition definition) { String errorCodeVar = errorEventDefinition.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "errorCodeVariable"); if (errorCodeVar != null) { definition.setErrorCodeVariable(errorCodeVar); } }
Sets the value for "camunda:errorCodeVariable" on the passed definition if it's present. @param errorEventDefinition the XML errorEventDefinition tag @param definition the errorEventDefintion that can get the errorCodeVariable value
setErrorCodeVariableOnErrorEventDefinition
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public ActivityImpl createActivityOnScope(Element activityElement, ScopeImpl scopeElement) { String id = activityElement.attribute("id"); LOG.parsingElement("activity", id); ActivityImpl activity = scopeElement.createActivity(id); activity.setProperty("name", activityElement.attribute("name")); activity.setProperty("documentation", parseDocumentation(activityElement)); activity.setProperty("default", activityElement.attribute("default")); activity.getProperties().set(BpmnProperties.TYPE, activityElement.getTagName()); activity.setProperty("line", activityElement.getLine()); setActivityAsyncDelegates(activity); activity.setProperty(PROPERTYNAME_JOB_PRIORITY, parsePriority(activityElement, PROPERTYNAME_JOB_PRIORITY)); if (isCompensationHandler(activityElement)) { activity.setProperty(PROPERTYNAME_IS_FOR_COMPENSATION, true); } return activity; }
Parses the generic information of an activity element (id, name, documentation, etc.), and creates a new {@link ActivityImpl} on the given scope element.
createActivityOnScope
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
protected void addMessageJobDeclaration(MessageJobDeclaration messageJobDeclaration, ActivityImpl activity, boolean exclusive) { ProcessDefinition procDef = (ProcessDefinition) activity.getProcessDefinition(); if (!exists(messageJobDeclaration, procDef.getKey(), activity.getActivityId())) { messageJobDeclaration.setExclusive(exclusive); messageJobDeclaration.setActivity(activity); messageJobDeclaration.setJobPriorityProvider((ParameterValueProvider) activity.getProperty(PROPERTYNAME_JOB_PRIORITY)); addMessageJobDeclarationToActivity(messageJobDeclaration, activity); addJobDeclarationToProcessDefinition(messageJobDeclaration, procDef); } }
Adds the new message job declaration to existing declarations. There will be executed an existing check before the adding is executed. @param messageJobDeclaration the new message job declaration @param activity the corresponding activity @param exclusive the flag which indicates if the async should be exclusive
addMessageJobDeclaration
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
protected boolean exists(MessageJobDeclaration msgJobdecl, String procDefKey, String activityId) { boolean exist = false; List<JobDeclaration<?, ?>> declarations = jobDeclarations.get(procDefKey); if (declarations != null) { for (int i = 0; i < declarations.size() && !exist; i++) { JobDeclaration<?, ?> decl = declarations.get(i); if (decl.getActivityId().equals(activityId) && decl.getJobConfiguration().equalsIgnoreCase(msgJobdecl.getJobConfiguration())) { exist = true; } } } return exist; }
Checks whether the message declaration already exists. @param msgJobdecl the message job declaration which is searched @param procDefKey the corresponding process definition key @param activityId the corresponding activity id @return true if the message job declaration exists, false otherwise
exists
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
protected void parseAsynchronousContinuationForActivity(Element activityElement, ActivityImpl activity) { // can't use #getMultiInstanceScope here to determine whether the task is multi-instance, // since the property hasn't been set yet (cf parseActivity) ActivityImpl parentFlowScopeActivity = activity.getParentFlowScopeActivity(); if (parentFlowScopeActivity != null && parentFlowScopeActivity.getActivityBehavior() instanceof MultiInstanceActivityBehavior && !activity.isCompensationHandler()) { parseAsynchronousContinuation(activityElement, parentFlowScopeActivity); Element miLoopCharacteristics = activityElement.element("multiInstanceLoopCharacteristics"); parseAsynchronousContinuation(miLoopCharacteristics, activity); } else { parseAsynchronousContinuation(activityElement, activity); } }
Parse async continuation of an activity and create async jobs for the activity. <br/> <br/> When the activity is marked as multi instance, then async jobs create instead for the multi instance body. When the wrapped activity has async characteristics in 'multiInstanceLoopCharacteristics' element, then async jobs create additionally for the wrapped activity.
parseAsynchronousContinuationForActivity
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public ActivityImpl parseTask(Element taskElement, ScopeImpl scope) { ActivityImpl activity = createActivityOnScope(taskElement, scope); activity.setActivityBehavior(new TaskActivityBehavior()); parseAsynchronousContinuationForActivity(taskElement, activity); parseExecutionListenersOnScope(taskElement, activity); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseTask(taskElement, scope, activity); } return activity; }
Parses a task with no specific type (behaves as passthrough).
parseTask
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public void parseEndEvents(Element parentElement, ScopeImpl scope) { for (Element endEventElement : parentElement.elements("endEvent")) { ActivityImpl activity = createActivityOnScope(endEventElement, scope); Element errorEventDefinition = endEventElement.element(ERROR_EVENT_DEFINITION); Element cancelEventDefinition = endEventElement.element(CANCEL_EVENT_DEFINITION); Element terminateEventDefinition = endEventElement.element("terminateEventDefinition"); Element messageEventDefinitionElement = endEventElement.element(MESSAGE_EVENT_DEFINITION); Element signalEventDefinition = endEventElement.element(SIGNAL_EVENT_DEFINITION); Element compensateEventDefinitionElement = endEventElement.element(COMPENSATE_EVENT_DEFINITION); Element escalationEventDefinition = endEventElement.element(ESCALATION_EVENT_DEFINITION); boolean isServiceTaskLike = isServiceTaskLike(messageEventDefinitionElement); String activityId = activity.getId(); if (errorEventDefinition != null) { // error end event String errorRef = errorEventDefinition.attribute("errorRef"); if (errorRef == null || "".equals(errorRef)) { addError("'errorRef' attribute is mandatory on error end event", errorEventDefinition, activityId); } else { Error error = errors.get(errorRef); if (error != null && (error.getErrorCode() == null || "".equals(error.getErrorCode()))) { addError( "'errorCode' is mandatory on errors referenced by throwing error event definitions, but the error '" + error.getId() + "' does not define one.", errorEventDefinition, activityId); } activity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.END_EVENT_ERROR); if(error != null) { activity.setActivityBehavior(new ErrorEndEventActivityBehavior(error.getErrorCode(), error.getErrorMessageExpression())); } else { activity.setActivityBehavior(new ErrorEndEventActivityBehavior(errorRef, null)); } } } else if (cancelEventDefinition != null) { if (scope.getProperty(BpmnProperties.TYPE.getName()) == null || !scope.getProperty(BpmnProperties.TYPE.getName()).equals("transaction")) { addError("end event with cancelEventDefinition only supported inside transaction subprocess", cancelEventDefinition, activityId); } else { activity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.END_EVENT_CANCEL); activity.setActivityBehavior(new CancelEndEventActivityBehavior()); activity.setActivityStartBehavior(ActivityStartBehavior.INTERRUPT_FLOW_SCOPE); activity.setProperty(PROPERTYNAME_THROWS_COMPENSATION, true); activity.setScope(true); } } else if (terminateEventDefinition != null) { activity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.END_EVENT_TERMINATE); activity.setActivityBehavior(new TerminateEndEventActivityBehavior()); activity.setActivityStartBehavior(ActivityStartBehavior.INTERRUPT_FLOW_SCOPE); } else if (messageEventDefinitionElement != null) { if (isServiceTaskLike) { // CAM-436 same behaviour as service task parseServiceTaskLike( activity, ActivityTypes.END_EVENT_MESSAGE, messageEventDefinitionElement, endEventElement, scope); activity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.END_EVENT_MESSAGE); } else { // default to non behavior if no service task // properties have been specified activity.setActivityBehavior(new IntermediateThrowNoneEventActivityBehavior()); } } else if (signalEventDefinition != null) { activity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.END_EVENT_SIGNAL); EventSubscriptionDeclaration signalDefinition = parseSignalEventDefinition(signalEventDefinition, true, activityId); activity.setActivityBehavior(new ThrowSignalEventActivityBehavior(signalDefinition)); } else if (compensateEventDefinitionElement != null) { activity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.END_EVENT_COMPENSATION); CompensateEventDefinition compensateEventDefinition = parseThrowCompensateEventDefinition(compensateEventDefinitionElement, scope, endEventElement.attribute("id")); activity.setActivityBehavior(new CompensationEventActivityBehavior(compensateEventDefinition)); activity.setProperty(PROPERTYNAME_THROWS_COMPENSATION, true); activity.setScope(true); } else if(escalationEventDefinition != null) { activity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.END_EVENT_ESCALATION); Escalation escalation = findEscalationForEscalationEventDefinition(escalationEventDefinition, activityId); if (escalation != null && escalation.getEscalationCode() == null) { addError("escalation end event must have an 'escalationCode'", escalationEventDefinition, activityId); } activity.setActivityBehavior(new ThrowEscalationEventActivityBehavior(escalation)); } else { // default: none end event activity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.END_EVENT_NONE); activity.setActivityBehavior(new NoneEndEventActivityBehavior()); } if (activity != null) { parseActivityInputOutput(endEventElement, activity); } parseAsynchronousContinuationForActivity(endEventElement, activity); parseExecutionListenersOnScope(endEventElement, activity); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseEndEvent(endEventElement, scope, activity); } if (isServiceTaskLike) { // activity behavior could be set by a listener (e.g. connector); thus, // check is after listener invocation validateServiceTaskLike(activity, ActivityTypes.END_EVENT_MESSAGE, messageEventDefinitionElement); } } }
Parses the end events of a certain level in the process (process, subprocess or another scope). @param parentElement The 'parent' element that contains the end events (process, subprocess). @param scope The {@link ScopeImpl} to which the end events must be added.
parseEndEvents
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public BoundaryConditionalEventActivityBehavior parseBoundaryConditionalEventDefinition(Element element, boolean interrupting, ActivityImpl conditionalActivity) { conditionalActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.BOUNDARY_CONDITIONAL); ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition(element, conditionalActivity); conditionalEventDefinition.setInterrupting(interrupting); addEventSubscriptionDeclaration(conditionalEventDefinition, conditionalActivity.getEventScope(), element); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseBoundaryConditionalEventDefinition(element, interrupting, conditionalActivity); } return new BoundaryConditionalEventActivityBehavior(conditionalEventDefinition); }
Parses the given element as conditional boundary event. @param element the XML element which contains the conditional event information @param interrupting indicates if the event is interrupting or not @param conditionalActivity the conditional event activity @return the boundary conditional event behavior which contains the condition
parseBoundaryConditionalEventDefinition
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public ConditionalEventDefinition parseIntermediateConditionalEventDefinition(Element element, ActivityImpl conditionalActivity) { conditionalActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.INTERMEDIATE_EVENT_CONDITIONAL); ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition(element, conditionalActivity); addEventSubscriptionDeclaration(conditionalEventDefinition, conditionalActivity.getEventScope(), element); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseIntermediateConditionalEventDefinition(element, conditionalActivity); } return conditionalEventDefinition; }
Parses the given element as intermediate conditional event. @param element the XML element which contains the conditional event information @param conditionalActivity the conditional event activity @return returns the conditional activity with the parsed information
parseIntermediateConditionalEventDefinition
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public ConditionalEventDefinition parseConditionalStartEventForEventSubprocess(Element element, ActivityImpl conditionalActivity, boolean interrupting) { conditionalActivity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.START_EVENT_CONDITIONAL); ConditionalEventDefinition conditionalEventDefinition = parseConditionalEventDefinition(element, conditionalActivity); conditionalEventDefinition.setInterrupting(interrupting); addEventSubscriptionDeclaration(conditionalEventDefinition, conditionalActivity.getEventScope(), element); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseConditionalStartEventForEventSubprocess(element, conditionalActivity, interrupting); } return conditionalEventDefinition; }
Parses the given element as conditional start event of an event subprocess. @param element the XML element which contains the conditional event information @param interrupting indicates if the event is interrupting or not @param conditionalActivity the conditional event activity @return
parseConditionalStartEventForEventSubprocess
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
protected ConditionalEventDefinition parseConditionalEventDefinition(Element element, ActivityImpl conditionalActivity) { ConditionalEventDefinition conditionalEventDefinition = null; Element conditionExprElement = element.element(CONDITION); String conditionalActivityId = conditionalActivity.getId(); if (conditionExprElement != null) { Condition condition = parseConditionExpression(conditionExprElement, conditionalActivityId); conditionalEventDefinition = new ConditionalEventDefinition(condition, conditionalActivity); String expression = conditionExprElement.getText().trim(); conditionalEventDefinition.setConditionAsString(expression); conditionalActivity.getProcessDefinition().getProperties().set(BpmnProperties.HAS_CONDITIONAL_EVENTS, true); final String variableName = element.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "variableName"); conditionalEventDefinition.setVariableName(variableName); final String variableEvents = element.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "variableEvents"); final List<String> variableEventsList = parseCommaSeparatedList(variableEvents); conditionalEventDefinition.setVariableEvents(new HashSet<>(variableEventsList)); for (String variableEvent : variableEventsList) { if (!VARIABLE_EVENTS.contains(variableEvent)) { addWarning("Variable event: " + variableEvent + " is not valid. Possible variable change events are: " + Arrays.toString(VARIABLE_EVENTS.toArray()), element, conditionalActivityId); } } } else { addError("Conditional event must contain an expression for evaluation.", element, conditionalActivityId); } return conditionalEventDefinition; }
Parses the given element and returns an ConditionalEventDefinition object. @param element the XML element which contains the conditional event information @param conditionalActivity the conditional event activity @return the conditional event definition which was parsed
parseConditionalEventDefinition
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public void parseProperties(Element element, ActivityImpl activity) { List<Element> propertyElements = element.elements("property"); for (Element propertyElement : propertyElements) { parseProperty(propertyElement, activity); } }
Parses the properties of an element (if any) that can contain properties (processes, activities, etc.) Returns true if property subelemens are found. @param element The element that can contain properties. @param activity The activity where the property declaration is done.
parseProperties
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public void parseProperty(Element propertyElement, ActivityImpl activity) { String id = propertyElement.attribute("id"); String name = propertyElement.attribute("name"); // If name isn't given, use the id as name if (name == null) { if (id == null) { addError("Invalid property usage on line " + propertyElement.getLine() + ": no id or name specified.", propertyElement, activity.getId()); } else { name = id; } } String type = null; parsePropertyCustomExtensions(activity, propertyElement, name, type); }
Parses one property definition. @param propertyElement The 'property' element that defines how a property looks like and is handled.
parseProperty
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public void parsePropertyCustomExtensions(ActivityImpl activity, Element propertyElement, String propertyName, String propertyType) { if (propertyType == null) { String type = propertyElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, TYPE); propertyType = type != null ? type : "string"; // default is string } VariableDeclaration variableDeclaration = new VariableDeclaration(propertyName, propertyType); addVariableDeclaration(activity, variableDeclaration); activity.setScope(true); String src = propertyElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "src"); if (src != null) { variableDeclaration.setSourceVariableName(src); } String srcExpr = propertyElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "srcExpr"); if (srcExpr != null) { Expression sourceExpression = expressionManager.createExpression(srcExpr); variableDeclaration.setSourceExpression(sourceExpression); } String dst = propertyElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "dst"); if (dst != null) { variableDeclaration.setDestinationVariableName(dst); } String destExpr = propertyElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "dstExpr"); if (destExpr != null) { Expression destinationExpression = expressionManager.createExpression(destExpr); variableDeclaration.setDestinationExpression(destinationExpression); } String link = propertyElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "link"); if (link != null) { variableDeclaration.setLink(link); } String linkExpr = propertyElement.attributeNS(CAMUNDA_BPMN_EXTENSIONS_NS, "linkExpr"); if (linkExpr != null) { Expression linkExpression = expressionManager.createExpression(linkExpr); variableDeclaration.setLinkExpression(linkExpression); } for (BpmnParseListener parseListener : parseListeners) { parseListener.parseProperty(propertyElement, variableDeclaration, activity); } }
Parses the custom extensions for properties. @param activity The activity where the property declaration is done. @param propertyElement The 'property' element defining the property. @param propertyName The name of the property. @param propertyType The type of the property.
parsePropertyCustomExtensions
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public void parseSequenceFlow(Element processElement, ScopeImpl scope, Map<String, Element> compensationHandlers) { for (Element sequenceFlowElement : processElement.elements("sequenceFlow")) { String id = sequenceFlowElement.attribute("id"); String sourceRef = sequenceFlowElement.attribute("sourceRef"); String destinationRef = sequenceFlowElement.attribute("targetRef"); // check if destination is a throwing link event (event source) which mean // we have // to target the catching link event (event target) here: if (eventLinkSources.containsKey(destinationRef)) { String linkName = eventLinkSources.get(destinationRef); destinationRef = eventLinkTargets.get(linkName); if (destinationRef == null) { addError("sequence flow points to link event source with name '" + linkName + "' but no event target with that name exists. Most probably your link events are not configured correctly.", sequenceFlowElement); // we cannot do anything useful now return; } // Reminder: Maybe we should log a warning if we use intermediate link // events which are not used? // e.g. we have a catching event without the corresponding throwing one. // not done for the moment as it does not break executability } // Implicit check: sequence flow cannot cross (sub) process boundaries: we // don't do a processDefinition.findActivity here ActivityImpl sourceActivity = scope.findActivityAtLevelOfSubprocess(sourceRef); ActivityImpl destinationActivity = scope.findActivityAtLevelOfSubprocess(destinationRef); if ((sourceActivity == null && compensationHandlers.containsKey(sourceRef)) || (sourceActivity != null && sourceActivity.isCompensationHandler())) { addError("Invalid outgoing sequence flow of compensation activity '" + sourceRef + "'. A compensation activity should not have an incoming or outgoing sequence flow.", sequenceFlowElement, sourceRef, id); } else if ((destinationActivity == null && compensationHandlers.containsKey(destinationRef)) || (destinationActivity != null && destinationActivity.isCompensationHandler())) { addError("Invalid incoming sequence flow of compensation activity '" + destinationRef + "'. A compensation activity should not have an incoming or outgoing sequence flow.", sequenceFlowElement, destinationRef, id); } else if (sourceActivity == null) { addError("Invalid source '" + sourceRef + "' of sequence flow '" + id + "'", sequenceFlowElement); } else if (destinationActivity == null) { addError("Invalid destination '" + destinationRef + "' of sequence flow '" + id + "'", sequenceFlowElement); } else if (sourceActivity.getActivityBehavior() instanceof EventBasedGatewayActivityBehavior) { // ignore } else if (destinationActivity.getActivityBehavior() instanceof IntermediateCatchEventActivityBehavior && (destinationActivity.getEventScope() != null) && (destinationActivity.getEventScope().getActivityBehavior() instanceof EventBasedGatewayActivityBehavior)) { addError("Invalid incoming sequenceflow for intermediateCatchEvent with id '" + destinationActivity.getId() + "' connected to an event-based gateway.", sequenceFlowElement); } else if (sourceActivity.getActivityBehavior() instanceof SubProcessActivityBehavior && sourceActivity.isTriggeredByEvent()) { addError("Invalid outgoing sequence flow of event subprocess", sequenceFlowElement); } else if (destinationActivity.getActivityBehavior() instanceof SubProcessActivityBehavior && destinationActivity.isTriggeredByEvent()) { addError("Invalid incoming sequence flow of event subprocess", sequenceFlowElement); } else { if(getMultiInstanceScope(sourceActivity) != null) { sourceActivity = getMultiInstanceScope(sourceActivity); } if(getMultiInstanceScope(destinationActivity) != null) { destinationActivity = getMultiInstanceScope(destinationActivity); } TransitionImpl transition = sourceActivity.createOutgoingTransition(id); sequenceFlows.put(id, transition); transition.setProperty("name", sequenceFlowElement.attribute("name")); transition.setProperty("documentation", parseDocumentation(sequenceFlowElement)); transition.setDestination(destinationActivity); parseSequenceFlowConditionExpression(sequenceFlowElement, transition); parseExecutionListenersOnTransition(sequenceFlowElement, transition); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseSequenceFlow(sequenceFlowElement, scope, transition); } } } }
Parses all sequence flow of a scope. @param processElement The 'process' element wherein the sequence flow are defined. @param scope The scope to which the sequence flow must be added. @param compensationHandlers
parseSequenceFlow
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public void parseExecutionListenersOnScope(Element scopeElement, ScopeImpl scope) { Element extentionsElement = scopeElement.element("extensionElements"); String scopeElementId = scopeElement.attribute("id"); if (extentionsElement != null) { List<Element> listenerElements = extentionsElement.elementsNS(CAMUNDA_BPMN_EXTENSIONS_NS, "executionListener"); for (Element listenerElement : listenerElements) { String eventName = listenerElement.attribute("event"); if (isValidEventNameForScope(eventName, listenerElement, scopeElementId)) { ExecutionListener listener = parseExecutionListener(listenerElement, scopeElementId); if (listener != null) { scope.addExecutionListener(eventName, listener); } } } } }
Parses all execution-listeners on a scope. @param scopeElement the XML element containing the scope definition. @param scope the scope to add the executionListeners to.
parseExecutionListenersOnScope
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
Apache-2.0
public static Element findCamundaExtensionElement(Element element, String extensionElementName) { Element extensionElements = element.element("extensionElements"); if(extensionElements != null) { return extensionElements.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, extensionElementName); } else { return null; } }
Returns the camunda extension element in the camunda namespace and the given name. @param element the parent element of the extension element @param extensionElementName the name of the extension element to find @return the extension element or null if not found
findCamundaExtensionElement
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParseUtil.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParseUtil.java
Apache-2.0
public static IoMapping parseInputOutput(Element element) { Element inputOutputElement = element.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "inputOutput"); if(inputOutputElement != null) { IoMapping ioMapping = new IoMapping(); parseCamundaInputParameters(inputOutputElement, ioMapping); parseCamundaOutputParameters(inputOutputElement, ioMapping); return ioMapping; } return null; }
Returns the {@link IoMapping} of an element. @param element the element to parse @return the input output mapping or null if non defined @throws BpmnParseException if a input/output parameter element is malformed
parseInputOutput
java
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParseUtil.java
https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParseUtil.java
Apache-2.0