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 |
|---|---|---|---|---|---|---|---|
public static byte[] encodeBase64(byte[] binaryData, boolean isChunked) {
return encodeBase64(binaryData, isChunked, false);
} | Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks.
@param binaryData
Array containing binary data to encode.
@param isChunked
if <code>true</code> this encoder will chunk the base64 output into 76 character blocks
@return Base64-encoded data.
@throws IllegalArgumentException
Thrown when the input array needs an output array bigger than {@link Integer#MAX_VALUE} | encodeBase64 | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
public static byte[] decodeBase64(String base64String) {
return new Base64().decode(base64String);
} | Decodes a Base64 String into octets
@param base64String
String containing Base64 data
@return Array containing decoded data.
@since 1.4 | decodeBase64 | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
public static byte[] decodeBase64(byte[] base64Data) {
return new Base64().decode(base64Data);
} | Decodes Base64 data into octets
@param base64Data
Byte array containing Base64 data
@return Array containing decoded data. | decodeBase64 | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
static byte[] discardWhitespace(byte[] data) {
byte groomedData[] = new byte[data.length];
int bytesCopied = 0;
for (int i = 0; i < data.length; i++) {
switch (data[i]) {
case ' ' :
case '\n' :
case '\r' :
case '\t' :
break;
default :
groomedData[bytesCopied++] = data[i];
}
}
byte packedData[] = new byte[bytesCopied];
System.arraycopy(groomedData, 0, packedData, 0, bytesCopied);
return packedData;
} | Discards any whitespace from a base-64 encoded block.
@param data
The base-64 encoded data to discard the whitespace from.
@return The data, less whitespace (see RFC 2045).
@deprecated This method is no longer needed | discardWhitespace | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
private static boolean isWhiteSpace(byte byteToCheck) {
switch (byteToCheck) {
case ' ' :
case '\n' :
case '\r' :
case '\t' :
return true;
default :
return false;
}
} | Checks if a byte value is whitespace or not.
@param byteToCheck
the byte to check
@return true if byte is whitespace, false otherwise | isWhiteSpace | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
public Object encode(Object pObject) {
if (!(pObject instanceof byte[])) {
throw new RuntimeException("Parameter supplied to Base64 encode is not a byte[]");
}
return encode((byte[]) pObject);
} | Encodes an Object using the base64 algorithm. This method is provided in order to satisfy the requirements of the
Encoder interface, and will throw an EncoderException if the supplied object is not of type byte[].
@param pObject
Object to encode
@return An object (of type byte[]) containing the base64 encoded data which corresponds to the byte[] supplied.
@throws EncoderException
if the parameter supplied is not of type byte[] | encode | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
public String encodeToString(byte[] pArray) {
return StringUtils.newStringUtf8(encode(pArray));
} | Encodes a byte[] containing binary data, into a String containing characters in the Base64 alphabet.
@param pArray
a byte array containing binary data
@return A String containing only Base64 character data
@since 1.4 | encodeToString | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
public byte[] encode(byte[] pArray) {
reset();
if (pArray == null || pArray.length == 0) {
return pArray;
}
long len = getEncodeLength(pArray, lineLength, lineSeparator);
byte[] buf = new byte[(int) len];
setInitialBuffer(buf, 0, buf.length);
encode(pArray, 0, pArray.length);
encode(pArray, 0, -1); // Notify encoder of EOF.
// Encoder might have resized, even though it was unnecessary.
if (buffer != buf) {
readResults(buf, 0, buf.length);
}
// In URL-SAFE mode we skip the padding characters, so sometimes our
// final length is a bit smaller.
if (isUrlSafe() && pos < buf.length) {
byte[] smallerBuf = new byte[pos];
System.arraycopy(buf, 0, smallerBuf, 0, pos);
buf = smallerBuf;
}
return buf;
} | Encodes a byte[] containing binary data, into a byte[] containing characters in the Base64 alphabet.
@param pArray
a byte array containing binary data
@return A byte array containing only Base64 character data | encode | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
private static long getEncodeLength(byte[] pArray, int chunkSize, byte[] chunkSeparator) {
// base64 always encodes to multiples of 4.
chunkSize = (chunkSize / 4) * 4;
long len = (pArray.length * 4) / 3;
long mod = len % 4;
if (mod != 0) {
len += 4 - mod;
}
if (chunkSize > 0) {
boolean lenChunksPerfectly = len % chunkSize == 0;
len += (len / chunkSize) * chunkSeparator.length;
if (!lenChunksPerfectly) {
len += chunkSeparator.length;
}
}
return len;
} | Pre-calculates the amount of space needed to base64-encode the supplied array.
@param pArray byte[] array which will later be encoded
@param chunkSize line-length of the output (<= 0 means no chunking) between each
chunkSeparator (e.g. CRLF).
@param chunkSeparator the sequence of bytes used to separate chunks of output (e.g. CRLF).
@return amount of space needed to encoded the supplied array. Returns
a long since a max-len array will require Integer.MAX_VALUE + 33%. | getEncodeLength | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
public static BigInteger decodeInteger(byte[] pArray) {
return new BigInteger(1, decodeBase64(pArray));
} | Decodes a byte64-encoded integer according to crypto standards such as W3C's XML-Signature
@param pArray
a byte array containing base64 character data
@return A BigInteger
@since 1.4 | decodeInteger | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
public static byte[] encodeInteger(BigInteger bigInt) {
if (bigInt == null) {
throw new NullPointerException("encodeInteger called with null parameter");
}
return encodeBase64(toIntegerBytes(bigInt), false);
} | Encodes to a byte64-encoded integer according to crypto standards such as W3C's XML-Signature
@param bigInt
a BigInteger
@return A byte array containing base64 character data
@throws NullPointerException
if null is passed in
@since 1.4 | encodeInteger | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
static byte[] toIntegerBytes(BigInteger bigInt) {
int bitlen = bigInt.bitLength();
// round bitlen
bitlen = ((bitlen + 7) >> 3) << 3;
byte[] bigBytes = bigInt.toByteArray();
if (((bigInt.bitLength() % 8) != 0) && (((bigInt.bitLength() / 8) + 1) == (bitlen / 8))) {
return bigBytes;
}
// set up params for copying everything but sign bit
int startSrc = 0;
int len = bigBytes.length;
// if bigInt is exactly byte-aligned, just skip signbit in copy
if ((bigInt.bitLength() % 8) == 0) {
startSrc = 1;
len--;
}
int startDst = bitlen / 8 - len; // to pad w/ nulls as per spec
byte[] resizedBytes = new byte[bitlen / 8];
System.arraycopy(bigBytes, startSrc, resizedBytes, startDst, len);
return resizedBytes;
} | Returns a byte-array representation of a <code>BigInteger</code> without sign bit.
@param bigInt
<code>BigInteger</code> to be converted
@return a byte array representation of the BigInteger parameter | toIntegerBytes | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
private void reset() {
buffer = null;
pos = 0;
readPos = 0;
currentLinePos = 0;
modulus = 0;
eof = false;
} | Resets this Base64 object to its initial newly constructed state. | reset | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java | Apache-2.0 |
public static String newStringUtf8(byte[] bytes) {
return StringUtils.newString(bytes, UTF_8);
} | Constructs a new <code>String</code> by decoding the specified array of bytes using the UTF-8 charset.
@param bytes
The bytes to be decoded into characters
@return A new <code>String</code> decoded from the specified array of bytes using the given charset.
@throws IllegalStateException
Thrown when a {@link UnsupportedEncodingException} is caught, which should never happen since the
charset is required. | newStringUtf8 | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/StringUtils.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/StringUtils.java | Apache-2.0 |
public static byte[] getBytesUtf8(String string) {
return StringUtils.getBytesUnchecked(string, UTF_8);
} | Encodes the given string into a sequence of bytes using the UTF-8 charset, storing the result into a new byte
array.
@param string
the String to encode
@return encoded bytes
@throws IllegalStateException
Thrown when the charset is missing, which should be never according the the Java specification.
@see <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html">Standard charsets</a>
@see #getBytesUnchecked(String, String) | getBytesUtf8 | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/StringUtils.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/StringUtils.java | Apache-2.0 |
public DecisionDefinition execute(CommandContext commandContext) {
ensureNotNull("decisionDefinitionId", decisionDefinitionId);
DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
DecisionDefinitionEntity decisionDefinition = deploymentCache.findDeployedDecisionDefinitionById(decisionDefinitionId);
for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadDecisionDefinition(decisionDefinition);
}
return decisionDefinition;
} | Gives access to a deployed decision definition instance. | execute | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDecisionDefinitionCmd.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDecisionDefinitionCmd.java | Apache-2.0 |
public InputStream execute(final CommandContext commandContext) {
DecisionDefinition decisionDefinition = new GetDeploymentDecisionDefinitionCmd(decisionDefinitionId).execute(commandContext);
final String deploymentId = decisionDefinition.getDeploymentId();
final String resourceName = decisionDefinition.getDiagramResourceName();
if (resourceName != null ) {
return commandContext.runWithoutAuthorization(new GetDeploymentResourceCmd(deploymentId, resourceName));
}
else {
return null;
}
} | Gives access to a deployed decision diagram, e.g., a PNG image, through a stream of bytes. | execute | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDecisionDiagramCmd.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDecisionDiagramCmd.java | Apache-2.0 |
public InputStream execute(final CommandContext commandContext) {
DecisionDefinition decisionDefinition = new GetDeploymentDecisionDefinitionCmd(decisionDefinitionId).execute(commandContext);
final String deploymentId = decisionDefinition.getDeploymentId();
final String resourceName = decisionDefinition.getResourceName();
return commandContext.runWithoutAuthorization(new GetDeploymentResourceCmd(deploymentId, resourceName));
} | Gives access to a deployed decision model, e.g., a DMN 1.0 XML file, through a stream of bytes. | execute | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDecisionModelCmd.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDecisionModelCmd.java | Apache-2.0 |
public DecisionRequirementsDefinition execute(CommandContext commandContext) {
ensureNotNull("decisionRequirementsDefinitionId", decisionRequirementsDefinitionId);
DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
DecisionRequirementsDefinitionEntity decisionRequirementsDefinition = deploymentCache.findDeployedDecisionRequirementsDefinitionById(decisionRequirementsDefinitionId);
for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadDecisionRequirementsDefinition(decisionRequirementsDefinition);
}
return decisionRequirementsDefinition;
} | Gives access to a deployed decision requirements definition instance. | execute | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDecisionRequirementsDefinitionCmd.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDecisionRequirementsDefinitionCmd.java | Apache-2.0 |
public InputStream execute(final CommandContext commandContext) {
DecisionRequirementsDefinition decisionRequirementsDefinition = new GetDeploymentDecisionRequirementsDefinitionCmd(decisionRequirementsDefinitionId).execute(commandContext);
final String deploymentId = decisionRequirementsDefinition.getDeploymentId();
final String resourceName = decisionRequirementsDefinition.getDiagramResourceName();
if (resourceName != null ) {
return commandContext.runWithoutAuthorization(new GetDeploymentResourceCmd(deploymentId, resourceName));
}
else {
return null;
}
} | Gives access to a deployed decision requirements diagram, e.g., a PNG image, through a stream of bytes. | execute | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDecisionRequirementsDiagramCmd.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDecisionRequirementsDiagramCmd.java | Apache-2.0 |
public InputStream execute(final CommandContext commandContext) {
DecisionRequirementsDefinition decisionRequirementsDefinition = new GetDeploymentDecisionRequirementsDefinitionCmd(decisionRequirementsDefinitionId).execute(commandContext);
final String deploymentId = decisionRequirementsDefinition.getDeploymentId();
final String resourceName = decisionRequirementsDefinition.getResourceName();
return commandContext.runWithoutAuthorization(new GetDeploymentResourceCmd(deploymentId, resourceName));
} | Gives access to a deployed decision requirements model, e.g., a DMN 1.1 XML file, through a stream of bytes. | execute | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDecisionRequirementsModelCmd.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDecisionRequirementsModelCmd.java | Apache-2.0 |
public DmnModelInstance execute(CommandContext commandContext) {
ensureNotNull("decisionDefinitionId", decisionDefinitionId);
DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
DecisionDefinitionEntity decisionDefinition = deploymentCache.findDeployedDecisionDefinitionById(decisionDefinitionId);
for(CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadDecisionDefinition(decisionDefinition);
}
DmnModelInstance modelInstance = deploymentCache.findDmnModelInstanceForDecisionDefinition(decisionDefinitionId);
ensureNotNull(DmnModelInstanceNotFoundException.class, "No DMN model instance found for decision definition id " + decisionDefinitionId, "modelInstance",
modelInstance);
return modelInstance;
} | Gives access to a deployed DMN model instance which can be accessed by the
DMN model API. | execute | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDmnModelInstanceCmd.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/dmn/cmd/GetDeploymentDmnModelInstanceCmd.java | Apache-2.0 |
public DecisionDefinitionEntity findLatestDecisionDefinitionByKey(String decisionDefinitionKey) {
@SuppressWarnings("unchecked")
List<DecisionDefinitionEntity> decisionDefinitions = getDbEntityManager().selectList("selectLatestDecisionDefinitionByKey", configureParameterizedQuery(decisionDefinitionKey));
if (decisionDefinitions.isEmpty()) {
return null;
} else if (decisionDefinitions.size() == 1) {
return decisionDefinitions.iterator().next();
} else {
throw LOG.multipleTenantsForDecisionDefinitionKeyException(decisionDefinitionKey);
}
} | @return the latest version of the decision definition with the given key (from any tenant)
@throws ProcessEngineException if more than one tenant has a decision definition with the given key
@see #findLatestDecisionDefinitionByKeyAndTenantId(String, String) | findLatestDecisionDefinitionByKey | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/dmn/entity/repository/DecisionDefinitionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/dmn/entity/repository/DecisionDefinitionManager.java | Apache-2.0 |
@Override
public Object mapDecisionResult(DmnDecisionResult decisionResult) {
return decisionResult.getResultList();
} | Maps the decision result to a list of pairs that contains output name and
untyped entry.
@author Philipp Ossler | mapDecisionResult | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/dmn/result/ResultListDecisionTableResultMapper.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/dmn/result/ResultListDecisionTableResultMapper.java | Apache-2.0 |
public static ExpressionFactory resolveExpressionFactory() {
// Return instance of custom JUEL implementation
return new ExpressionFactoryImpl();
} | Class used to get hold of a {@link ExpressionFactory}.
@author Frederik Heremans | resolveExpressionFactory | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/el/ExpressionFactoryResolver.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/el/ExpressionFactoryResolver.java | Apache-2.0 |
protected ELResolver getElResolverDelegate() {
ProcessApplicationReference processApplicationReference = Context.getCurrentProcessApplication();
if(processApplicationReference != null) {
try {
ProcessApplicationInterface processApplication = processApplicationReference.getProcessApplication();
return processApplication.getBeanElResolver();
} catch (ProcessApplicationUnavailableException e) {
throw new ProcessEngineException("Cannot access process application '"+processApplicationReference.getName()+"'", e);
}
} else {
return new BeanELResolver();
}
} | <p>Resolves a {@link BeanELResolver} from the current process application.
This allows to cache resolvers on the process application level. Such a resolver
cannot be cached globally as {@link BeanELResolver} keeps a cache of classes
involved in expressions.</p>
<p>If resolution is attempted outside the context of a process application,
then always a new resolver instance is returned (i.e. no caching in these cases).</p>
@author Thorben Lindhauer | getElResolverDelegate | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/el/ProcessApplicationBeanElResolverDelegate.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/el/ProcessApplicationBeanElResolverDelegate.java | Apache-2.0 |
default Integer provideCode(ProcessEngineException processEngineException) {
if (processEngineException instanceof OptimisticLockingException) {
return OPTIMISTIC_LOCKING.getCode();
}
return null;
} | <p>Called when a {@link ProcessEngineException} occurs.
<p>Provides the exception code that can be determined based on the passed {@link ProcessEngineException}.
Only called when no other provider method is called.
@param processEngineException that occurred.
@return an integer value representing the error code. When returning {@code null},
the {@link BuiltinExceptionCode#FALLBACK} gets assigned to the exception. | provideCode | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/errorcode/ExceptionCodeProvider.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/errorcode/ExceptionCodeProvider.java | Apache-2.0 |
default Integer provideCode(SQLException sqlException) {
boolean deadlockDetected = ExceptionUtil.checkDeadlockException(sqlException);
if (deadlockDetected) {
return DEADLOCK.getCode();
}
boolean foreignKeyConstraintViolated = ExceptionUtil.checkForeignKeyConstraintViolation(sqlException);
if (foreignKeyConstraintViolated) {
return FOREIGN_KEY_CONSTRAINT_VIOLATION.getCode();
}
boolean columnSizeTooSmall = ExceptionUtil.checkValueTooLongException(sqlException);
if (columnSizeTooSmall) {
return COLUMN_SIZE_TOO_SMALL.getCode();
}
return null;
} | <p>Called when a {@link SQLException} occurs.
<p>Provides the exception code that can be determined based on the passed {@link SQLException}.
The error code is assigned to the top level {@link ProcessEngineException}.
Only called when no other provider method is called.
@param sqlException that occurred.
@return an integer value representing the error code. When returning {@code null},
the {@link BuiltinExceptionCode#FALLBACK} gets assigned to the exception. | provideCode | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/errorcode/ExceptionCodeProvider.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/errorcode/ExceptionCodeProvider.java | Apache-2.0 |
public String name() {
return name;
} | Defines the existing event types, on which the subscription can be done.
Since the the event type for message and signal are historically lower case
the enum variant can't be used, so we have to reimplement an enum like class.
That is done so we can restrict the event types to only the defined ones.
@author Christopher Zell <christopher.zell@camunda.com> | name | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/event/EventType.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/event/EventType.java | Apache-2.0 |
public void couldNotDeterminePriority(ExecutionEntity execution, Object value, ProcessEngineException e) {
logWarn(
"001",
"Could not determine priority for external task created in context of execution {}. Using default priority {}",
execution, value, e);
} | Logs that the priority could not be determined in the given context.
@param execution the context that is used for determining the priority
@param value the default value
@param e the exception which was caught | couldNotDeterminePriority | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/externaltask/ExternalTaskLogger.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/externaltask/ExternalTaskLogger.java | Apache-2.0 |
public void errorEventDefinitionEvaluationException(String taskId, CamundaErrorEventDefinition errorEventDefinition, Exception exception) {
logDebug("002", "Evaluation of error event definition's expression {} on external task {} failed and will be considered as 'false'. "
+ "Received exception: {}", errorEventDefinition.getExpression(), taskId, exception.getMessage());
} | Logs that the error event definition expression could not be evaluated and will be considered as false
@param taskId the context of the definition
@param errorEventDefinition the definition whose expression failed
@param exception the exception that was caught | errorEventDefinitionEvaluationException | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/externaltask/ExternalTaskLogger.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/externaltask/ExternalTaskLogger.java | Apache-2.0 |
public static LockedExternalTaskImpl fromEntity(ExternalTaskEntity externalTaskEntity, List<String> variablesToFetch, boolean isLocal, boolean deserializeVariables, boolean includeExtensionProperties) {
LockedExternalTaskImpl result = new LockedExternalTaskImpl();
result.id = externalTaskEntity.getId();
result.topicName = externalTaskEntity.getTopicName();
result.workerId = externalTaskEntity.getWorkerId();
result.lockExpirationTime = externalTaskEntity.getLockExpirationTime();
result.createTime = externalTaskEntity.getCreateTime();
result.retries = externalTaskEntity.getRetries();
result.errorMessage = externalTaskEntity.getErrorMessage();
result.errorDetails = externalTaskEntity.getErrorDetails();
result.processInstanceId = externalTaskEntity.getProcessInstanceId();
result.executionId = externalTaskEntity.getExecutionId();
result.activityId = externalTaskEntity.getActivityId();
result.activityInstanceId = externalTaskEntity.getActivityInstanceId();
result.processDefinitionId = externalTaskEntity.getProcessDefinitionId();
result.processDefinitionKey = externalTaskEntity.getProcessDefinitionKey();
result.processDefinitionVersionTag = externalTaskEntity.getProcessDefinitionVersionTag();
result.tenantId = externalTaskEntity.getTenantId();
result.priority = externalTaskEntity.getPriority();
result.businessKey = externalTaskEntity.getBusinessKey();
ExecutionEntity execution = externalTaskEntity.getExecution();
result.variables = new VariableMapImpl();
execution.collectVariables(result.variables, variablesToFetch, isLocal, deserializeVariables);
if(includeExtensionProperties) {
result.extensionProperties = (Map<String, String>) execution.getActivity().getProperty(BpmnProperties.EXTENSION_PROPERTIES.getName());
}
if(result.extensionProperties == null) {
result.extensionProperties = Collections.emptyMap();
}
return result;
} | Construct representation of locked ExternalTask from corresponding entity.
During mapping variables will be collected,during collection variables will not be deserialized
and scope will not be set to local.
@see {@link org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope#collectVariables(VariableMapImpl, Collection, boolean, boolean)}
@param externalTaskEntity - source persistent entity to use for fields
@param variablesToFetch - list of variable names to fetch, if null then all variables will be fetched
@param isLocal - if true only local variables will be collected
@return object with all fields copied from the ExternalTaskEntity, error details fetched from the
database and variables attached | fromEntity | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/externaltask/LockedExternalTaskImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/externaltask/LockedExternalTaskImpl.java | Apache-2.0 |
public static void initFormPropertiesOnScope(VariableMap variables, PvmExecutionImpl execution) {
ProcessDefinitionEntity pd = (ProcessDefinitionEntity) execution.getProcessDefinition();
StartFormHandler startFormHandler = pd.getStartFormHandler();
startFormHandler.submitFormVariables(variables, execution);
} | @author Thorben Lindhauer
@author Daniel Meyer | initFormPropertiesOnScope | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/form/FormPropertyHelper.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/form/FormPropertyHelper.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public <T> T getDetail() {
return (T) detail;
} | optional object for detailing the nature of the validation error | getDetail | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/form/validator/FormFieldValidationException.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/form/validator/FormFieldValidationException.java | Apache-2.0 |
default void produceOperationLog(CommandContext commandContext, List<T> results) {
if(results == null || results.isEmpty()) {
return;
}
long logEntriesPerSyncOperationLimit = commandContext.getProcessEngineConfiguration()
.getLogEntriesPerSyncOperationLimit();
if(logEntriesPerSyncOperationLimit == SUMMARY_LOG && results.size() > 1) {
// create summary from multi-result operation
List<PropertyChange> propChangesForOperation = getSummarizingPropChangesForOperation(results);
if(propChangesForOperation == null) {
// convert null return value to empty list
propChangesForOperation = Collections.singletonList(PropertyChange.EMPTY_CHANGE);
}
// use first result as representative for summarized operation log entry
createOperationLogEntry(commandContext, results.get(0), propChangesForOperation, true);
} else {
// create detailed log for each operation result
Map<T, List<PropertyChange>> propChangesForOperation = getPropChangesForOperation(results);
if(propChangesForOperation == null ) {
// create a map with empty result lists for each result item
propChangesForOperation = results.stream().collect(Collectors.toMap(Function.identity(), (result) -> Collections.singletonList(PropertyChange.EMPTY_CHANGE)));
}
if (logEntriesPerSyncOperationLimit != UNLIMITED_LOG && logEntriesPerSyncOperationLimit < propChangesForOperation.size()) {
throw new ProcessEngineException(
"Maximum number of operation log entries for operation type synchronous APIs reached. Configured limit is "
+ logEntriesPerSyncOperationLimit + " but " + propChangesForOperation.size() + " entities were affected by API call.");
} else {
// produce one operation log per affected entity
for (Entry<T, List<PropertyChange>> propChanges : propChangesForOperation.entrySet()) {
createOperationLogEntry(commandContext, propChanges.getKey(), propChanges.getValue(), false);
}
}
}
} | The implementing command can call this method to produce the operation log entries for the current operation. | produceOperationLog | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/history/SynchronousOperationLogProducer.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/history/SynchronousOperationLogProducer.java | Apache-2.0 |
public static void processHistoryEvents(HistoryEventCreator creator) {
HistoryEventProducer historyEventProducer = Context.getProcessEngineConfiguration().getHistoryEventProducer();
HistoryEventHandler historyEventHandler = Context.getProcessEngineConfiguration().getHistoryEventHandler();
HistoryEvent singleEvent = creator.createHistoryEvent(historyEventProducer);
if (singleEvent != null) {
historyEventHandler.handleEvent(singleEvent);
creator.postHandleSingleHistoryEventCreated(singleEvent);
}
List<HistoryEvent> eventList = creator.createHistoryEvents(historyEventProducer);
historyEventHandler.handleEvents(eventList);
} | Process an {@link HistoryEvent} and handle them directly after creation.
The {@link HistoryEvent} is created with the help of the given
{@link HistoryEventCreator} implementation.
@param creator the creator is used to create the {@link HistoryEvent} which should be thrown | processHistoryEvents | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/history/event/HistoryEventProcessor.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/history/event/HistoryEventProcessor.java | Apache-2.0 |
private void addDefaultDbHistoryEventHandler() {
historyEventHandlers.add(new DbHistoryEventHandler());
} | Add {@link DbHistoryEventHandler} to the list of
{@link HistoryEventHandler}. | addDefaultDbHistoryEventHandler | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/history/handler/CompositeDbHistoryEventHandler.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/history/handler/CompositeDbHistoryEventHandler.java | Apache-2.0 |
private void initializeHistoryEventHandlers(final List<HistoryEventHandler> historyEventHandlers) {
EnsureUtil.ensureNotNull("History event handler", historyEventHandlers);
for (HistoryEventHandler historyEventHandler : historyEventHandlers) {
EnsureUtil.ensureNotNull("History event handler", historyEventHandler);
this.historyEventHandlers.add(historyEventHandler);
}
} | Initialize {@link #historyEventHandlers} with data transfered from constructor
@param historyEventHandlers | initializeHistoryEventHandlers | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/history/handler/CompositeHistoryEventHandler.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/history/handler/CompositeHistoryEventHandler.java | Apache-2.0 |
protected void initializeIncidentsHandlers(IncidentHandler mainIncidentHandler,
final List<IncidentHandler> incidentHandlers) {
EnsureUtil.ensureNotNull("Incident handler", mainIncidentHandler);
this.mainIncidentHandler = mainIncidentHandler;
EnsureUtil.ensureNotNull("Incident handlers", incidentHandlers);
for (IncidentHandler incidentHandler : incidentHandlers) {
add(incidentHandler);
}
} | Initialize {@link #incidentHandlers} with data transfered from constructor
@param incidentHandlers | initializeIncidentsHandlers | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/incident/CompositeIncidentHandler.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/incident/CompositeIncidentHandler.java | Apache-2.0 |
@Override
public <T> T execute(Command<T> command) {
try {
return next.execute(command);
} catch (ProcessEngineException pex) {
assignCodeToException(pex);
throw pex;
}
} | <p>A command interceptor to catch {@link ProcessEngineException} errors and assign error codes.
<p>The interceptor assigns an error code to the {@link ProcessEngineException}
based on the built-in or custom {@link ExceptionCodeProvider}. | execute | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/interceptor/ExceptionCodeInterceptor.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/interceptor/ExceptionCodeInterceptor.java | Apache-2.0 |
public void clearMdc() {
if (handleMdc) {
mdcDataStacks.values().forEach(ProcessDataStack::clearMdcProperty);
}
} | Remove all logging context properties from the MDC | clearMdc | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/interceptor/ProcessDataContext.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/interceptor/ProcessDataContext.java | Apache-2.0 |
public void updateMdcFromCurrentValues() {
if (handleMdc) {
mdcDataStacks.values().forEach(ProcessDataStack::updateMdcWithCurrentValue);
}
} | Update the MDC with the current values of this logging context | updateMdcFromCurrentValues | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/interceptor/ProcessDataContext.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/interceptor/ProcessDataContext.java | Apache-2.0 |
public void addToCurrentSection(ProcessDataStack stack) {
List<ProcessDataStack> currentSection;
if (currentSectionSealed) {
currentSection = new ArrayList<>();
sections.addFirst(currentSection);
currentSectionSealed = false;
} else {
currentSection = sections.peekFirst();
}
currentSection.add(stack);
} | Adds a stack to the current section. If the current section is already sealed,
a new section is created. | addToCurrentSection | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/interceptor/ProcessDataContext.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/interceptor/ProcessDataContext.java | Apache-2.0 |
public void popCurrentSection() {
List<ProcessDataStack> section = sections.pollFirst();
if (section != null) {
section.forEach(ProcessDataStack::removeCurrentValue);
}
currentSectionSealed = true;
} | Pops the current section and removes the
current values from the referenced stacks (including updates
to the MDC) | popCurrentSection | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/interceptor/ProcessDataContext.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/interceptor/ProcessDataContext.java | Apache-2.0 |
protected ClassLoader switchClassLoader() {
return ClassLoaderUtil.switchToProcessEngineClassloader();
} | Switch the context classloader to the ProcessEngine's
to assure the loading of the engine classes during job execution<br>
<b>Note</b>: this method is overridden by
org.camunda.bpm.container.impl.threading.ra.inflow.JcaInflowExecuteJobsRunnable#switchClassLoader()
- where the classloader switch is not required
@see https://app.camunda.com/jira/browse/CAM-10379
@return the classloader before the switch to return it back after the job execution | switchClassLoader | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/ExecuteJobsRunnable.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/ExecuteJobsRunnable.java | Apache-2.0 |
public boolean areAllEnginesIdle() {
for (AcquiredJobs acquiredJobs : acquiredJobsByEngine.values()) {
int jobsAcquired = acquiredJobs.getJobIdBatches().size() + acquiredJobs.getNumberOfJobsFailedToLock();
if (jobsAcquired >= acquiredJobs.getNumberOfJobsAttemptedToAcquire()) {
return false;
}
}
return true;
} | @return true, if for all engines there were less jobs acquired than requested | areAllEnginesIdle | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/JobAcquisitionContext.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/JobAcquisitionContext.java | Apache-2.0 |
public Map<String, AcquiredJobs> getAcquiredJobsByEngine() {
return acquiredJobsByEngine;
} | Jobs that were acquired in the current acquisition cycle.
@return | getAcquiredJobsByEngine | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/JobAcquisitionContext.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/JobAcquisitionContext.java | Apache-2.0 |
public static Map<String, TimerDeclarationImpl> getDeclarationsForScope(PvmScope scope) {
if (scope == null) {
return Collections.emptyMap();
}
Map<String, TimerDeclarationImpl> result = scope.getProperties().get(BpmnProperties.TIMER_DECLARATIONS);
if (result != null) {
return result;
}
else {
return Collections.emptyMap();
}
} | @return all timers declared in the given scope | getDeclarationsForScope | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/TimerDeclarationImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/TimerDeclarationImpl.java | Apache-2.0 |
public static Map<String, Map<String, TimerDeclarationImpl>> getTimeoutListenerDeclarationsForScope(PvmScope scope) {
if (scope == null) {
return Collections.emptyMap();
}
Map<String, Map<String, TimerDeclarationImpl>> result = scope.getProperties().get(BpmnProperties.TIMEOUT_LISTENER_DECLARATIONS);
if (result != null) {
return result;
}
else {
return Collections.emptyMap();
}
} | @return all timeout listeners declared in the given scope | getTimeoutListenerDeclarationsForScope | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/TimerDeclarationImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/TimerDeclarationImpl.java | Apache-2.0 |
public static int getMaxRetries() {
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
boolean isConfiguredByUser = (config.getHistoryCleanupDefaultNumberOfRetries() != Integer.MIN_VALUE);
if (!isConfiguredByUser) {
return config.getDefaultNumberOfRetries();
}
return config.getHistoryCleanupDefaultNumberOfRetries();
} | Returns the max retries used for cleanup jobs. If the configuration is null, the default value used will be
defaultNumberOfRetries, the configuration used for all jobs.
@return the effective max number of retries | getMaxRetries | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/historycleanup/HistoryCleanupHelper.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/historycleanup/HistoryCleanupHelper.java | Apache-2.0 |
public List<QueryOrderingProperty> fromOrderByString(String orderByString) {
List<QueryOrderingProperty> properties = new ArrayList<QueryOrderingProperty>();
String[] orderByClauses = orderByString.split(ORDER_BY_DELIMITER);
for (String orderByClause : orderByClauses) {
orderByClause = orderByClause.trim();
String[] clauseParts = orderByClause.split(" ");
if (clauseParts.length == 0) {
continue;
} else if (clauseParts.length > 2) {
throw new ProcessEngineException("Invalid order by clause: " + orderByClause);
}
String function = null;
String propertyPart = clauseParts[0];
int functionArgumentBegin = propertyPart.indexOf("(");
if (functionArgumentBegin >= 0) {
function = propertyPart.substring(0, functionArgumentBegin);
int functionArgumentEnd = propertyPart.indexOf(")");
propertyPart = propertyPart.substring(functionArgumentBegin + 1, functionArgumentEnd);
}
String[] propertyParts = propertyPart.split("\\.");
String property = null;
if (propertyParts.length == 1) {
property = propertyParts[0];
} else if (propertyParts.length == 2) {
property = propertyParts[1];
} else {
throw new ProcessEngineException("Invalid order by property part: " + clauseParts[0]);
}
QueryProperty queryProperty = new QueryPropertyImpl(property, function);
Direction direction = null;
if (clauseParts.length == 2) {
String directionPart = clauseParts[1];
direction = Direction.findByName(directionPart);
}
QueryOrderingProperty orderingProperty = new QueryOrderingProperty(null, queryProperty);
orderingProperty.setDirection(direction);
properties.add(orderingProperty);
}
return properties;
} | Deserializes query ordering properties from the deprecated 7.2 format in which
the SQL-like orderBy parameter was used.
Is able to deserialize strings like:
<ul>
<li>RES.ID_ asc</li>
<li>LOWER(RES.NAME_) desc</li>
<li>RES.ID_ asc, RES.NAME_ desc</li>
</ul>
@author Thorben Lindhauer | fromOrderByString | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/json/JsonLegacyQueryOrderingPropertyConverter.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/json/JsonLegacyQueryOrderingPropertyConverter.java | Apache-2.0 |
public void createMeter(String name) {
Meter dbMeter = new Meter(name);
dbMeters.put(name, dbMeter);
Meter diagnosticsMeter = new Meter(name);
diagnosticsMeters.put(name, diagnosticsMeter);
} | Creates a meter for both database and diagnostics collection. | createMeter | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/metrics/MetricsRegistry.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/metrics/MetricsRegistry.java | Apache-2.0 |
public void createDbMeter(String name) {
Meter dbMeter = new Meter(name);
dbMeters.put(name, dbMeter);
} | Creates a meter only for database collection. | createDbMeter | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/metrics/MetricsRegistry.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/metrics/MetricsRegistry.java | Apache-2.0 |
public static String resolveInternalName(final String publicName) {
if (publicName == null) return null;
switch (publicName) {
case Metrics.TASK_USERS: return Metrics.UNIQUE_TASK_WORKERS;
case Metrics.PROCESS_INSTANCES: return Metrics.ROOT_PROCESS_INSTANCE_START;
case Metrics.DECISION_INSTANCES: return Metrics.EXECUTED_DECISION_INSTANCES;
case Metrics.FLOW_NODE_INSTANCES: return Metrics.ACTIVTY_INSTANCE_START;
default: return publicName;
}
} | Resolves the internal name of the metric by the public name.
@param publicName the public name
@return the internal name | resolveInternalName | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/metrics/util/MetricsUtil.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/metrics/util/MetricsUtil.java | Apache-2.0 |
public static String resolvePublicName(final String internalName) {
if (internalName == null) return null;
switch (internalName) {
case Metrics.UNIQUE_TASK_WORKERS: return Metrics.TASK_USERS;
case Metrics.ROOT_PROCESS_INSTANCE_START: return Metrics.PROCESS_INSTANCES;
case Metrics.EXECUTED_DECISION_INSTANCES: return Metrics.DECISION_INSTANCES;
case Metrics.ACTIVTY_INSTANCE_START: return Metrics.FLOW_NODE_INSTANCES;
default: return internalName;
}
} | Resolves the public name of the metric by the internal name.
@param internalName the internal name
@return the public name | resolvePublicName | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/metrics/util/MetricsUtil.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/metrics/util/MetricsUtil.java | Apache-2.0 |
@Override
public <T> Cache<String, T> createCache(int maxNumberOfElementsInCache) {
return new ConcurrentLruCache<String, T>(maxNumberOfElementsInCache);
} | <p>Provides the default cache implementation for the deployment caches see {@link DeploymentCache}.</p>
@author Johannes Heinemann | createCache | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/deploy/cache/DefaultCacheFactory.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/deploy/cache/DefaultCacheFactory.java | Apache-2.0 |
public ProcessDefinitionEntity findDeployedLatestProcessDefinitionByKey(String processDefinitionKey) {
return processDefinitionEntityCache.findDeployedLatestDefinitionByKey(processDefinitionKey);
} | @return the latest version of the process definition with the given key (from any tenant)
@throws ProcessEngineException if more than one tenant has a process definition with the given key
@see #findDeployedLatestProcessDefinitionByKeyAndTenantId(String, String) | findDeployedLatestProcessDefinitionByKey | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/deploy/cache/DeploymentCache.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/deploy/cache/DeploymentCache.java | Apache-2.0 |
public CaseDefinitionEntity findDeployedLatestCaseDefinitionByKey(String caseDefinitionKey) {
return caseDefinitionCache.findDeployedLatestDefinitionByKey(caseDefinitionKey);
} | @return the latest version of the case definition with the given key (from any tenant)
@throws ProcessEngineException if more than one tenant has a case definition with the given key
@see #findDeployedLatestCaseDefinitionByKeyAndTenantId(String, String) | findDeployedLatestCaseDefinitionByKey | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/deploy/cache/DeploymentCache.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/deploy/cache/DeploymentCache.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public List<EventSubscriptionEntity> findSignalEventSubscriptionsByEventName(String eventName) {
final String query = "selectSignalEventSubscriptionsByEventName";
Set<EventSubscriptionEntity> eventSubscriptions = new HashSet<EventSubscriptionEntity>( getDbEntityManager().selectList(query, configureParameterizedQuery(eventName)));
// add events created in this command (not visible yet in query)
for (EventSubscriptionEntity entity : createdSignalSubscriptions) {
if(eventName.equals(entity.getEventName())) {
eventSubscriptions.add(entity);
}
}
return new ArrayList<EventSubscriptionEntity>(eventSubscriptions);
} | Find all signal event subscriptions with the given event name for any tenant.
@see #findSignalEventSubscriptionsByEventNameAndTenantId(String, String) | findSignalEventSubscriptionsByEventName | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public List<EventSubscriptionEntity> findSignalEventSubscriptionsByEventNameAndTenantId(String eventName, String tenantId) {
final String query = "selectSignalEventSubscriptionsByEventNameAndTenantId";
Map<String, Object> parameter = new HashMap<String, Object>();
parameter.put("eventName", eventName);
parameter.put("tenantId", tenantId);
Set<EventSubscriptionEntity> eventSubscriptions = new HashSet<EventSubscriptionEntity>( getDbEntityManager().selectList(query, parameter));
// add events created in this command (not visible yet in query)
for (EventSubscriptionEntity entity : createdSignalSubscriptions) {
if(eventName.equals(entity.getEventName()) && hasTenantId(entity, tenantId)) {
eventSubscriptions.add(entity);
}
}
return new ArrayList<EventSubscriptionEntity>(eventSubscriptions);
} | Find all signal event subscriptions with the given event name and tenant. | findSignalEventSubscriptionsByEventNameAndTenantId | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public List<EventSubscriptionEntity> findMessageStartEventSubscriptionByName(String messageName) {
return getDbEntityManager().selectList("selectMessageStartEventSubscriptionByName", configureParameterizedQuery(messageName));
} | @return the message start event subscriptions with the given message name (from any tenant)
@see #findMessageStartEventSubscriptionByNameAndTenantId(String, String) | findMessageStartEventSubscriptionByName | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java | Apache-2.0 |
public EventSubscriptionEntity findMessageStartEventSubscriptionByNameAndTenantId(String messageName, String tenantId) {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("messageName", messageName);
parameters.put("tenantId", tenantId);
return (EventSubscriptionEntity) getDbEntityManager().selectOne("selectMessageStartEventSubscriptionByNameAndTenantId", parameters);
} | @return the message start event subscription with the given message name and tenant id
@see #findMessageStartEventSubscriptionByName(String) | findMessageStartEventSubscriptionByNameAndTenantId | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public List<EventSubscriptionEntity> findConditionalStartEventSubscriptionByTenantId(String tenantId) {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("tenantId", tenantId);
configureParameterizedQuery(parameters);
return getDbEntityManager().selectList("selectConditionalStartEventSubscriptionByTenantId", parameters);
} | @param tenantId
@return the conditional start event subscriptions with the given tenant id | findConditionalStartEventSubscriptionByTenantId | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java | Apache-2.0 |
protected void ensureExecutionTreeInitialized() {
List<ExecutionEntity> executions = Context.getCommandContext()
.getExecutionManager()
.findExecutionsByProcessInstanceId(processInstanceId);
ExecutionEntity processInstance = isProcessInstanceExecution() ? this : null;
if(processInstance == null) {
for (ExecutionEntity execution : executions) {
if (execution.isProcessInstanceExecution()) {
processInstance = execution;
}
}
}
processInstance.restoreProcessInstance(executions, null, null, null, null, null, null);
} | Fetch all the executions inside the same process instance as list and then
reconstruct the complete execution tree.
In many cases this is an optimization over fetching the execution tree
lazily. Usually we need all executions anyway and it is preferable to fetch
more data in a single query (maybe even too much data) then to run multiple
queries, each returning a fraction of the data.
The most important consideration here is network roundtrip: If the process
engine and database run on separate hosts, network roundtrip has to be
added to each query. Economizing on the number of queries economizes on
network roundtrip. The tradeoff here is network roundtrip vs. throughput:
multiple roundtrips carrying small chucks of data vs. a single roundtrip
carrying more data. | ensureExecutionTreeInitialized | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity.java | Apache-2.0 |
protected boolean isJobDue(JobEntity job) {
Date duedate = job.getDuedate();
Date now = ClockUtil.getCurrentTime();
return duedate == null || duedate.getTime() <= now.getTime();
} | Sometimes we get a notification of a job that is not yet due, so we
should not execute it immediately | isJobDue | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/JobManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/JobManager.java | Apache-2.0 |
public void insertProcessDefinition(ProcessDefinitionEntity processDefinition) {
getDbEntityManager().insert(processDefinition);
createDefaultAuthorizations(processDefinition);
} | @author Tom Baeyens
@author Falko Menge
@author Saeid Mirzaei
@author Christopher Zell | insertProcessDefinition | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | Apache-2.0 |
public ProcessDefinitionEntity findLatestProcessDefinitionByKey(String processDefinitionKey) {
List<ProcessDefinitionEntity> processDefinitions = findLatestProcessDefinitionsByKey(processDefinitionKey);
if (processDefinitions.isEmpty()) {
return null;
} else if (processDefinitions.size() == 1) {
return processDefinitions.iterator().next();
} else {
throw LOG.multipleTenantsForProcessDefinitionKeyException(processDefinitionKey);
}
} | @return the latest version of the process definition with the given key (from any tenant)
@throws ProcessEngineException if more than one tenant has a process definition with the given key
@see #findLatestProcessDefinitionByKeyAndTenantId(String, String) | findLatestProcessDefinitionByKey | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public List<ProcessDefinitionEntity> findLatestProcessDefinitionsByKey(String processDefinitionKey) {
return getDbEntityManager().selectList("selectLatestProcessDefinitionByKey", configureParameterizedQuery(processDefinitionKey));
} | @return the latest versions of the process definition with the given key (from any tenant),
contains multiple elements if more than one tenant has a process definition with
the given key
@see #findLatestProcessDefinitionByKey(String) | findLatestProcessDefinitionsByKey | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | Apache-2.0 |
protected void cascadeDeleteProcessInstancesForProcessDefinition(String processDefinitionId, boolean skipCustomListeners, boolean skipIoMappings) {
getProcessInstanceManager()
.deleteProcessInstancesByProcessDefinition(processDefinitionId, "deleted process definition", true, skipCustomListeners, skipIoMappings);
} | Cascades the deletion of the process definition to the process instances.
Skips the custom listeners if the flag was set to true.
@param processDefinitionId the process definition id
@param skipCustomListeners true if the custom listeners should be skipped at process instance deletion
@param skipIoMappings specifies whether input/output mappings for tasks should be invoked | cascadeDeleteProcessInstancesForProcessDefinition | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | Apache-2.0 |
protected void cascadeDeleteHistoryForProcessDefinition(String processDefinitionId) {
// remove historic incidents which are not referenced to a process instance
getHistoricIncidentManager().deleteHistoricIncidentsByProcessDefinitionId(processDefinitionId);
// remove historic identity links which are not reference to a process instance
getHistoricIdentityLinkManager().deleteHistoricIdentityLinksLogByProcessDefinitionId(processDefinitionId);
// remove historic job log entries not related to a process instance
getHistoricJobLogManager().deleteHistoricJobLogsByProcessDefinitionId(processDefinitionId);
} | Cascades the deletion of a process definition to the history, deletes the history.
@param processDefinitionId the process definition id | cascadeDeleteHistoryForProcessDefinition | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | Apache-2.0 |
protected void deleteTimerStartEventsForProcessDefinition(ProcessDefinition processDefinition) {
List<JobEntity> timerStartJobs = getJobManager().findJobsByConfiguration(TimerStartEventJobHandler.TYPE, processDefinition.getKey(), processDefinition.getTenantId());
ProcessDefinitionEntity latestVersion = getProcessDefinitionManager()
.findLatestProcessDefinitionByKeyAndTenantId(processDefinition.getKey(), processDefinition.getTenantId());
// delete timer start event jobs only if this is the latest version of the process definition.
if(latestVersion != null && latestVersion.getId().equals(processDefinition.getId())) {
for (Job job : timerStartJobs) {
((JobEntity)job).delete();
}
}
} | Deletes the timer start events for the given process definition.
@param processDefinition the process definition | deleteTimerStartEventsForProcessDefinition | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | Apache-2.0 |
public void deleteSubscriptionsForProcessDefinition(String processDefinitionId) {
List<EventSubscriptionEntity> eventSubscriptionsToRemove = new ArrayList<EventSubscriptionEntity>();
// remove message event subscriptions:
List<EventSubscriptionEntity> messageEventSubscriptions = getEventSubscriptionManager()
.findEventSubscriptionsByConfiguration(EventType.MESSAGE.name(), processDefinitionId);
eventSubscriptionsToRemove.addAll(messageEventSubscriptions);
// remove signal event subscriptions:
List<EventSubscriptionEntity> signalEventSubscriptions = getEventSubscriptionManager().findEventSubscriptionsByConfiguration(EventType.SIGNAL.name(), processDefinitionId);
eventSubscriptionsToRemove.addAll(signalEventSubscriptions);
// remove conditional event subscriptions:
List<EventSubscriptionEntity> conditionalEventSubscriptions = getEventSubscriptionManager().findEventSubscriptionsByConfiguration(EventType.CONDITONAL.name(), processDefinitionId);
eventSubscriptionsToRemove.addAll(conditionalEventSubscriptions);
for (EventSubscriptionEntity eventSubscriptionEntity : eventSubscriptionsToRemove) {
eventSubscriptionEntity.delete();
}
} | Deletes the subscriptions for the process definition, which is
identified by the given process definition id.
@param processDefinitionId the id of the process definition | deleteSubscriptionsForProcessDefinition | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java | Apache-2.0 |
protected boolean invokeListener(CoreExecution currentExecution, String eventName, TaskListener taskListener) throws Exception {
boolean isBpmnTask = currentExecution instanceof ActivityExecution && currentExecution != null;
final TaskListenerInvocation listenerInvocation = new TaskListenerInvocation(taskListener, this, currentExecution);
try {
Context.getProcessEngineConfiguration()
.getDelegateInterceptor()
.handleInvocation(listenerInvocation);
} catch (Exception ex) {
// exceptions on delete events are never handled as BPMN errors
if (isBpmnTask && !eventName.equals(EVENTNAME_DELETE)) {
try {
BpmnExceptionHandler.propagateException((ActivityExecution) currentExecution, ex);
return false;
}
catch (ErrorPropagationException e) {
// exception has been logged by thrower
// re-throw the original exception so that it is logged
// and set as cause of the failure
throw ex;
}
}
else {
throw ex;
}
}
return true;
} | @return true if the next listener can be invoked; false if not | invokeListener | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/TaskEntity.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/TaskEntity.java | Apache-2.0 |
public void setTransient(boolean isTransient) {
this.isTransient = isTransient;
} | @param isTransient
<code>true</code>, if the variable is not stored in the data base.
Default is <code>false</code>. | setTransient | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/VariableInstanceEntity.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/VariableInstanceEntity.java | Apache-2.0 |
public boolean wasCreatedBefore713() {
return this.getProcessDefinitionId() == null;
} | @return <code>true</code> <code>processDefinitionId</code> is introduced in 7.13,
the check is used to created missing history at {@link LegacyBehavior#createMissingHistoricVariables(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) LegacyBehavior#createMissingHistoricVariables} | wasCreatedBefore713 | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/VariableInstanceEntity.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/VariableInstanceEntity.java | Apache-2.0 |
public String getTypeName() {
if (serializerName == null) {
return ValueType.NULL.getName();
} else {
return getSerializer().getType().getName();
}
} | @return the type name of the value | getTypeName | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/util/TypedValueField.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/util/TypedValueField.java | Apache-2.0 |
public boolean isCompensationHandler() {
Boolean isForCompensation = (Boolean) getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION);
return Boolean.TRUE.equals(isForCompensation);
} | Indicates whether activity is for compensation.
@return true if this activity is for compensation. | isCompensationHandler | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ActivityImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ActivityImpl.java | Apache-2.0 |
public ActivityImpl findCompensationHandler() {
String compensationHandlerId = (String) getProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID);
if(compensationHandlerId != null) {
return getProcessDefinition().findActivity(compensationHandlerId);
} else {
return null;
}
} | Find the compensation handler of this activity.
@return the compensation handler or <code>null</code>, if this activity has no compensation handler. | findCompensationHandler | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ActivityImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ActivityImpl.java | Apache-2.0 |
public Collection<BacklogErrorCallback> getBacklogErrorCallbacks() {
return BACKLOG.values();
} | Returns the backlog error callback's.
@return the callback's | getBacklogErrorCallbacks | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ScopeImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ScopeImpl.java | Apache-2.0 |
public boolean isBacklogEmpty() {
return BACKLOG.isEmpty();
} | Returns true if the backlog is empty.
@return true if empty, false otherwise | isBacklogEmpty | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ScopeImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ScopeImpl.java | Apache-2.0 |
protected ExecutionImpl newExecution() {
return new ExecutionImpl();
} | instantiates a new execution. can be overridden by subclasses | newExecution | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/ExecutionImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/ExecutionImpl.java | Apache-2.0 |
public void setProcessInstance(PvmExecutionImpl processInstance) {
this.processInstance = (ExecutionImpl) processInstance;
} | for setting the process instance, this setter must be used as subclasses can override | setProcessInstance | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/ExecutionImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/ExecutionImpl.java | Apache-2.0 |
public static void pruneConcurrentScope(PvmExecutionImpl execution) {
ensureConcurrentScope(execution);
LOG.debugConcurrentScopeIsPruned(execution);
execution.setConcurrent(false);
} | Prunes a concurrent scope. This can only happen if
(a) the process instance has been migrated from a previous version to a new version of the process engine
This is an inverse operation to {@link #createConcurrentScope(PvmExecutionImpl)}.
See: javadoc of this class for note about concurrent scopes.
@param execution | pruneConcurrentScope | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | Apache-2.0 |
public static void cancelConcurrentScope(PvmExecutionImpl execution, PvmActivity cancelledScopeActivity) {
ensureConcurrentScope(execution);
LOG.debugCancelConcurrentScopeExecution(execution);
execution.interrupt("Scope "+cancelledScopeActivity+" cancelled.");
// <!> HACK set to event scope activity and leave activity instance
execution.setActivity(cancelledScopeActivity);
execution.leaveActivityInstance();
execution.interrupt("Scope "+cancelledScopeActivity+" cancelled.");
execution.destroy();
} | Cancels an execution which is both concurrent and scope. This can only happen if
(a) the process instance has been migrated from a previous version to a new version of the process engine
See: javadoc of this class for note about concurrent scopes.
@param execution the concurrent scope execution to destroy
@param cancelledScopeActivity the activity that cancels the execution; it must hold that
cancellingActivity's event scope is the scope the execution is responsible for | cancelConcurrentScope | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | Apache-2.0 |
public static boolean destroySecondNonScope(PvmExecutionImpl execution) {
ensureScope(execution);
boolean performLegacyBehavior = isLegacyBehaviorRequired(execution);
if(performLegacyBehavior) {
// legacy behavior is to do nothing
}
return performLegacyBehavior;
} | Destroy an execution for an activity that was previously not a scope and now is
(e.g. event subprocess) | destroySecondNonScope | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | Apache-2.0 |
public static Map<ScopeImpl, PvmExecutionImpl> createActivityExecutionMapping(List<PvmExecutionImpl> scopeExecutions, List<ScopeImpl> scopes) {
PvmExecutionImpl deepestExecution = scopeExecutions.get(0);
if (isLegacyAsyncAtMultiInstance(deepestExecution)) {
// in case the deepest execution is in fact async at multi-instance, the multi instance body is part
// of the list of scopes, however it is not instantiated yet or has already ended. Thus it must be removed.
scopes.remove(0);
}
// The trees are out of sync.
// We are missing executions:
int numOfMissingExecutions = scopes.size() - scopeExecutions.size();
// We need to find out which executions are missing.
// Consider: elements which did not use to be scopes are now scopes.
// But, this does not mean that all instances of elements which became scopes
// are missing their executions. We could have created new instances in the
// lower part of the tree after legacy behavior was turned off while instances of these elements
// further up the hierarchy miss scopes. So we need to iterate from the top down and skip all scopes which
// were not scopes before:
Collections.reverse(scopeExecutions);
Collections.reverse(scopes);
Map<ScopeImpl, PvmExecutionImpl> mapping = new HashMap<ScopeImpl, PvmExecutionImpl>();
// process definition / process instance.
mapping.put(scopes.get(0), scopeExecutions.get(0));
// nested activities
int executionCounter = 0;
for(int i = 1; i < scopes.size(); i++) {
ActivityImpl scope = (ActivityImpl) scopes.get(i);
PvmExecutionImpl scopeExecutionCandidate = null;
if (executionCounter + 1 < scopeExecutions.size()) {
scopeExecutionCandidate = scopeExecutions.get(executionCounter + 1);
}
if(numOfMissingExecutions > 0 && wasNoScope(scope, scopeExecutionCandidate)) {
// found a missing scope
numOfMissingExecutions--;
}
else {
executionCounter++;
}
if (executionCounter >= scopeExecutions.size()) {
throw new ProcessEngineException("Cannot construct activity-execution mapping: there are "
+ "more scope executions missing than explained by the flow scope hierarchy.");
}
PvmExecutionImpl execution = scopeExecutions.get(executionCounter);
mapping.put(scope, execution);
}
return mapping;
} | Creates an activity execution mapping, when the scope hierarchy and the execution hierarchy are out of sync.
@param scopeExecutions
@param scopes
@return | createActivityExecutionMapping | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | Apache-2.0 |
protected static boolean isLegacyAsyncAtMultiInstance(PvmExecutionImpl execution) {
ActivityImpl activity = execution.getActivity();
if (activity != null) {
boolean isAsync = execution.getActivityInstanceId() == null;
boolean isAtMultiInstance = activity.getParentFlowScopeActivity() != null
&& activity.getParentFlowScopeActivity().getActivityBehavior() instanceof MultiInstanceActivityBehavior;
return isAsync && isAtMultiInstance;
}
else {
return false;
}
} | This returns true only if the provided execution has reached its wait state in a legacy engine version, because
only in that case, it can be async and waiting at the inner activity wrapped by the miBody. In versions >= 7.3,
the execution would reference the multi-instance body instead. | isLegacyAsyncAtMultiInstance | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | Apache-2.0 |
public static PvmExecutionImpl determinePropagatingExecutionOnEnd(PvmExecutionImpl propagatingExecution, Map<ScopeImpl, PvmExecutionImpl> activityExecutionMapping) {
if (!propagatingExecution.isScope()) {
// non-scope executions may end in the "wrong" flow scope
return propagatingExecution;
}
else {
// superfluous scope executions won't be contained in the activity-execution mapping
if (activityExecutionMapping.values().contains(propagatingExecution)) {
return propagatingExecution;
}
else {
// skip one scope
propagatingExecution.remove();
PvmExecutionImpl parent = propagatingExecution.getParent();
parent.setActivity(propagatingExecution.getActivity());
return propagatingExecution.getParent();
}
}
} | Tolerates the broken execution trees fixed with CAM-3727 where there may be more
ancestor scope executions than ancestor flow scopes;
In that case, the argument execution is removed, the parent execution of the argument
is returned such that one level of mismatch is corrected.
Note that this does not necessarily skip the correct scope execution, since
the broken parent-child relationships may be anywhere in the tree (e.g. consider a non-interrupting
boundary event followed by a subprocess (i.e. scope), when the subprocess ends, we would
skip the subprocess's execution). | determinePropagatingExecutionOnEnd | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | Apache-2.0 |
public static boolean isConcurrentScope(PvmExecutionImpl propagatingExecution) {
return propagatingExecution.isConcurrent() && propagatingExecution.isScope();
} | Concurrent + scope executions are legacy and could occur in processes with non-interrupting
boundary events or event subprocesses | isConcurrentScope | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | Apache-2.0 |
public static void removeLegacySubscriptionOnParent(ExecutionEntity execution, EventSubscriptionEntity eventSubscription) {
ActivityImpl activity = execution.getActivity();
if (activity == null) {
return;
}
ActivityBehavior behavior = activity.getActivityBehavior();
ActivityBehavior parentBehavior = (ActivityBehavior) (activity.getFlowScope() != null ? activity.getFlowScope().getActivityBehavior() : null);
if (behavior instanceof ReceiveTaskActivityBehavior &&
parentBehavior instanceof MultiInstanceActivityBehavior) {
List<EventSubscriptionEntity> parentSubscriptions = execution.getParent().getEventSubscriptions();
for (EventSubscriptionEntity subscription : parentSubscriptions) {
// distinguish a boundary event on the mi body with the same message name from the receive task subscription
if (areEqualEventSubscriptions(subscription, eventSubscription)) {
subscription.delete();
}
}
}
} | <p>Required for migrating active sequential MI receive tasks. These activities were formerly not scope,
but are now. This has the following implications:
<p>Before migration:
<ul><li> the event subscription is attached to the miBody scope execution</ul>
<p>After migration:
<ul><li> a new subscription is created for every instance
<li> the new subscription is attached to a dedicated scope execution as a child of the miBody scope
execution</ul>
<p>Thus, this method removes the subscription on the miBody scope | removeLegacySubscriptionOnParent | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | Apache-2.0 |
public static void repairMultiInstanceAsyncJob(ExecutionEntity execution) {
ActivityImpl activity = execution.getActivity();
if (!isAsync(activity) && isActivityWrappedInMultiInstanceBody(activity)) {
execution.setActivity((ActivityImpl) activity.getFlowScope());
}
} | When executing an async job for an activity wrapped in an miBody, set the execution to the
miBody except the wrapped activity is marked as async.
Background: in <= 7.2 async jobs were created for the inner activity, although the
semantics are that they are executed before the miBody is entered | repairMultiInstanceAsyncJob | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | Apache-2.0 |
public static boolean signalCancelBoundaryEvent(String signalName) {
return SIGNAL_COMPENSATION_DONE.equals(signalName);
} | With prior versions, the boundary event was already executed when compensation was performed; Thus, after
compensation completes, the execution is signalled waiting at the boundary event. | signalCancelBoundaryEvent | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | Apache-2.0 |
public static boolean hasInvalidIntermediaryActivityId(PvmExecutionImpl execution) {
return !execution.getNonEventScopeExecutions().isEmpty() && !CompensationBehavior.isCompensationThrowing(execution);
} | <p>In general, only leaf executions have activity ids.</p>
<p>Exception to that rule: compensation throwing executions.</p>
<p>Legacy exception (<= 7.2) to that rule: miBody executions and parallel gateway executions</p>
@return true, if the argument is not a leaf and has an invalid (i.e. legacy) non-null activity id | hasInvalidIntermediaryActivityId | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | Apache-2.0 |
public static void createMissingHistoricVariables(PvmExecutionImpl execution) {
Collection<VariableInstanceEntity> variables = ((ExecutionEntity) execution).getVariablesInternal();
if (variables != null && variables.size() > 0) {
// trigger historic creation if the history is not presented already
for (VariableInstanceEntity variable : variables) {
if (variable.wasCreatedBefore713()) {
VariableInstanceHistoryListener.INSTANCE.onCreate(variable, variable.getExecution());
}
}
}
} | See #CAM-10978
Use case process instance with <code>asyncBefore</code> startEvent
After unifying the history variable's creation<br>
The following changed:<br>
* variables will receive the <code>processInstanceId</code> as <code>activityInstanceId</code> in such cases (previously was the startEvent id)<br>
* historic details have new <code>initial</code> property to track initial variables that process is started with<br>
The jobs created prior <code>7.13</code> and not executed before do not have historic information of variables.
This method takes care of that. | createMissingHistoricVariables | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | Apache-2.0 |
public void replace(PvmExecutionImpl execution) {
// activity instance id handling
this.activityInstanceId = execution.getActivityInstanceId();
this.isActive = execution.isActive;
this.replacedBy = null;
execution.replacedBy = this;
this.transitionsToTake = execution.transitionsToTake;
execution.leaveActivityInstance();
} | <p>Replace an execution by this execution. The replaced execution has a pointer ({@link #getReplacedBy()}) to this execution.
This pointer is maintained until the replaced execution is removed or this execution is removed/ended.</p>
<p>
<p>This is used for two cases: Execution tree expansion and execution tree compaction</p>
<ul>
<li><b>expansion</b>: Before:
<pre>
-------
| e1 | scope
-------
</pre>
After:
<pre>
-------
| e1 | scope
-------
|
-------
| e2 | cc (no scope)
-------
</pre>
e2 replaces e1: it should receive all entities associated with the activity currently executed
by e1; these are tasks, (local) variables, jobs (specific for the activity, not the scope)
</li>
<li><b>compaction</b>: Before:
<pre>
-------
| e1 | scope
-------
|
-------
| e2 | cc (no scope)
-------
</pre>
After:
<pre>
-------
| e1 | scope
-------
</pre>
e1 replaces e2: it should receive all entities associated with the activity currently executed
by e2; these are tasks, (all) variables, all jobs
</li>
</ul>
@see #createConcurrentExecution()
@see #tryPruneLastConcurrentChild() | replace | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | Apache-2.0 |
public void executeActivitiesConcurrent(List<PvmActivity> activityStack, PvmActivity targetActivity,
PvmTransition targetTransition, Map<String, Object> variables, Map<String, Object> localVariables,
boolean skipCustomListeners, boolean skipIoMappings) {
ScopeImpl flowScope = null;
if (!activityStack.isEmpty()) {
flowScope = activityStack.get(0).getFlowScope();
} else if (targetActivity != null) {
flowScope = targetActivity.getFlowScope();
} else if (targetTransition != null) {
flowScope = targetTransition.getSource().getFlowScope();
}
PvmExecutionImpl propagatingExecution = null;
if (flowScope.getActivityBehavior() instanceof ModificationObserverBehavior) {
ModificationObserverBehavior flowScopeBehavior = (ModificationObserverBehavior) flowScope.getActivityBehavior();
propagatingExecution = (PvmExecutionImpl) flowScopeBehavior.createInnerInstance(this);
} else {
propagatingExecution = createConcurrentExecution();
}
propagatingExecution.executeActivities(activityStack, targetActivity, targetTransition, variables, localVariables,
skipCustomListeners, skipIoMappings);
} | Instantiates the given activity stack under this execution.
Sets the variables for the execution responsible to execute the most deeply nested
activity.
@param activityStack The most deeply nested activity is the last element in the list | executeActivitiesConcurrent | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | Apache-2.0 |
public Map<PvmActivity, PvmExecutionImpl> instantiateScopes(List<PvmActivity> activityStack,
boolean skipCustomListeners,
boolean skipIoMappings) {
if (activityStack.isEmpty()) {
return Collections.emptyMap();
}
this.skipCustomListeners = skipCustomListeners;
this.skipIoMapping = skipIoMappings;
ScopeInstantiationContext executionStartContext = new ScopeInstantiationContext();
InstantiationStack instantiationStack = new InstantiationStack(new LinkedList<>(activityStack));
executionStartContext.setInstantiationStack(instantiationStack);
setStartContext(executionStartContext);
performOperation(PvmAtomicOperation.ACTIVITY_INIT_STACK_AND_RETURN);
Map<PvmActivity, PvmExecutionImpl> createdExecutions = new HashMap<>();
PvmExecutionImpl currentExecution = this;
for (PvmActivity instantiatedActivity : activityStack) {
// there must exactly one child execution
currentExecution = currentExecution.getNonEventScopeExecutions().get(0);
if (currentExecution.isConcurrent()) {
// there may be a non-scope execution that we have to skip (e.g. multi-instance)
currentExecution = currentExecution.getNonEventScopeExecutions().get(0);
}
createdExecutions.put(instantiatedActivity, currentExecution);
}
return createdExecutions;
} | Instantiates the given set of activities and returns the execution for the bottom-most activity | instantiateScopes | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | Apache-2.0 |
@SuppressWarnings("unchecked")
public void setParent(PvmExecutionImpl parent) {
PvmExecutionImpl currentParent = getParent();
setParentExecution(parent);
if (currentParent != null) {
currentParent.getExecutions().remove(this);
}
if (parent != null) {
((List<PvmExecutionImpl>) parent.getExecutions()).add(this);
}
} | Sets the execution's parent and updates the old and new parents' set of
child executions | setParent | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | Apache-2.0 |
public void delayEvent(PvmExecutionImpl targetScope, VariableEvent variableEvent) {
DelayedVariableEvent delayedVariableEvent = new DelayedVariableEvent(targetScope, variableEvent);
delayEvent(delayedVariableEvent);
} | Delays a given variable event with the given target scope.
@param targetScope the target scope of the variable event
@param variableEvent the variable event which should be delayed | delayEvent | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | Apache-2.0 |
public void delayEvent(DelayedVariableEvent delayedVariableEvent) {
//if process definition has no conditional events the variable events does not have to be delayed
Boolean hasConditionalEvents = this.getProcessDefinition().getProperties().get(BpmnProperties.HAS_CONDITIONAL_EVENTS);
if (hasConditionalEvents == null || !hasConditionalEvents.equals(Boolean.TRUE)) {
return;
}
if (isProcessInstanceExecution()) {
delayedEvents.add(delayedVariableEvent);
} else {
getProcessInstance().delayEvent(delayedVariableEvent);
}
} | Delays and stores the given DelayedVariableEvent on the process instance.
@param delayedVariableEvent the DelayedVariableEvent which should be store on the process instance | delayEvent | java | camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | https://github.com/camunda/camunda-bpm-platform/blob/master/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/PvmExecutionImpl.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.