id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
16,500
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/context/DelegateExecutionContext.java
DelegateExecutionContext.getCurrentDelegationExecution
public static DelegateExecution getCurrentDelegationExecution() { BpmnExecutionContext bpmnExecutionContext = Context.getBpmnExecutionContext(); ExecutionEntity executionEntity = null; if (bpmnExecutionContext != null) { executionEntity = bpmnExecutionContext.getExecution(); } return executionEntity; }
java
public static DelegateExecution getCurrentDelegationExecution() { BpmnExecutionContext bpmnExecutionContext = Context.getBpmnExecutionContext(); ExecutionEntity executionEntity = null; if (bpmnExecutionContext != null) { executionEntity = bpmnExecutionContext.getExecution(); } return executionEntity; }
[ "public", "static", "DelegateExecution", "getCurrentDelegationExecution", "(", ")", "{", "BpmnExecutionContext", "bpmnExecutionContext", "=", "Context", ".", "getBpmnExecutionContext", "(", ")", ";", "ExecutionEntity", "executionEntity", "=", "null", ";", "if", "(", "bpmnExecutionContext", "!=", "null", ")", "{", "executionEntity", "=", "bpmnExecutionContext", ".", "getExecution", "(", ")", ";", "}", "return", "executionEntity", ";", "}" ]
Returns the current delegation execution or null if the execution is not available. @return the current delegation execution or null if not available
[ "Returns", "the", "current", "delegation", "execution", "or", "null", "if", "the", "execution", "is", "not", "available", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/context/DelegateExecutionContext.java#L38-L45
16,501
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/spi/DeploymentOperation.java
DeploymentOperation.addStep
public void addStep(DeploymentOperationStep step) { if(currentStep != null) { steps.add(steps.indexOf(currentStep)+1, step); } else { steps.add(step); } }
java
public void addStep(DeploymentOperationStep step) { if(currentStep != null) { steps.add(steps.indexOf(currentStep)+1, step); } else { steps.add(step); } }
[ "public", "void", "addStep", "(", "DeploymentOperationStep", "step", ")", "{", "if", "(", "currentStep", "!=", "null", ")", "{", "steps", ".", "add", "(", "steps", ".", "indexOf", "(", "currentStep", ")", "+", "1", ",", "step", ")", ";", "}", "else", "{", "steps", ".", "add", "(", "step", ")", ";", "}", "}" ]
Add a new atomic step to the composite operation. If the operation is currently executing a step, the step is added after the current step.
[ "Add", "a", "new", "atomic", "step", "to", "the", "composite", "operation", ".", "If", "the", "operation", "is", "currently", "executing", "a", "step", "the", "step", "is", "added", "after", "the", "current", "step", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/container/impl/spi/DeploymentOperation.java#L94-L100
16,502
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/EventSubscriptionDeclaration.java
EventSubscriptionDeclaration.createSubscriptionForExecution
public EventSubscriptionEntity createSubscriptionForExecution(ExecutionEntity execution) { EventSubscriptionEntity eventSubscriptionEntity = new EventSubscriptionEntity(execution, eventType); String eventName = resolveExpressionOfEventName(execution); eventSubscriptionEntity.setEventName(eventName); if (activityId != null) { ActivityImpl activity = execution.getProcessDefinition().findActivity(activityId); eventSubscriptionEntity.setActivity(activity); } eventSubscriptionEntity.insert(); LegacyBehavior.removeLegacySubscriptionOnParent(execution, eventSubscriptionEntity); return eventSubscriptionEntity; }
java
public EventSubscriptionEntity createSubscriptionForExecution(ExecutionEntity execution) { EventSubscriptionEntity eventSubscriptionEntity = new EventSubscriptionEntity(execution, eventType); String eventName = resolveExpressionOfEventName(execution); eventSubscriptionEntity.setEventName(eventName); if (activityId != null) { ActivityImpl activity = execution.getProcessDefinition().findActivity(activityId); eventSubscriptionEntity.setActivity(activity); } eventSubscriptionEntity.insert(); LegacyBehavior.removeLegacySubscriptionOnParent(execution, eventSubscriptionEntity); return eventSubscriptionEntity; }
[ "public", "EventSubscriptionEntity", "createSubscriptionForExecution", "(", "ExecutionEntity", "execution", ")", "{", "EventSubscriptionEntity", "eventSubscriptionEntity", "=", "new", "EventSubscriptionEntity", "(", "execution", ",", "eventType", ")", ";", "String", "eventName", "=", "resolveExpressionOfEventName", "(", "execution", ")", ";", "eventSubscriptionEntity", ".", "setEventName", "(", "eventName", ")", ";", "if", "(", "activityId", "!=", "null", ")", "{", "ActivityImpl", "activity", "=", "execution", ".", "getProcessDefinition", "(", ")", ".", "findActivity", "(", "activityId", ")", ";", "eventSubscriptionEntity", ".", "setActivity", "(", "activity", ")", ";", "}", "eventSubscriptionEntity", ".", "insert", "(", ")", ";", "LegacyBehavior", ".", "removeLegacySubscriptionOnParent", "(", "execution", ",", "eventSubscriptionEntity", ")", ";", "return", "eventSubscriptionEntity", ";", "}" ]
Creates and inserts a subscription entity depending on the message type of this declaration.
[ "Creates", "and", "inserts", "a", "subscription", "entity", "depending", "on", "the", "message", "type", "of", "this", "declaration", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/EventSubscriptionDeclaration.java#L152-L166
16,503
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/EventSubscriptionDeclaration.java
EventSubscriptionDeclaration.resolveExpressionOfEventName
public String resolveExpressionOfEventName(VariableScope scope) { if (isExpressionAvailable()) { return (String) eventName.getValue(scope); } else { return null; } }
java
public String resolveExpressionOfEventName(VariableScope scope) { if (isExpressionAvailable()) { return (String) eventName.getValue(scope); } else { return null; } }
[ "public", "String", "resolveExpressionOfEventName", "(", "VariableScope", "scope", ")", "{", "if", "(", "isExpressionAvailable", "(", ")", ")", "{", "return", "(", "String", ")", "eventName", ".", "getValue", "(", "scope", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Resolves the event name within the given scope.
[ "Resolves", "the", "event", "name", "within", "the", "given", "scope", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/EventSubscriptionDeclaration.java#L171-L177
16,504
camunda/camunda-bpm-platform
distro/wildfly/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/util/CustomMarshaller.java
CustomMarshaller.getValueTypes
public static AttributeDefinition[] getValueTypes(Object instance, Class clazz) { try { if (ObjectTypeAttributeDefinition.class.isAssignableFrom(clazz)) { Field valueTypesField = clazz.getDeclaredField("valueTypes"); valueTypesField.setAccessible(true); Object value = valueTypesField.get(instance); if (value != null) { if (AttributeDefinition[].class.isAssignableFrom(value.getClass())) { return (AttributeDefinition[]) value; } } return (AttributeDefinition[]) value; } } catch (Exception e) { throw new RuntimeException("Unable to get valueTypes.", e); } return null; }
java
public static AttributeDefinition[] getValueTypes(Object instance, Class clazz) { try { if (ObjectTypeAttributeDefinition.class.isAssignableFrom(clazz)) { Field valueTypesField = clazz.getDeclaredField("valueTypes"); valueTypesField.setAccessible(true); Object value = valueTypesField.get(instance); if (value != null) { if (AttributeDefinition[].class.isAssignableFrom(value.getClass())) { return (AttributeDefinition[]) value; } } return (AttributeDefinition[]) value; } } catch (Exception e) { throw new RuntimeException("Unable to get valueTypes.", e); } return null; }
[ "public", "static", "AttributeDefinition", "[", "]", "getValueTypes", "(", "Object", "instance", ",", "Class", "clazz", ")", "{", "try", "{", "if", "(", "ObjectTypeAttributeDefinition", ".", "class", ".", "isAssignableFrom", "(", "clazz", ")", ")", "{", "Field", "valueTypesField", "=", "clazz", ".", "getDeclaredField", "(", "\"valueTypes\"", ")", ";", "valueTypesField", ".", "setAccessible", "(", "true", ")", ";", "Object", "value", "=", "valueTypesField", ".", "get", "(", "instance", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "AttributeDefinition", "[", "]", ".", "class", ".", "isAssignableFrom", "(", "value", ".", "getClass", "(", ")", ")", ")", "{", "return", "(", "AttributeDefinition", "[", "]", ")", "value", ";", "}", "}", "return", "(", "AttributeDefinition", "[", "]", ")", "value", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Unable to get valueTypes.\"", ",", "e", ")", ";", "}", "return", "null", ";", "}" ]
Obtain the 'valueTypes' of the ObjectTypeAttributeDefinition through reflection because they are private in Wildfly 8.
[ "Obtain", "the", "valueTypes", "of", "the", "ObjectTypeAttributeDefinition", "through", "reflection", "because", "they", "are", "private", "in", "Wildfly", "8", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/distro/wildfly/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/util/CustomMarshaller.java#L36-L54
16,505
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java
ProcessDefinitionManager.cascadeDeleteProcessInstancesForProcessDefinition
protected void cascadeDeleteProcessInstancesForProcessDefinition(String processDefinitionId, boolean skipCustomListeners, boolean skipIoMappings) { getProcessInstanceManager() .deleteProcessInstancesByProcessDefinition(processDefinitionId, "deleted process definition", true, skipCustomListeners, skipIoMappings); }
java
protected void cascadeDeleteProcessInstancesForProcessDefinition(String processDefinitionId, boolean skipCustomListeners, boolean skipIoMappings) { getProcessInstanceManager() .deleteProcessInstancesByProcessDefinition(processDefinitionId, "deleted process definition", true, skipCustomListeners, skipIoMappings); }
[ "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
[ "Cascades", "the", "deletion", "of", "the", "process", "definition", "to", "the", "process", "instances", ".", "Skips", "the", "custom", "listeners", "if", "the", "flag", "was", "set", "to", "true", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java#L238-L241
16,506
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java
ProcessDefinitionManager.cascadeDeleteHistoryForProcessDefinition
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); }
java
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); }
[ "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
[ "Cascades", "the", "deletion", "of", "a", "process", "definition", "to", "the", "history", "deletes", "the", "history", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java#L248-L257
16,507
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java
ProcessDefinitionManager.deleteTimerStartEventsForProcessDefinition
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(); } } }
java
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(); } } }
[ "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
[ "Deletes", "the", "timer", "start", "events", "for", "the", "given", "process", "definition", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java#L264-L276
16,508
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java
ProcessDefinitionManager.deleteSubscriptionsForProcessDefinition
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(); } }
java
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(); } }
[ "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
[ "Deletes", "the", "subscriptions", "for", "the", "process", "definition", "which", "is", "identified", "by", "the", "given", "process", "definition", "id", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java#L284-L302
16,509
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java
ProcessDefinitionManager.deleteProcessDefinition
public void deleteProcessDefinition(ProcessDefinition processDefinition, String processDefinitionId, boolean cascadeToHistory, boolean cascadeToInstances, boolean skipCustomListeners, boolean skipIoMappings) { if (cascadeToHistory) { cascadeDeleteHistoryForProcessDefinition(processDefinitionId); if (cascadeToInstances) { cascadeDeleteProcessInstancesForProcessDefinition(processDefinitionId, skipCustomListeners, skipIoMappings); } } else { ProcessInstanceQueryImpl procInstQuery = new ProcessInstanceQueryImpl().processDefinitionId(processDefinitionId); long processInstanceCount = getProcessInstanceManager().findProcessInstanceCountByQueryCriteria(procInstQuery); if (processInstanceCount != 0) { throw LOG.deleteProcessDefinitionWithProcessInstancesException(processDefinitionId, processInstanceCount); } } // remove related authorization parameters in IdentityLink table getIdentityLinkManager().deleteIdentityLinksByProcDef(processDefinitionId); // remove timer start events: deleteTimerStartEventsForProcessDefinition(processDefinition); //delete process definition from database getDbEntityManager().delete(ProcessDefinitionEntity.class, "deleteProcessDefinitionsById", processDefinitionId); // remove process definition from cache: Context .getProcessEngineConfiguration() .getDeploymentCache() .removeProcessDefinition(processDefinitionId); deleteSubscriptionsForProcessDefinition(processDefinitionId); // delete job definitions getJobDefinitionManager().deleteJobDefinitionsByProcessDefinitionId(processDefinition.getId()); }
java
public void deleteProcessDefinition(ProcessDefinition processDefinition, String processDefinitionId, boolean cascadeToHistory, boolean cascadeToInstances, boolean skipCustomListeners, boolean skipIoMappings) { if (cascadeToHistory) { cascadeDeleteHistoryForProcessDefinition(processDefinitionId); if (cascadeToInstances) { cascadeDeleteProcessInstancesForProcessDefinition(processDefinitionId, skipCustomListeners, skipIoMappings); } } else { ProcessInstanceQueryImpl procInstQuery = new ProcessInstanceQueryImpl().processDefinitionId(processDefinitionId); long processInstanceCount = getProcessInstanceManager().findProcessInstanceCountByQueryCriteria(procInstQuery); if (processInstanceCount != 0) { throw LOG.deleteProcessDefinitionWithProcessInstancesException(processDefinitionId, processInstanceCount); } } // remove related authorization parameters in IdentityLink table getIdentityLinkManager().deleteIdentityLinksByProcDef(processDefinitionId); // remove timer start events: deleteTimerStartEventsForProcessDefinition(processDefinition); //delete process definition from database getDbEntityManager().delete(ProcessDefinitionEntity.class, "deleteProcessDefinitionsById", processDefinitionId); // remove process definition from cache: Context .getProcessEngineConfiguration() .getDeploymentCache() .removeProcessDefinition(processDefinitionId); deleteSubscriptionsForProcessDefinition(processDefinitionId); // delete job definitions getJobDefinitionManager().deleteJobDefinitionsByProcessDefinitionId(processDefinition.getId()); }
[ "public", "void", "deleteProcessDefinition", "(", "ProcessDefinition", "processDefinition", ",", "String", "processDefinitionId", ",", "boolean", "cascadeToHistory", ",", "boolean", "cascadeToInstances", ",", "boolean", "skipCustomListeners", ",", "boolean", "skipIoMappings", ")", "{", "if", "(", "cascadeToHistory", ")", "{", "cascadeDeleteHistoryForProcessDefinition", "(", "processDefinitionId", ")", ";", "if", "(", "cascadeToInstances", ")", "{", "cascadeDeleteProcessInstancesForProcessDefinition", "(", "processDefinitionId", ",", "skipCustomListeners", ",", "skipIoMappings", ")", ";", "}", "}", "else", "{", "ProcessInstanceQueryImpl", "procInstQuery", "=", "new", "ProcessInstanceQueryImpl", "(", ")", ".", "processDefinitionId", "(", "processDefinitionId", ")", ";", "long", "processInstanceCount", "=", "getProcessInstanceManager", "(", ")", ".", "findProcessInstanceCountByQueryCriteria", "(", "procInstQuery", ")", ";", "if", "(", "processInstanceCount", "!=", "0", ")", "{", "throw", "LOG", ".", "deleteProcessDefinitionWithProcessInstancesException", "(", "processDefinitionId", ",", "processInstanceCount", ")", ";", "}", "}", "// remove related authorization parameters in IdentityLink table", "getIdentityLinkManager", "(", ")", ".", "deleteIdentityLinksByProcDef", "(", "processDefinitionId", ")", ";", "// remove timer start events:", "deleteTimerStartEventsForProcessDefinition", "(", "processDefinition", ")", ";", "//delete process definition from database", "getDbEntityManager", "(", ")", ".", "delete", "(", "ProcessDefinitionEntity", ".", "class", ",", "\"deleteProcessDefinitionsById\"", ",", "processDefinitionId", ")", ";", "// remove process definition from cache:", "Context", ".", "getProcessEngineConfiguration", "(", ")", ".", "getDeploymentCache", "(", ")", ".", "removeProcessDefinition", "(", "processDefinitionId", ")", ";", "deleteSubscriptionsForProcessDefinition", "(", "processDefinitionId", ")", ";", "// delete job definitions", "getJobDefinitionManager", "(", ")", ".", "deleteJobDefinitionsByProcessDefinitionId", "(", "processDefinition", ".", "getId", "(", ")", ")", ";", "}" ]
Deletes the given process definition from the database and cache. If cascadeToHistory and cascadeToInstances is set to true it deletes the history and the process instances. *Note*: If more than one process definition, from one deployment, is deleted in a single transaction and the cascadeToHistory and cascadeToInstances flag was set to true it can cause a dirty deployment cache. The process instances of ALL process definitions must be deleted, before every process definition can be deleted! In such cases the cascadeToInstances flag have to set to false! On deletion of all process instances, the task listeners will be deleted as well. Deletion of tasks and listeners needs the redeployment of deployments. It can cause to problems if is done sequential with the deletion of process definition in a single transaction. *For example*: Deployment contains two process definition. First process definition and instances will be removed, also cleared from the cache. Second process definition will be removed and his instances. Deletion of instances will cause redeployment this deploys again first into the cache. Only the second will be removed from cache and first remains in the cache after the deletion process. @param processDefinition the process definition which should be deleted @param processDefinitionId the id of the process definition @param cascadeToHistory if true the history will deleted as well @param cascadeToInstances if true the process instances are deleted as well @param skipCustomListeners if true skips the custom listeners on deletion of instances @param skipIoMappings specifies whether input/output mappings for tasks should be invoked
[ "Deletes", "the", "given", "process", "definition", "from", "the", "database", "and", "cache", ".", "If", "cascadeToHistory", "and", "cascadeToInstances", "is", "set", "to", "true", "it", "deletes", "the", "history", "and", "the", "process", "instances", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessDefinitionManager.java#L335-L370
16,510
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/HistoricTaskInstanceManager.java
HistoricTaskInstanceManager.deleteHistoricTaskInstancesByProcessInstanceIds
public void deleteHistoricTaskInstancesByProcessInstanceIds(List<String> processInstanceIds, boolean deleteVariableInstances) { CommandContext commandContext = Context.getCommandContext(); if (deleteVariableInstances) { getHistoricVariableInstanceManager().deleteHistoricVariableInstancesByTaskProcessInstanceIds(processInstanceIds); } getHistoricDetailManager() .deleteHistoricDetailsByTaskProcessInstanceIds(processInstanceIds); commandContext .getCommentManager() .deleteCommentsByTaskProcessInstanceIds(processInstanceIds); getAttachmentManager() .deleteAttachmentsByTaskProcessInstanceIds(processInstanceIds); getHistoricIdentityLinkManager() .deleteHistoricIdentityLinksLogByTaskProcessInstanceIds(processInstanceIds); getDbEntityManager().deletePreserveOrder(HistoricTaskInstanceEntity.class, "deleteHistoricTaskInstanceByProcessInstanceIds", processInstanceIds); }
java
public void deleteHistoricTaskInstancesByProcessInstanceIds(List<String> processInstanceIds, boolean deleteVariableInstances) { CommandContext commandContext = Context.getCommandContext(); if (deleteVariableInstances) { getHistoricVariableInstanceManager().deleteHistoricVariableInstancesByTaskProcessInstanceIds(processInstanceIds); } getHistoricDetailManager() .deleteHistoricDetailsByTaskProcessInstanceIds(processInstanceIds); commandContext .getCommentManager() .deleteCommentsByTaskProcessInstanceIds(processInstanceIds); getAttachmentManager() .deleteAttachmentsByTaskProcessInstanceIds(processInstanceIds); getHistoricIdentityLinkManager() .deleteHistoricIdentityLinksLogByTaskProcessInstanceIds(processInstanceIds); getDbEntityManager().deletePreserveOrder(HistoricTaskInstanceEntity.class, "deleteHistoricTaskInstanceByProcessInstanceIds", processInstanceIds); }
[ "public", "void", "deleteHistoricTaskInstancesByProcessInstanceIds", "(", "List", "<", "String", ">", "processInstanceIds", ",", "boolean", "deleteVariableInstances", ")", "{", "CommandContext", "commandContext", "=", "Context", ".", "getCommandContext", "(", ")", ";", "if", "(", "deleteVariableInstances", ")", "{", "getHistoricVariableInstanceManager", "(", ")", ".", "deleteHistoricVariableInstancesByTaskProcessInstanceIds", "(", "processInstanceIds", ")", ";", "}", "getHistoricDetailManager", "(", ")", ".", "deleteHistoricDetailsByTaskProcessInstanceIds", "(", "processInstanceIds", ")", ";", "commandContext", ".", "getCommentManager", "(", ")", ".", "deleteCommentsByTaskProcessInstanceIds", "(", "processInstanceIds", ")", ";", "getAttachmentManager", "(", ")", ".", "deleteAttachmentsByTaskProcessInstanceIds", "(", "processInstanceIds", ")", ";", "getHistoricIdentityLinkManager", "(", ")", ".", "deleteHistoricIdentityLinksLogByTaskProcessInstanceIds", "(", "processInstanceIds", ")", ";", "getDbEntityManager", "(", ")", ".", "deletePreserveOrder", "(", "HistoricTaskInstanceEntity", ".", "class", ",", "\"deleteHistoricTaskInstanceByProcessInstanceIds\"", ",", "processInstanceIds", ")", ";", "}" ]
Deletes all data related with tasks, which belongs to specified process instance ids. @param processInstanceIds @param deleteVariableInstances when true, will also delete variable instances. Can be false when variable instances were deleted separately.
[ "Deletes", "all", "data", "related", "with", "tasks", "which", "belongs", "to", "specified", "process", "instance", "ids", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/HistoricTaskInstanceManager.java#L54-L76
16,511
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/cfg/JtaProcessEngineConfiguration.java
JtaProcessEngineConfiguration.initCommandExecutorDbSchemaOperations
@Override protected void initCommandExecutorDbSchemaOperations() { if(commandExecutorSchemaOperations == null) { List<CommandInterceptor> commandInterceptorsDbSchemaOperations = new ArrayList<CommandInterceptor>(); commandInterceptorsDbSchemaOperations.add(new LogInterceptor()); commandInterceptorsDbSchemaOperations.add(new CommandContextInterceptor(dbSchemaOperationsCommandContextFactory, this)); commandInterceptorsDbSchemaOperations.add(actualCommandExecutor); commandExecutorSchemaOperations = initInterceptorChain(commandInterceptorsDbSchemaOperations); } }
java
@Override protected void initCommandExecutorDbSchemaOperations() { if(commandExecutorSchemaOperations == null) { List<CommandInterceptor> commandInterceptorsDbSchemaOperations = new ArrayList<CommandInterceptor>(); commandInterceptorsDbSchemaOperations.add(new LogInterceptor()); commandInterceptorsDbSchemaOperations.add(new CommandContextInterceptor(dbSchemaOperationsCommandContextFactory, this)); commandInterceptorsDbSchemaOperations.add(actualCommandExecutor); commandExecutorSchemaOperations = initInterceptorChain(commandInterceptorsDbSchemaOperations); } }
[ "@", "Override", "protected", "void", "initCommandExecutorDbSchemaOperations", "(", ")", "{", "if", "(", "commandExecutorSchemaOperations", "==", "null", ")", "{", "List", "<", "CommandInterceptor", ">", "commandInterceptorsDbSchemaOperations", "=", "new", "ArrayList", "<", "CommandInterceptor", ">", "(", ")", ";", "commandInterceptorsDbSchemaOperations", ".", "add", "(", "new", "LogInterceptor", "(", ")", ")", ";", "commandInterceptorsDbSchemaOperations", ".", "add", "(", "new", "CommandContextInterceptor", "(", "dbSchemaOperationsCommandContextFactory", ",", "this", ")", ")", ";", "commandInterceptorsDbSchemaOperations", ".", "add", "(", "actualCommandExecutor", ")", ";", "commandExecutorSchemaOperations", "=", "initInterceptorChain", "(", "commandInterceptorsDbSchemaOperations", ")", ";", "}", "}" ]
provide custom command executor that uses NON-JTA transactions
[ "provide", "custom", "command", "executor", "that", "uses", "NON", "-", "JTA", "transactions" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/cfg/JtaProcessEngineConfiguration.java#L87-L96
16,512
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/scripting/engine/ScriptingEngines.java
ScriptingEngines.getScriptEngineForLanguage
public ScriptEngine getScriptEngineForLanguage(String language) { if (language != null) { language = language.toLowerCase(); } ProcessApplicationReference pa = Context.getCurrentProcessApplication(); ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration(); ScriptEngine engine = null; if (config.isEnableFetchScriptEngineFromProcessApplication()) { if(pa != null) { engine = getPaScriptEngine(language, pa); } } if(engine == null) { engine = getGlobalScriptEngine(language); } return engine; }
java
public ScriptEngine getScriptEngineForLanguage(String language) { if (language != null) { language = language.toLowerCase(); } ProcessApplicationReference pa = Context.getCurrentProcessApplication(); ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration(); ScriptEngine engine = null; if (config.isEnableFetchScriptEngineFromProcessApplication()) { if(pa != null) { engine = getPaScriptEngine(language, pa); } } if(engine == null) { engine = getGlobalScriptEngine(language); } return engine; }
[ "public", "ScriptEngine", "getScriptEngineForLanguage", "(", "String", "language", ")", "{", "if", "(", "language", "!=", "null", ")", "{", "language", "=", "language", ".", "toLowerCase", "(", ")", ";", "}", "ProcessApplicationReference", "pa", "=", "Context", ".", "getCurrentProcessApplication", "(", ")", ";", "ProcessEngineConfigurationImpl", "config", "=", "Context", ".", "getProcessEngineConfiguration", "(", ")", ";", "ScriptEngine", "engine", "=", "null", ";", "if", "(", "config", ".", "isEnableFetchScriptEngineFromProcessApplication", "(", ")", ")", "{", "if", "(", "pa", "!=", "null", ")", "{", "engine", "=", "getPaScriptEngine", "(", "language", ",", "pa", ")", ";", "}", "}", "if", "(", "engine", "==", "null", ")", "{", "engine", "=", "getGlobalScriptEngine", "(", "language", ")", ";", "}", "return", "engine", ";", "}" ]
Loads the given script engine by language name. Will throw an exception if no script engine can be loaded for the given language name. @param language the name of the script language to lookup an implementation for @return the script engine @throws ProcessEngineException if no such engine can be found.
[ "Loads", "the", "given", "script", "engine", "by", "language", "name", ".", "Will", "throw", "an", "exception", "if", "no", "script", "engine", "can", "be", "loaded", "for", "the", "given", "language", "name", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/scripting/engine/ScriptingEngines.java#L95-L116
16,513
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/scripting/engine/ScriptingEngines.java
ScriptingEngines.createBindings
public Bindings createBindings(ScriptEngine scriptEngine, VariableScope variableScope) { return scriptBindingsFactory.createBindings(variableScope, scriptEngine.createBindings()); }
java
public Bindings createBindings(ScriptEngine scriptEngine, VariableScope variableScope) { return scriptBindingsFactory.createBindings(variableScope, scriptEngine.createBindings()); }
[ "public", "Bindings", "createBindings", "(", "ScriptEngine", "scriptEngine", ",", "VariableScope", "variableScope", ")", "{", "return", "scriptBindingsFactory", ".", "createBindings", "(", "variableScope", ",", "scriptEngine", ".", "createBindings", "(", ")", ")", ";", "}" ]
override to build a spring aware ScriptingEngines @param engineBindin @param scriptEngine
[ "override", "to", "build", "a", "spring", "aware", "ScriptingEngines" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/scripting/engine/ScriptingEngines.java#L146-L148
16,514
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity.java
ExecutionEntity.destroy
@Override public void destroy() { ensureParentInitialized(); // execute Output Mappings (if they exist). ensureActivityInitialized(); if (activity != null && activity.getIoMapping() != null && !skipIoMapping) { activity.getIoMapping().executeOutputParameters(this); } clearExecution(); super.destroy(); removeEventSubscriptionsExceptCompensation(); }
java
@Override public void destroy() { ensureParentInitialized(); // execute Output Mappings (if they exist). ensureActivityInitialized(); if (activity != null && activity.getIoMapping() != null && !skipIoMapping) { activity.getIoMapping().executeOutputParameters(this); } clearExecution(); super.destroy(); removeEventSubscriptionsExceptCompensation(); }
[ "@", "Override", "public", "void", "destroy", "(", ")", "{", "ensureParentInitialized", "(", ")", ";", "// execute Output Mappings (if they exist).", "ensureActivityInitialized", "(", ")", ";", "if", "(", "activity", "!=", "null", "&&", "activity", ".", "getIoMapping", "(", ")", "!=", "null", "&&", "!", "skipIoMapping", ")", "{", "activity", ".", "getIoMapping", "(", ")", ".", "executeOutputParameters", "(", "this", ")", ";", "}", "clearExecution", "(", ")", ";", "super", ".", "destroy", "(", ")", ";", "removeEventSubscriptionsExceptCompensation", "(", ")", ";", "}" ]
Method used for destroying a scope in a way that the execution can be removed afterwards.
[ "Method", "used", "for", "destroying", "a", "scope", "in", "a", "way", "that", "the", "execution", "can", "be", "removed", "afterwards", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity.java#L524-L540
16,515
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity.java
ExecutionEntity.ensureProcessDefinitionInitialized
protected void ensureProcessDefinitionInitialized() { if ((processDefinition == null) && (processDefinitionId != null)) { ProcessDefinitionEntity deployedProcessDefinition = Context.getProcessEngineConfiguration().getDeploymentCache() .findDeployedProcessDefinitionById(processDefinitionId); setProcessDefinition(deployedProcessDefinition); } }
java
protected void ensureProcessDefinitionInitialized() { if ((processDefinition == null) && (processDefinitionId != null)) { ProcessDefinitionEntity deployedProcessDefinition = Context.getProcessEngineConfiguration().getDeploymentCache() .findDeployedProcessDefinitionById(processDefinitionId); setProcessDefinition(deployedProcessDefinition); } }
[ "protected", "void", "ensureProcessDefinitionInitialized", "(", ")", "{", "if", "(", "(", "processDefinition", "==", "null", ")", "&&", "(", "processDefinitionId", "!=", "null", ")", ")", "{", "ProcessDefinitionEntity", "deployedProcessDefinition", "=", "Context", ".", "getProcessEngineConfiguration", "(", ")", ".", "getDeploymentCache", "(", ")", ".", "findDeployedProcessDefinitionById", "(", "processDefinitionId", ")", ";", "setProcessDefinition", "(", "deployedProcessDefinition", ")", ";", "}", "}" ]
for setting the process definition, this setter must be used as subclasses can override
[ "for", "setting", "the", "process", "definition", "this", "setter", "must", "be", "used", "as", "subclasses", "can", "override" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity.java#L778-L784
16,516
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity.java
ExecutionEntity.ensureExecutionTreeInitialized
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); }
java
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); }
[ "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.
[ "Fetch", "all", "the", "executions", "inside", "the", "same", "process", "instance", "as", "list", "and", "then", "reconstruct", "the", "complete", "execution", "tree", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity.java#L1320-L1336
16,517
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java
Properties.get
@SuppressWarnings("unchecked") public <T> List<T> get(PropertyListKey<T> property) { if (contains(property)) { return (List<T>) properties.get(property.getName()); } else { return new ArrayList<T>(); } }
java
@SuppressWarnings("unchecked") public <T> List<T> get(PropertyListKey<T> property) { if (contains(property)) { return (List<T>) properties.get(property.getName()); } else { return new ArrayList<T>(); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "List", "<", "T", ">", "get", "(", "PropertyListKey", "<", "T", ">", "property", ")", "{", "if", "(", "contains", "(", "property", ")", ")", "{", "return", "(", "List", "<", "T", ">", ")", "properties", ".", "get", "(", "property", ".", "getName", "(", ")", ")", ";", "}", "else", "{", "return", "new", "ArrayList", "<", "T", ">", "(", ")", ";", "}", "}" ]
Returns the list to which the specified property key is mapped, or an empty list if this properties contains no mapping for the property key. Note that the empty list is not mapped to the property key. @param property the property key whose associated list is to be returned @return the list to which the specified property key is mapped, or an empty list if this properties contains no mapping for the property key @see #addListItem(PropertyListKey, Object)
[ "Returns", "the", "list", "to", "which", "the", "specified", "property", "key", "is", "mapped", "or", "an", "empty", "list", "if", "this", "properties", "contains", "no", "mapping", "for", "the", "property", "key", ".", "Note", "that", "the", "empty", "list", "is", "not", "mapped", "to", "the", "property", "key", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java#L71-L78
16,518
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java
Properties.get
@SuppressWarnings("unchecked") public <K, V> Map<K, V> get(PropertyMapKey<K, V> property) { if (contains(property)) { return (Map<K, V>) properties.get(property.getName()); } else { return new HashMap<K, V>(); } }
java
@SuppressWarnings("unchecked") public <K, V> Map<K, V> get(PropertyMapKey<K, V> property) { if (contains(property)) { return (Map<K, V>) properties.get(property.getName()); } else { return new HashMap<K, V>(); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "get", "(", "PropertyMapKey", "<", "K", ",", "V", ">", "property", ")", "{", "if", "(", "contains", "(", "property", ")", ")", "{", "return", "(", "Map", "<", "K", ",", "V", ">", ")", "properties", ".", "get", "(", "property", ".", "getName", "(", ")", ")", ";", "}", "else", "{", "return", "new", "HashMap", "<", "K", ",", "V", ">", "(", ")", ";", "}", "}" ]
Returns the map to which the specified property key is mapped, or an empty map if this properties contains no mapping for the property key. Note that the empty map is not mapped to the property key. @param property the property key whose associated map is to be returned @return the map to which the specified property key is mapped, or an empty map if this properties contains no mapping for the property key @see #putMapEntry(PropertyMapKey, Object, Object)
[ "Returns", "the", "map", "to", "which", "the", "specified", "property", "key", "is", "mapped", "or", "an", "empty", "map", "if", "this", "properties", "contains", "no", "mapping", "for", "the", "property", "key", ".", "Note", "that", "the", "empty", "map", "is", "not", "mapped", "to", "the", "property", "key", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java#L92-L99
16,519
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java
Properties.set
public <T> void set(PropertyKey<T> property, T value) { properties.put(property.getName(), value); }
java
public <T> void set(PropertyKey<T> property, T value) { properties.put(property.getName(), value); }
[ "public", "<", "T", ">", "void", "set", "(", "PropertyKey", "<", "T", ">", "property", ",", "T", "value", ")", "{", "properties", ".", "put", "(", "property", ".", "getName", "(", ")", ",", "value", ")", ";", "}" ]
Associates the specified value with the specified property key. If the properties previously contained a mapping for the property key, the old value is replaced by the specified value. @param <T> the type of the value @param property the property key with which the specified value is to be associated @param value the value to be associated with the specified property key
[ "Associates", "the", "specified", "value", "with", "the", "specified", "property", "key", ".", "If", "the", "properties", "previously", "contained", "a", "mapping", "for", "the", "property", "key", "the", "old", "value", "is", "replaced", "by", "the", "specified", "value", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java#L112-L114
16,520
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java
Properties.set
public <T> void set(PropertyListKey<T> property, List<T> value) { properties.put(property.getName(), value); }
java
public <T> void set(PropertyListKey<T> property, List<T> value) { properties.put(property.getName(), value); }
[ "public", "<", "T", ">", "void", "set", "(", "PropertyListKey", "<", "T", ">", "property", ",", "List", "<", "T", ">", "value", ")", "{", "properties", ".", "put", "(", "property", ".", "getName", "(", ")", ",", "value", ")", ";", "}" ]
Associates the specified list with the specified property key. If the properties previously contained a mapping for the property key, the old value is replaced by the specified list. @param <T> the type of elements in the list @param property the property key with which the specified list is to be associated @param value the list to be associated with the specified property key
[ "Associates", "the", "specified", "list", "with", "the", "specified", "property", "key", ".", "If", "the", "properties", "previously", "contained", "a", "mapping", "for", "the", "property", "key", "the", "old", "value", "is", "replaced", "by", "the", "specified", "list", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java#L127-L129
16,521
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java
Properties.set
public <K, V> void set(PropertyMapKey<K, V> property, Map<K, V> value) { properties.put(property.getName(), value); }
java
public <K, V> void set(PropertyMapKey<K, V> property, Map<K, V> value) { properties.put(property.getName(), value); }
[ "public", "<", "K", ",", "V", ">", "void", "set", "(", "PropertyMapKey", "<", "K", ",", "V", ">", "property", ",", "Map", "<", "K", ",", "V", ">", "value", ")", "{", "properties", ".", "put", "(", "property", ".", "getName", "(", ")", ",", "value", ")", ";", "}" ]
Associates the specified map with the specified property key. If the properties previously contained a mapping for the property key, the old value is replaced by the specified map. @param <K> the type of keys maintained by the map @param <V> the type of mapped values @param property the property key with which the specified map is to be associated @param value the map to be associated with the specified property key
[ "Associates", "the", "specified", "map", "with", "the", "specified", "property", "key", ".", "If", "the", "properties", "previously", "contained", "a", "mapping", "for", "the", "property", "key", "the", "old", "value", "is", "replaced", "by", "the", "specified", "map", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java#L144-L146
16,522
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java
Properties.addListItem
public <T> void addListItem(PropertyListKey<T> property, T value) { List<T> list = get(property); list.add(value); if (!contains(property)) { set(property, list); } }
java
public <T> void addListItem(PropertyListKey<T> property, T value) { List<T> list = get(property); list.add(value); if (!contains(property)) { set(property, list); } }
[ "public", "<", "T", ">", "void", "addListItem", "(", "PropertyListKey", "<", "T", ">", "property", ",", "T", "value", ")", "{", "List", "<", "T", ">", "list", "=", "get", "(", "property", ")", ";", "list", ".", "add", "(", "value", ")", ";", "if", "(", "!", "contains", "(", "property", ")", ")", "{", "set", "(", "property", ",", "list", ")", ";", "}", "}" ]
Append the value to the list to which the specified property key is mapped. If this properties contains no mapping for the property key, the value append to a new list witch is associate the the specified property key. @param <T> the type of elements in the list @param property the property key whose associated list is to be added @param value the value to be appended to list
[ "Append", "the", "value", "to", "the", "list", "to", "which", "the", "specified", "property", "key", "is", "mapped", ".", "If", "this", "properties", "contains", "no", "mapping", "for", "the", "property", "key", "the", "value", "append", "to", "a", "new", "list", "witch", "is", "associate", "the", "the", "specified", "property", "key", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java#L160-L167
16,523
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java
Properties.putMapEntry
public <K, V> void putMapEntry(PropertyMapKey<K, V> property, K key, V value) { Map<K, V> map = get(property); if (!property.allowsOverwrite() && map.containsKey(key)) { throw new ProcessEngineException("Cannot overwrite property key " + key + ". Key already exists"); } map.put(key, value); if (!contains(property)) { set(property, map); } }
java
public <K, V> void putMapEntry(PropertyMapKey<K, V> property, K key, V value) { Map<K, V> map = get(property); if (!property.allowsOverwrite() && map.containsKey(key)) { throw new ProcessEngineException("Cannot overwrite property key " + key + ". Key already exists"); } map.put(key, value); if (!contains(property)) { set(property, map); } }
[ "public", "<", "K", ",", "V", ">", "void", "putMapEntry", "(", "PropertyMapKey", "<", "K", ",", "V", ">", "property", ",", "K", "key", ",", "V", "value", ")", "{", "Map", "<", "K", ",", "V", ">", "map", "=", "get", "(", "property", ")", ";", "if", "(", "!", "property", ".", "allowsOverwrite", "(", ")", "&&", "map", ".", "containsKey", "(", "key", ")", ")", "{", "throw", "new", "ProcessEngineException", "(", "\"Cannot overwrite property key \"", "+", "key", "+", "\". Key already exists\"", ")", ";", "}", "map", ".", "put", "(", "key", ",", "value", ")", ";", "if", "(", "!", "contains", "(", "property", ")", ")", "{", "set", "(", "property", ",", "map", ")", ";", "}", "}" ]
Insert the value to the map to which the specified property key is mapped. If this properties contains no mapping for the property key, the value insert to a new map witch is associate the the specified property key. @param <K> the type of keys maintained by the map @param <V> the type of mapped values @param property the property key whose associated list is to be added @param value the value to be appended to list
[ "Insert", "the", "value", "to", "the", "map", "to", "which", "the", "specified", "property", "key", "is", "mapped", ".", "If", "this", "properties", "contains", "no", "mapping", "for", "the", "property", "key", "the", "value", "insert", "to", "a", "new", "map", "witch", "is", "associate", "the", "the", "specified", "property", "key", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java#L183-L195
16,524
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/core/variable/scope/AbstractVariableScope.java
AbstractVariableScope.checkJavaSerialization
protected void checkJavaSerialization(String variableName, TypedValue value) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if (value instanceof SerializableValue && !processEngineConfiguration.isJavaSerializationFormatEnabled()) { SerializableValue serializableValue = (SerializableValue) value; // if Java serialization is prohibited if (!serializableValue.isDeserialized()) { String javaSerializationDataFormat = Variables.SerializationDataFormats.JAVA.getName(); String requestedDataFormat = serializableValue.getSerializationDataFormat(); if (requestedDataFormat == null) { // check if Java serializer will be used final TypedValueSerializer serializerForValue = TypedValueField.getSerializers() .findSerializerForValue(serializableValue, processEngineConfiguration.getFallbackSerializerFactory()); if (serializerForValue != null) { requestedDataFormat = serializerForValue.getSerializationDataformat(); } } if (javaSerializationDataFormat.equals(requestedDataFormat)) { throw ProcessEngineLogger.CORE_LOGGER.javaSerializationProhibitedException(variableName); } } } }
java
protected void checkJavaSerialization(String variableName, TypedValue value) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if (value instanceof SerializableValue && !processEngineConfiguration.isJavaSerializationFormatEnabled()) { SerializableValue serializableValue = (SerializableValue) value; // if Java serialization is prohibited if (!serializableValue.isDeserialized()) { String javaSerializationDataFormat = Variables.SerializationDataFormats.JAVA.getName(); String requestedDataFormat = serializableValue.getSerializationDataFormat(); if (requestedDataFormat == null) { // check if Java serializer will be used final TypedValueSerializer serializerForValue = TypedValueField.getSerializers() .findSerializerForValue(serializableValue, processEngineConfiguration.getFallbackSerializerFactory()); if (serializerForValue != null) { requestedDataFormat = serializerForValue.getSerializationDataformat(); } } if (javaSerializationDataFormat.equals(requestedDataFormat)) { throw ProcessEngineLogger.CORE_LOGGER.javaSerializationProhibitedException(variableName); } } } }
[ "protected", "void", "checkJavaSerialization", "(", "String", "variableName", ",", "TypedValue", "value", ")", "{", "ProcessEngineConfigurationImpl", "processEngineConfiguration", "=", "Context", ".", "getProcessEngineConfiguration", "(", ")", ";", "if", "(", "value", "instanceof", "SerializableValue", "&&", "!", "processEngineConfiguration", ".", "isJavaSerializationFormatEnabled", "(", ")", ")", "{", "SerializableValue", "serializableValue", "=", "(", "SerializableValue", ")", "value", ";", "// if Java serialization is prohibited", "if", "(", "!", "serializableValue", ".", "isDeserialized", "(", ")", ")", "{", "String", "javaSerializationDataFormat", "=", "Variables", ".", "SerializationDataFormats", ".", "JAVA", ".", "getName", "(", ")", ";", "String", "requestedDataFormat", "=", "serializableValue", ".", "getSerializationDataFormat", "(", ")", ";", "if", "(", "requestedDataFormat", "==", "null", ")", "{", "// check if Java serializer will be used", "final", "TypedValueSerializer", "serializerForValue", "=", "TypedValueField", ".", "getSerializers", "(", ")", ".", "findSerializerForValue", "(", "serializableValue", ",", "processEngineConfiguration", ".", "getFallbackSerializerFactory", "(", ")", ")", ";", "if", "(", "serializerForValue", "!=", "null", ")", "{", "requestedDataFormat", "=", "serializerForValue", ".", "getSerializationDataformat", "(", ")", ";", "}", "}", "if", "(", "javaSerializationDataFormat", ".", "equals", "(", "requestedDataFormat", ")", ")", "{", "throw", "ProcessEngineLogger", ".", "CORE_LOGGER", ".", "javaSerializationProhibitedException", "(", "variableName", ")", ";", "}", "}", "}", "}" ]
Checks, if Java serialization will be used and if it is allowed to be used. @param variableName @param value
[ "Checks", "if", "Java", "serialization", "will", "be", "used", "and", "if", "it", "is", "allowed", "to", "be", "used", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/variable/scope/AbstractVariableScope.java#L380-L406
16,525
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java
Base64.isArrayByteBase64
public static boolean isArrayByteBase64(byte[] arrayOctet) { for (int i = 0; i < arrayOctet.length; i++) { if (!isBase64(arrayOctet[i]) && !isWhiteSpace(arrayOctet[i])) { return false; } } return true; }
java
public static boolean isArrayByteBase64(byte[] arrayOctet) { for (int i = 0; i < arrayOctet.length; i++) { if (!isBase64(arrayOctet[i]) && !isWhiteSpace(arrayOctet[i])) { return false; } } return true; }
[ "public", "static", "boolean", "isArrayByteBase64", "(", "byte", "[", "]", "arrayOctet", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arrayOctet", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "isBase64", "(", "arrayOctet", "[", "i", "]", ")", "&&", "!", "isWhiteSpace", "(", "arrayOctet", "[", "i", "]", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Tests a given byte array to see if it contains only valid characters within the Base64 alphabet. Currently the method treats whitespace as valid. @param arrayOctet byte array to test @return <code>true</code> if all bytes are valid characters in the Base64 alphabet or if the byte array is empty; false, otherwise
[ "Tests", "a", "given", "byte", "array", "to", "see", "if", "it", "contains", "only", "valid", "characters", "within", "the", "Base64", "alphabet", ".", "Currently", "the", "method", "treats", "whitespace", "as", "valid", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/digest/_apacheCommonsCodec/Base64.java#L604-L611
16,526
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/application/impl/EjbProcessApplication.java
EjbProcessApplication.lookupSelfReference
protected ProcessApplicationInterface lookupSelfReference() { try { InitialContext ic = new InitialContext(); SessionContext sctxLookup = (SessionContext) ic.lookup(EJB_CONTEXT_PATH); return sctxLookup.getBusinessObject(getBusinessInterface()); } catch (NamingException e) { throw LOG.ejbPaCannotLookupSelfReference(e); } }
java
protected ProcessApplicationInterface lookupSelfReference() { try { InitialContext ic = new InitialContext(); SessionContext sctxLookup = (SessionContext) ic.lookup(EJB_CONTEXT_PATH); return sctxLookup.getBusinessObject(getBusinessInterface()); } catch (NamingException e) { throw LOG.ejbPaCannotLookupSelfReference(e); } }
[ "protected", "ProcessApplicationInterface", "lookupSelfReference", "(", ")", "{", "try", "{", "InitialContext", "ic", "=", "new", "InitialContext", "(", ")", ";", "SessionContext", "sctxLookup", "=", "(", "SessionContext", ")", "ic", ".", "lookup", "(", "EJB_CONTEXT_PATH", ")", ";", "return", "sctxLookup", ".", "getBusinessObject", "(", "getBusinessInterface", "(", ")", ")", ";", "}", "catch", "(", "NamingException", "e", ")", "{", "throw", "LOG", ".", "ejbPaCannotLookupSelfReference", "(", "e", ")", ";", "}", "}" ]
lookup a proxy object representing the invoked business view of this component.
[ "lookup", "a", "proxy", "object", "representing", "the", "invoked", "business", "view", "of", "this", "component", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/application/impl/EjbProcessApplication.java#L163-L174
16,527
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/application/impl/EjbProcessApplication.java
EjbProcessApplication.lookupEeApplicationName
protected String lookupEeApplicationName() { try { InitialContext initialContext = new InitialContext(); String appName = (String) initialContext.lookup(JAVA_APP_APP_NAME_PATH); String moduleName = (String) initialContext.lookup(MODULE_NAME_PATH); // make sure that if an EAR carries multiple PAs, they are correctly // identified by appName + moduleName if (moduleName != null && !moduleName.equals(appName)) { return appName + "/" + moduleName; } else { return appName; } } catch (NamingException e) { throw LOG.ejbPaCannotAutodetectName(e); } }
java
protected String lookupEeApplicationName() { try { InitialContext initialContext = new InitialContext(); String appName = (String) initialContext.lookup(JAVA_APP_APP_NAME_PATH); String moduleName = (String) initialContext.lookup(MODULE_NAME_PATH); // make sure that if an EAR carries multiple PAs, they are correctly // identified by appName + moduleName if (moduleName != null && !moduleName.equals(appName)) { return appName + "/" + moduleName; } else { return appName; } } catch (NamingException e) { throw LOG.ejbPaCannotAutodetectName(e); } }
[ "protected", "String", "lookupEeApplicationName", "(", ")", "{", "try", "{", "InitialContext", "initialContext", "=", "new", "InitialContext", "(", ")", ";", "String", "appName", "=", "(", "String", ")", "initialContext", ".", "lookup", "(", "JAVA_APP_APP_NAME_PATH", ")", ";", "String", "moduleName", "=", "(", "String", ")", "initialContext", ".", "lookup", "(", "MODULE_NAME_PATH", ")", ";", "// make sure that if an EAR carries multiple PAs, they are correctly", "// identified by appName + moduleName", "if", "(", "moduleName", "!=", "null", "&&", "!", "moduleName", ".", "equals", "(", "appName", ")", ")", "{", "return", "appName", "+", "\"/\"", "+", "moduleName", ";", "}", "else", "{", "return", "appName", ";", "}", "}", "catch", "(", "NamingException", "e", ")", "{", "throw", "LOG", ".", "ejbPaCannotAutodetectName", "(", "e", ")", ";", "}", "}" ]
determine the ee application name based on information obtained from JNDI.
[ "determine", "the", "ee", "application", "name", "based", "on", "information", "obtained", "from", "JNDI", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/application/impl/EjbProcessApplication.java#L179-L198
16,528
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/core/model/CoreActivity.java
CoreActivity.findActivity
public CoreActivity findActivity(String activityId) { CoreActivity localActivity = getChildActivity(activityId); if (localActivity!=null) { return localActivity; } for (CoreActivity activity: getActivities()) { CoreActivity nestedActivity = activity.findActivity(activityId); if (nestedActivity!=null) { return nestedActivity; } } return null; }
java
public CoreActivity findActivity(String activityId) { CoreActivity localActivity = getChildActivity(activityId); if (localActivity!=null) { return localActivity; } for (CoreActivity activity: getActivities()) { CoreActivity nestedActivity = activity.findActivity(activityId); if (nestedActivity!=null) { return nestedActivity; } } return null; }
[ "public", "CoreActivity", "findActivity", "(", "String", "activityId", ")", "{", "CoreActivity", "localActivity", "=", "getChildActivity", "(", "activityId", ")", ";", "if", "(", "localActivity", "!=", "null", ")", "{", "return", "localActivity", ";", "}", "for", "(", "CoreActivity", "activity", ":", "getActivities", "(", ")", ")", "{", "CoreActivity", "nestedActivity", "=", "activity", ".", "findActivity", "(", "activityId", ")", ";", "if", "(", "nestedActivity", "!=", "null", ")", "{", "return", "nestedActivity", ";", "}", "}", "return", "null", ";", "}" ]
searches for the activity recursively
[ "searches", "for", "the", "activity", "recursively" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/model/CoreActivity.java#L42-L54
16,529
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/deployment/scanning/ProcessApplicationScanningUtil.java
ProcessApplicationScanningUtil.checkDiagram
protected static boolean checkDiagram(String fileName, String modelFileName, String[] diagramSuffixes, String[] modelSuffixes) { for (String modelSuffix : modelSuffixes) { if (modelFileName.endsWith(modelSuffix)) { String caseFilePrefix = modelFileName.substring(0, modelFileName.length() - modelSuffix.length()); if (fileName.startsWith(caseFilePrefix)) { for (String diagramResourceSuffix : diagramSuffixes) { if (fileName.endsWith(diagramResourceSuffix)) { return true; } } } } } return false; }
java
protected static boolean checkDiagram(String fileName, String modelFileName, String[] diagramSuffixes, String[] modelSuffixes) { for (String modelSuffix : modelSuffixes) { if (modelFileName.endsWith(modelSuffix)) { String caseFilePrefix = modelFileName.substring(0, modelFileName.length() - modelSuffix.length()); if (fileName.startsWith(caseFilePrefix)) { for (String diagramResourceSuffix : diagramSuffixes) { if (fileName.endsWith(diagramResourceSuffix)) { return true; } } } } } return false; }
[ "protected", "static", "boolean", "checkDiagram", "(", "String", "fileName", ",", "String", "modelFileName", ",", "String", "[", "]", "diagramSuffixes", ",", "String", "[", "]", "modelSuffixes", ")", "{", "for", "(", "String", "modelSuffix", ":", "modelSuffixes", ")", "{", "if", "(", "modelFileName", ".", "endsWith", "(", "modelSuffix", ")", ")", "{", "String", "caseFilePrefix", "=", "modelFileName", ".", "substring", "(", "0", ",", "modelFileName", ".", "length", "(", ")", "-", "modelSuffix", ".", "length", "(", ")", ")", ";", "if", "(", "fileName", ".", "startsWith", "(", "caseFilePrefix", ")", ")", "{", "for", "(", "String", "diagramResourceSuffix", ":", "diagramSuffixes", ")", "{", "if", "(", "fileName", ".", "endsWith", "(", "diagramResourceSuffix", ")", ")", "{", "return", "true", ";", "}", "}", "}", "}", "}", "return", "false", ";", "}" ]
Checks, whether a filename is a diagram for the given modelFileName. @param fileName filename to check. @param modelFileName model file name. @param diagramSuffixes suffixes of the diagram files. @param modelSuffixes suffixes of model files. @return true, if a file is a diagram for the model.
[ "Checks", "whether", "a", "filename", "is", "a", "diagram", "for", "the", "given", "modelFileName", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/container/impl/deployment/scanning/ProcessApplicationScanningUtil.java#L115-L129
16,530
camunda/camunda-bpm-platform
engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/security/auth/ProcessEngineAuthenticationFilter.java
ProcessEngineAuthenticationFilter.extractEngineName
protected String extractEngineName(String requestUrl) { Matcher matcher = ENGINE_REQUEST_URL_PATTERN.matcher(requestUrl); if (matcher.find()) { return matcher.group(1); } else { // any request that does not match a specific engine and is not an /engine request // is mapped to the default engine return DEFAULT_ENGINE_NAME; } }
java
protected String extractEngineName(String requestUrl) { Matcher matcher = ENGINE_REQUEST_URL_PATTERN.matcher(requestUrl); if (matcher.find()) { return matcher.group(1); } else { // any request that does not match a specific engine and is not an /engine request // is mapped to the default engine return DEFAULT_ENGINE_NAME; } }
[ "protected", "String", "extractEngineName", "(", "String", "requestUrl", ")", "{", "Matcher", "matcher", "=", "ENGINE_REQUEST_URL_PATTERN", ".", "matcher", "(", "requestUrl", ")", ";", "if", "(", "matcher", ".", "find", "(", ")", ")", "{", "return", "matcher", ".", "group", "(", "1", ")", ";", "}", "else", "{", "// any request that does not match a specific engine and is not an /engine request", "// is mapped to the default engine", "return", "DEFAULT_ENGINE_NAME", ";", "}", "}" ]
May not return null
[ "May", "not", "return", "null" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/security/auth/ProcessEngineAuthenticationFilter.java#L226-L237
16,531
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParseUtil.java
BpmnParseUtil.findCamundaExtensionElement
public static Element findCamundaExtensionElement(Element element, String extensionElementName) { Element extensionElements = element.element("extensionElements"); if(extensionElements != null) { return extensionElements.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, extensionElementName); } else { return null; } }
java
public static Element findCamundaExtensionElement(Element element, String extensionElementName) { Element extensionElements = element.element("extensionElements"); if(extensionElements != null) { return extensionElements.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, extensionElementName); } else { return null; } }
[ "public", "static", "Element", "findCamundaExtensionElement", "(", "Element", "element", ",", "String", "extensionElementName", ")", "{", "Element", "extensionElements", "=", "element", ".", "element", "(", "\"extensionElements\"", ")", ";", "if", "(", "extensionElements", "!=", "null", ")", "{", "return", "extensionElements", ".", "elementNS", "(", "BpmnParse", ".", "CAMUNDA_BPMN_EXTENSIONS_NS", ",", "extensionElementName", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Returns the camunda extension element in the camunda namespace and the given name. @param element the parent element of the extension element @param extensionElementName the name of the extension element to find @return the extension element or null if not found
[ "Returns", "the", "camunda", "extension", "element", "in", "the", "camunda", "namespace", "and", "the", "given", "name", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParseUtil.java#L53-L60
16,532
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParseUtil.java
BpmnParseUtil.parseCamundaScript
public static ExecutableScript parseCamundaScript(Element scriptElement) { String scriptLanguage = scriptElement.attribute("scriptFormat"); if (scriptLanguage == null || scriptLanguage.isEmpty()) { throw new BpmnParseException("Missing attribute 'scriptFormatAttribute' for 'script' element", scriptElement); } else { String scriptResource = scriptElement.attribute("resource"); String scriptSource = scriptElement.getText(); try { return ScriptUtil.getScript(scriptLanguage, scriptSource, scriptResource, getExpressionManager()); } catch (ProcessEngineException e) { throw new BpmnParseException("Unable to process script", scriptElement, e); } } }
java
public static ExecutableScript parseCamundaScript(Element scriptElement) { String scriptLanguage = scriptElement.attribute("scriptFormat"); if (scriptLanguage == null || scriptLanguage.isEmpty()) { throw new BpmnParseException("Missing attribute 'scriptFormatAttribute' for 'script' element", scriptElement); } else { String scriptResource = scriptElement.attribute("resource"); String scriptSource = scriptElement.getText(); try { return ScriptUtil.getScript(scriptLanguage, scriptSource, scriptResource, getExpressionManager()); } catch (ProcessEngineException e) { throw new BpmnParseException("Unable to process script", scriptElement, e); } } }
[ "public", "static", "ExecutableScript", "parseCamundaScript", "(", "Element", "scriptElement", ")", "{", "String", "scriptLanguage", "=", "scriptElement", ".", "attribute", "(", "\"scriptFormat\"", ")", ";", "if", "(", "scriptLanguage", "==", "null", "||", "scriptLanguage", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "BpmnParseException", "(", "\"Missing attribute 'scriptFormatAttribute' for 'script' element\"", ",", "scriptElement", ")", ";", "}", "else", "{", "String", "scriptResource", "=", "scriptElement", ".", "attribute", "(", "\"resource\"", ")", ";", "String", "scriptSource", "=", "scriptElement", ".", "getText", "(", ")", ";", "try", "{", "return", "ScriptUtil", ".", "getScript", "(", "scriptLanguage", ",", "scriptSource", ",", "scriptResource", ",", "getExpressionManager", "(", ")", ")", ";", "}", "catch", "(", "ProcessEngineException", "e", ")", "{", "throw", "new", "BpmnParseException", "(", "\"Unable to process script\"", ",", "scriptElement", ",", "e", ")", ";", "}", "}", "}" ]
Parses a camunda script element. @param scriptElement the script element ot parse @return the generated executable script @throws BpmnParseException if the a attribute is missing or the script cannot be processed
[ "Parses", "a", "camunda", "script", "element", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParseUtil.java#L223-L238
16,533
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/deployer/BpmnDeployer.java
BpmnDeployer.filterSubscriptionsOfDifferentType
protected List<EventSubscriptionEntity> filterSubscriptionsOfDifferentType(EventSubscriptionDeclaration eventSubscription, List<EventSubscriptionEntity> subscriptionsForSameMessageName) { ArrayList<EventSubscriptionEntity> filteredSubscriptions = new ArrayList<EventSubscriptionEntity>(subscriptionsForSameMessageName); for (EventSubscriptionEntity subscriptionEntity : new ArrayList<EventSubscriptionEntity>(subscriptionsForSameMessageName)) { if (isSubscriptionOfDifferentTypeAsDeclaration(subscriptionEntity, eventSubscription)) { filteredSubscriptions.remove(subscriptionEntity); } } return filteredSubscriptions; }
java
protected List<EventSubscriptionEntity> filterSubscriptionsOfDifferentType(EventSubscriptionDeclaration eventSubscription, List<EventSubscriptionEntity> subscriptionsForSameMessageName) { ArrayList<EventSubscriptionEntity> filteredSubscriptions = new ArrayList<EventSubscriptionEntity>(subscriptionsForSameMessageName); for (EventSubscriptionEntity subscriptionEntity : new ArrayList<EventSubscriptionEntity>(subscriptionsForSameMessageName)) { if (isSubscriptionOfDifferentTypeAsDeclaration(subscriptionEntity, eventSubscription)) { filteredSubscriptions.remove(subscriptionEntity); } } return filteredSubscriptions; }
[ "protected", "List", "<", "EventSubscriptionEntity", ">", "filterSubscriptionsOfDifferentType", "(", "EventSubscriptionDeclaration", "eventSubscription", ",", "List", "<", "EventSubscriptionEntity", ">", "subscriptionsForSameMessageName", ")", "{", "ArrayList", "<", "EventSubscriptionEntity", ">", "filteredSubscriptions", "=", "new", "ArrayList", "<", "EventSubscriptionEntity", ">", "(", "subscriptionsForSameMessageName", ")", ";", "for", "(", "EventSubscriptionEntity", "subscriptionEntity", ":", "new", "ArrayList", "<", "EventSubscriptionEntity", ">", "(", "subscriptionsForSameMessageName", ")", ")", "{", "if", "(", "isSubscriptionOfDifferentTypeAsDeclaration", "(", "subscriptionEntity", ",", "eventSubscription", ")", ")", "{", "filteredSubscriptions", ".", "remove", "(", "subscriptionEntity", ")", ";", "}", "}", "return", "filteredSubscriptions", ";", "}" ]
It is possible to deploy a process containing a start and intermediate message event that wait for the same message or to have two processes, one with a message start event and the other one with a message intermediate event, that subscribe for the same message. Therefore we have to find out if there are subscriptions for the other type of event and remove those. @param eventSubscription @param subscriptionsForSameMessageName
[ "It", "is", "possible", "to", "deploy", "a", "process", "containing", "a", "start", "and", "intermediate", "message", "event", "that", "wait", "for", "the", "same", "message", "or", "to", "have", "two", "processes", "one", "with", "a", "message", "start", "event", "and", "the", "other", "one", "with", "a", "message", "intermediate", "event", "that", "subscribe", "for", "the", "same", "message", ".", "Therefore", "we", "have", "to", "find", "out", "if", "there", "are", "subscriptions", "for", "the", "other", "type", "of", "event", "and", "remove", "those", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/deployer/BpmnDeployer.java#L358-L370
16,534
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/juel/SimpleContext.java
SimpleContext.setFunction
public void setFunction(String prefix, String localName, Method method) { if (functions == null) { functions = new Functions(); } functions.setFunction(prefix, localName, method); }
java
public void setFunction(String prefix, String localName, Method method) { if (functions == null) { functions = new Functions(); } functions.setFunction(prefix, localName, method); }
[ "public", "void", "setFunction", "(", "String", "prefix", ",", "String", "localName", ",", "Method", "method", ")", "{", "if", "(", "functions", "==", "null", ")", "{", "functions", "=", "new", "Functions", "(", ")", ";", "}", "functions", ".", "setFunction", "(", "prefix", ",", "localName", ",", "method", ")", ";", "}" ]
Define a function.
[ "Define", "a", "function", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/juel/SimpleContext.java#L89-L94
16,535
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/juel/SimpleContext.java
SimpleContext.setVariable
public ValueExpression setVariable(String name, ValueExpression expression) { if (variables == null) { variables = new Variables(); } return variables.setVariable(name, expression); }
java
public ValueExpression setVariable(String name, ValueExpression expression) { if (variables == null) { variables = new Variables(); } return variables.setVariable(name, expression); }
[ "public", "ValueExpression", "setVariable", "(", "String", "name", ",", "ValueExpression", "expression", ")", "{", "if", "(", "variables", "==", "null", ")", "{", "variables", "=", "new", "Variables", "(", ")", ";", "}", "return", "variables", ".", "setVariable", "(", "name", ",", "expression", ")", ";", "}" ]
Define a variable.
[ "Define", "a", "variable", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/juel/SimpleContext.java#L99-L104
16,536
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ActivityImpl.java
ActivityImpl.isCompensationHandler
public boolean isCompensationHandler() { Boolean isForCompensation = (Boolean) getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION); return Boolean.TRUE.equals(isForCompensation); }
java
public boolean isCompensationHandler() { Boolean isForCompensation = (Boolean) getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION); return Boolean.TRUE.equals(isForCompensation); }
[ "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.
[ "Indicates", "whether", "activity", "is", "for", "compensation", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ActivityImpl.java#L255-L258
16,537
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ActivityImpl.java
ActivityImpl.findCompensationHandler
public ActivityImpl findCompensationHandler() { String compensationHandlerId = (String) getProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID); if(compensationHandlerId != null) { return getProcessDefinition().findActivity(compensationHandlerId); } else { return null; } }
java
public ActivityImpl findCompensationHandler() { String compensationHandlerId = (String) getProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID); if(compensationHandlerId != null) { return getProcessDefinition().findActivity(compensationHandlerId); } else { return null; } }
[ "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.
[ "Find", "the", "compensation", "handler", "of", "this", "activity", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ActivityImpl.java#L265-L272
16,538
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ActivityImpl.java
ActivityImpl.isMultiInstance
public boolean isMultiInstance() { Boolean isMultiInstance = (Boolean) getProperty(BpmnParse.PROPERTYNAME_IS_MULTI_INSTANCE); return Boolean.TRUE.equals(isMultiInstance); }
java
public boolean isMultiInstance() { Boolean isMultiInstance = (Boolean) getProperty(BpmnParse.PROPERTYNAME_IS_MULTI_INSTANCE); return Boolean.TRUE.equals(isMultiInstance); }
[ "public", "boolean", "isMultiInstance", "(", ")", "{", "Boolean", "isMultiInstance", "=", "(", "Boolean", ")", "getProperty", "(", "BpmnParse", ".", "PROPERTYNAME_IS_MULTI_INSTANCE", ")", ";", "return", "Boolean", ".", "TRUE", ".", "equals", "(", "isMultiInstance", ")", ";", "}" ]
Indicates whether activity is a multi instance activity. @return true if this activity is a multi instance activity.
[ "Indicates", "whether", "activity", "is", "a", "multi", "instance", "activity", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/process/ActivityImpl.java#L279-L282
16,539
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/DbEntityManager.java
DbEntityManager.cacheFilter
protected DbEntity cacheFilter(DbEntity persistentObject) { DbEntity cachedPersistentObject = dbEntityCache.get(persistentObject.getClass(), persistentObject.getId()); if (cachedPersistentObject!=null) { return cachedPersistentObject; } else { return persistentObject; } }
java
protected DbEntity cacheFilter(DbEntity persistentObject) { DbEntity cachedPersistentObject = dbEntityCache.get(persistentObject.getClass(), persistentObject.getId()); if (cachedPersistentObject!=null) { return cachedPersistentObject; } else { return persistentObject; } }
[ "protected", "DbEntity", "cacheFilter", "(", "DbEntity", "persistentObject", ")", "{", "DbEntity", "cachedPersistentObject", "=", "dbEntityCache", ".", "get", "(", "persistentObject", ".", "getClass", "(", ")", ",", "persistentObject", ".", "getId", "(", ")", ")", ";", "if", "(", "cachedPersistentObject", "!=", "null", ")", "{", "return", "cachedPersistentObject", ";", "}", "else", "{", "return", "persistentObject", ";", "}", "}" ]
returns the object in the cache. if this object was loaded before, then the original object is returned.
[ "returns", "the", "object", "in", "the", "cache", ".", "if", "this", "object", "was", "loaded", "before", "then", "the", "original", "object", "is", "returned", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/DbEntityManager.java#L247-L256
16,540
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/DbEntityManager.java
DbEntityManager.hasOptimisticLockingException
private DbOperation hasOptimisticLockingException(List<DbOperation> operationsToFlush, Throwable cause) { BatchExecutorException batchExecutorException = ExceptionUtil.findBatchExecutorException(cause); if (batchExecutorException != null) { int failedOperationIndex = batchExecutorException.getSuccessfulBatchResults().size(); if (failedOperationIndex < operationsToFlush.size()) { DbOperation failedOperation = operationsToFlush.get(failedOperationIndex); if (isOptimisticLockingException(failedOperation, cause)) { return failedOperation; } } } return null; }
java
private DbOperation hasOptimisticLockingException(List<DbOperation> operationsToFlush, Throwable cause) { BatchExecutorException batchExecutorException = ExceptionUtil.findBatchExecutorException(cause); if (batchExecutorException != null) { int failedOperationIndex = batchExecutorException.getSuccessfulBatchResults().size(); if (failedOperationIndex < operationsToFlush.size()) { DbOperation failedOperation = operationsToFlush.get(failedOperationIndex); if (isOptimisticLockingException(failedOperation, cause)) { return failedOperation; } } } return null; }
[ "private", "DbOperation", "hasOptimisticLockingException", "(", "List", "<", "DbOperation", ">", "operationsToFlush", ",", "Throwable", "cause", ")", "{", "BatchExecutorException", "batchExecutorException", "=", "ExceptionUtil", ".", "findBatchExecutorException", "(", "cause", ")", ";", "if", "(", "batchExecutorException", "!=", "null", ")", "{", "int", "failedOperationIndex", "=", "batchExecutorException", ".", "getSuccessfulBatchResults", "(", ")", ".", "size", "(", ")", ";", "if", "(", "failedOperationIndex", "<", "operationsToFlush", ".", "size", "(", ")", ")", "{", "DbOperation", "failedOperation", "=", "operationsToFlush", ".", "get", "(", "failedOperationIndex", ")", ";", "if", "(", "isOptimisticLockingException", "(", "failedOperation", ",", "cause", ")", ")", "{", "return", "failedOperation", ";", "}", "}", "}", "return", "null", ";", "}" ]
An OptimisticLockingException check for batch processing @param operationsToFlush The list of DB operations in which the Exception occurred @param cause the Exception object @return The DbOperation where the OptimisticLockingException has occurred or null if no OptimisticLockingException occurred
[ "An", "OptimisticLockingException", "check", "for", "batch", "processing" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/DbEntityManager.java#L379-L395
16,541
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/BeanELResolver.java
BeanELResolver.getValue
@Override public Object getValue(ELContext context, Object base, Object property) { if (context == null) { throw new NullPointerException(); } Object result = null; if (isResolvable(base)) { Method method = toBeanProperty(base, property).getReadMethod(); if (method == null) { throw new PropertyNotFoundException("Cannot read property " + property); } try { result = method.invoke(base); } catch (InvocationTargetException e) { throw new ELException(e.getCause()); } catch (Exception e) { throw new ELException(e); } context.setPropertyResolved(true); } return result; }
java
@Override public Object getValue(ELContext context, Object base, Object property) { if (context == null) { throw new NullPointerException(); } Object result = null; if (isResolvable(base)) { Method method = toBeanProperty(base, property).getReadMethod(); if (method == null) { throw new PropertyNotFoundException("Cannot read property " + property); } try { result = method.invoke(base); } catch (InvocationTargetException e) { throw new ELException(e.getCause()); } catch (Exception e) { throw new ELException(e); } context.setPropertyResolved(true); } return result; }
[ "@", "Override", "public", "Object", "getValue", "(", "ELContext", "context", ",", "Object", "base", ",", "Object", "property", ")", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "Object", "result", "=", "null", ";", "if", "(", "isResolvable", "(", "base", ")", ")", "{", "Method", "method", "=", "toBeanProperty", "(", "base", ",", "property", ")", ".", "getReadMethod", "(", ")", ";", "if", "(", "method", "==", "null", ")", "{", "throw", "new", "PropertyNotFoundException", "(", "\"Cannot read property \"", "+", "property", ")", ";", "}", "try", "{", "result", "=", "method", ".", "invoke", "(", "base", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "ELException", "(", "e", ".", "getCause", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ELException", "(", "e", ")", ";", "}", "context", ".", "setPropertyResolved", "(", "true", ")", ";", "}", "return", "result", ";", "}" ]
If the base object is not null, returns the current value of the given property on this bean. If the base is not null, the propertyResolved property of the ELContext object must be set to true by this resolver, before returning. If this property is not true after this method is called, the caller should ignore the return value. The provided property name will first be coerced to a String. If the property is a readable property of the base object, as per the JavaBeans specification, then return the result of the getter call. If the getter throws an exception, it is propagated to the caller. If the property is not found or is not readable, a PropertyNotFoundException is thrown. @param context The context of this evaluation. @param base The bean to analyze. @param property The name of the property to analyze. Will be coerced to a String. @return If the propertyResolved property of ELContext was set to true, then the value of the given property. Otherwise, undefined. @throws NullPointerException if context is null @throws PropertyNotFoundException if base is not null and the specified property does not exist or is not readable. @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown exception must be included as the cause property of this exception, if available.
[ "If", "the", "base", "object", "is", "not", "null", "returns", "the", "current", "value", "of", "the", "given", "property", "on", "this", "bean", ".", "If", "the", "base", "is", "not", "null", "the", "propertyResolved", "property", "of", "the", "ELContext", "object", "must", "be", "set", "to", "true", "by", "this", "resolver", "before", "returning", ".", "If", "this", "property", "is", "not", "true", "after", "this", "method", "is", "called", "the", "caller", "should", "ignore", "the", "return", "value", ".", "The", "provided", "property", "name", "will", "first", "be", "coerced", "to", "a", "String", ".", "If", "the", "property", "is", "a", "readable", "property", "of", "the", "base", "object", "as", "per", "the", "JavaBeans", "specification", "then", "return", "the", "result", "of", "the", "getter", "call", ".", "If", "the", "getter", "throws", "an", "exception", "it", "is", "propagated", "to", "the", "caller", ".", "If", "the", "property", "is", "not", "found", "or", "is", "not", "readable", "a", "PropertyNotFoundException", "is", "thrown", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/BeanELResolver.java#L291-L312
16,542
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/cmd/AbstractInstantiationCmd.java
AbstractInstantiationCmd.supportsConcurrentChildInstantiation
protected boolean supportsConcurrentChildInstantiation(ScopeImpl flowScope) { CoreActivityBehavior<?> behavior = flowScope.getActivityBehavior(); return behavior == null || !(behavior instanceof SequentialMultiInstanceActivityBehavior); }
java
protected boolean supportsConcurrentChildInstantiation(ScopeImpl flowScope) { CoreActivityBehavior<?> behavior = flowScope.getActivityBehavior(); return behavior == null || !(behavior instanceof SequentialMultiInstanceActivityBehavior); }
[ "protected", "boolean", "supportsConcurrentChildInstantiation", "(", "ScopeImpl", "flowScope", ")", "{", "CoreActivityBehavior", "<", "?", ">", "behavior", "=", "flowScope", ".", "getActivityBehavior", "(", ")", ";", "return", "behavior", "==", "null", "||", "!", "(", "behavior", "instanceof", "SequentialMultiInstanceActivityBehavior", ")", ";", "}" ]
Cannot create more than inner instance in a sequential MI construct
[ "Cannot", "create", "more", "than", "inner", "instance", "in", "a", "sequential", "MI", "construct" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/cmd/AbstractInstantiationCmd.java#L295-L298
16,543
camunda/camunda-bpm-platform
engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/jsf/TaskForm.java
TaskForm.startTaskForm
public void startTaskForm() { Map<String, String> requestParameterMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String taskId = requestParameterMap.get("taskId"); String callbackUrl = requestParameterMap.get("callbackUrl"); if (taskId==null || callbackUrl == null) { if (FacesContext.getCurrentInstance().isPostback()) { // if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added // as preRenderView event // see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some return; } // return it anyway but log an info message log.log(Level.INFO, "Called startTask method without proper parameter (taskId='"+taskId+"'; callbackUrl='"+callbackUrl+"') even if it seems we are not called by an AJAX Postback. Are you using the camundaTaskForm bean correctly?"); return; } // Note that we always run in a conversation this.url = callbackUrl; businessProcess.startTask(taskId, true); }
java
public void startTaskForm() { Map<String, String> requestParameterMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String taskId = requestParameterMap.get("taskId"); String callbackUrl = requestParameterMap.get("callbackUrl"); if (taskId==null || callbackUrl == null) { if (FacesContext.getCurrentInstance().isPostback()) { // if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added // as preRenderView event // see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some return; } // return it anyway but log an info message log.log(Level.INFO, "Called startTask method without proper parameter (taskId='"+taskId+"'; callbackUrl='"+callbackUrl+"') even if it seems we are not called by an AJAX Postback. Are you using the camundaTaskForm bean correctly?"); return; } // Note that we always run in a conversation this.url = callbackUrl; businessProcess.startTask(taskId, true); }
[ "public", "void", "startTaskForm", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "requestParameterMap", "=", "FacesContext", ".", "getCurrentInstance", "(", ")", ".", "getExternalContext", "(", ")", ".", "getRequestParameterMap", "(", ")", ";", "String", "taskId", "=", "requestParameterMap", ".", "get", "(", "\"taskId\"", ")", ";", "String", "callbackUrl", "=", "requestParameterMap", ".", "get", "(", "\"callbackUrl\"", ")", ";", "if", "(", "taskId", "==", "null", "||", "callbackUrl", "==", "null", ")", "{", "if", "(", "FacesContext", ".", "getCurrentInstance", "(", ")", ".", "isPostback", "(", ")", ")", "{", "// if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added", "// as preRenderView event", "// see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some", "return", ";", "}", "// return it anyway but log an info message", "log", ".", "log", "(", "Level", ".", "INFO", ",", "\"Called startTask method without proper parameter (taskId='\"", "+", "taskId", "+", "\"'; callbackUrl='\"", "+", "callbackUrl", "+", "\"') even if it seems we are not called by an AJAX Postback. Are you using the camundaTaskForm bean correctly?\"", ")", ";", "return", ";", "}", "// Note that we always run in a conversation", "this", ".", "url", "=", "callbackUrl", ";", "businessProcess", ".", "startTask", "(", "taskId", ",", "true", ")", ";", "}" ]
Get taskId and callBackUrl from request and start a conversation to start the form
[ "Get", "taskId", "and", "callBackUrl", "from", "request", "and", "start", "a", "conversation", "to", "start", "the", "form" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/jsf/TaskForm.java#L87-L106
16,544
camunda/camunda-bpm-platform
engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/jsf/TaskForm.java
TaskForm.startProcessInstanceByIdForm
public void startProcessInstanceByIdForm() { if (FacesContext.getCurrentInstance().isPostback()) { // if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added // as preRenderView event // see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some return; } Map<String, String> requestParameterMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String processDefinitionId = requestParameterMap.get("processDefinitionId"); String callbackUrl = requestParameterMap.get("callbackUrl"); this.url = callbackUrl; this.processDefinitionId = processDefinitionId; beginConversation(); }
java
public void startProcessInstanceByIdForm() { if (FacesContext.getCurrentInstance().isPostback()) { // if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added // as preRenderView event // see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some return; } Map<String, String> requestParameterMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String processDefinitionId = requestParameterMap.get("processDefinitionId"); String callbackUrl = requestParameterMap.get("callbackUrl"); this.url = callbackUrl; this.processDefinitionId = processDefinitionId; beginConversation(); }
[ "public", "void", "startProcessInstanceByIdForm", "(", ")", "{", "if", "(", "FacesContext", ".", "getCurrentInstance", "(", ")", ".", "isPostback", "(", ")", ")", "{", "// if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added", "// as preRenderView event", "// see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some", "return", ";", "}", "Map", "<", "String", ",", "String", ">", "requestParameterMap", "=", "FacesContext", ".", "getCurrentInstance", "(", ")", ".", "getExternalContext", "(", ")", ".", "getRequestParameterMap", "(", ")", ";", "String", "processDefinitionId", "=", "requestParameterMap", ".", "get", "(", "\"processDefinitionId\"", ")", ";", "String", "callbackUrl", "=", "requestParameterMap", ".", "get", "(", "\"callbackUrl\"", ")", ";", "this", ".", "url", "=", "callbackUrl", ";", "this", ".", "processDefinitionId", "=", "processDefinitionId", ";", "beginConversation", "(", ")", ";", "}" ]
Get processDefinitionId and callbackUrl from request and start a conversation to start the form
[ "Get", "processDefinitionId", "and", "callbackUrl", "from", "request", "and", "start", "a", "conversation", "to", "start", "the", "form" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/jsf/TaskForm.java#L139-L153
16,545
camunda/camunda-bpm-platform
engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/jsf/TaskForm.java
TaskForm.startProcessInstanceByKeyForm
public void startProcessInstanceByKeyForm() { if (FacesContext.getCurrentInstance().isPostback()) { // if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added // as preRenderView event // see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some return; } Map<String, String> requestParameterMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String processDefinitionKey = requestParameterMap.get("processDefinitionKey"); String callbackUrl = requestParameterMap.get("callbackUrl"); this.url = callbackUrl; this.processDefinitionKey = processDefinitionKey; beginConversation(); }
java
public void startProcessInstanceByKeyForm() { if (FacesContext.getCurrentInstance().isPostback()) { // if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added // as preRenderView event // see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some return; } Map<String, String> requestParameterMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String processDefinitionKey = requestParameterMap.get("processDefinitionKey"); String callbackUrl = requestParameterMap.get("callbackUrl"); this.url = callbackUrl; this.processDefinitionKey = processDefinitionKey; beginConversation(); }
[ "public", "void", "startProcessInstanceByKeyForm", "(", ")", "{", "if", "(", "FacesContext", ".", "getCurrentInstance", "(", ")", ".", "isPostback", "(", ")", ")", "{", "// if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added", "// as preRenderView event", "// see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some", "return", ";", "}", "Map", "<", "String", ",", "String", ">", "requestParameterMap", "=", "FacesContext", ".", "getCurrentInstance", "(", ")", ".", "getExternalContext", "(", ")", ".", "getRequestParameterMap", "(", ")", ";", "String", "processDefinitionKey", "=", "requestParameterMap", ".", "get", "(", "\"processDefinitionKey\"", ")", ";", "String", "callbackUrl", "=", "requestParameterMap", ".", "get", "(", "\"callbackUrl\"", ")", ";", "this", ".", "url", "=", "callbackUrl", ";", "this", ".", "processDefinitionKey", "=", "processDefinitionKey", ";", "beginConversation", "(", ")", ";", "}" ]
Get processDefinitionKey and callbackUrl from request and start a conversation to start the form
[ "Get", "processDefinitionKey", "and", "callbackUrl", "from", "request", "and", "start", "a", "conversation", "to", "start", "the", "form" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/jsf/TaskForm.java#L173-L187
16,546
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/ResourceBundleELResolver.java
ResourceBundleELResolver.getValue
@Override public Object getValue(ELContext context, Object base, Object property) { if (context == null) { throw new NullPointerException("context is null"); } Object result = null; if (isResolvable(base)) { if (property != null) { try { result = ((ResourceBundle) base).getObject(property.toString()); } catch (MissingResourceException e) { result = "???" + property + "???"; } } context.setPropertyResolved(true); } return result; }
java
@Override public Object getValue(ELContext context, Object base, Object property) { if (context == null) { throw new NullPointerException("context is null"); } Object result = null; if (isResolvable(base)) { if (property != null) { try { result = ((ResourceBundle) base).getObject(property.toString()); } catch (MissingResourceException e) { result = "???" + property + "???"; } } context.setPropertyResolved(true); } return result; }
[ "@", "Override", "public", "Object", "getValue", "(", "ELContext", "context", ",", "Object", "base", ",", "Object", "property", ")", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"context is null\"", ")", ";", "}", "Object", "result", "=", "null", ";", "if", "(", "isResolvable", "(", "base", ")", ")", "{", "if", "(", "property", "!=", "null", ")", "{", "try", "{", "result", "=", "(", "(", "ResourceBundle", ")", "base", ")", ".", "getObject", "(", "property", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "MissingResourceException", "e", ")", "{", "result", "=", "\"???\"", "+", "property", "+", "\"???\"", ";", "}", "}", "context", ".", "setPropertyResolved", "(", "true", ")", ";", "}", "return", "result", ";", "}" ]
If the base object is an instance of ResourceBundle, the provided property will first be coerced to a String. The Object returned by getObject on the base ResourceBundle will be returned. If the base is ResourceBundle, the propertyResolved property of the ELContext object must be set to true by this resolver, before returning. If this property is not true after this method is called, the caller should ignore the return value. @param context The context of this evaluation. @param base The bundle to analyze. Only bases of type ResourceBundle are handled by this resolver. @param property The name of the property to analyze. Will be coerced to a String. @return If the propertyResolved property of ELContext was set to true, then null if property is null; otherwise the Object for the given key (property coerced to String) from the ResourceBundle. If no object for the given key can be found, then the String "???" + key + "???". @throws NullPointerException if context is null. @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown exception must be included as the cause property of this exception, if available.
[ "If", "the", "base", "object", "is", "an", "instance", "of", "ResourceBundle", "the", "provided", "property", "will", "first", "be", "coerced", "to", "a", "String", ".", "The", "Object", "returned", "by", "getObject", "on", "the", "base", "ResourceBundle", "will", "be", "returned", ".", "If", "the", "base", "is", "ResourceBundle", "the", "propertyResolved", "property", "of", "the", "ELContext", "object", "must", "be", "set", "to", "true", "by", "this", "resolver", "before", "returning", ".", "If", "this", "property", "is", "not", "true", "after", "this", "method", "is", "called", "the", "caller", "should", "ignore", "the", "return", "value", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/javax/el/ResourceBundleELResolver.java#L161-L178
16,547
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/cache/DbEntityCache.java
DbEntityCache.get
@SuppressWarnings("unchecked") public <T extends DbEntity> T get(Class<T> type, String id) { Class<?> cacheKey = cacheKeyMapping.getEntityCacheKey(type); CachedDbEntity cachedDbEntity = getCachedEntity(cacheKey, id); if(cachedDbEntity != null) { DbEntity dbEntity = cachedDbEntity.getEntity(); try { return (T) dbEntity; } catch(ClassCastException e) { throw LOG.entityCacheLookupException(type, id, dbEntity.getClass(), e); } } else { return null; } }
java
@SuppressWarnings("unchecked") public <T extends DbEntity> T get(Class<T> type, String id) { Class<?> cacheKey = cacheKeyMapping.getEntityCacheKey(type); CachedDbEntity cachedDbEntity = getCachedEntity(cacheKey, id); if(cachedDbEntity != null) { DbEntity dbEntity = cachedDbEntity.getEntity(); try { return (T) dbEntity; } catch(ClassCastException e) { throw LOG.entityCacheLookupException(type, id, dbEntity.getClass(), e); } } else { return null; } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", "extends", "DbEntity", ">", "T", "get", "(", "Class", "<", "T", ">", "type", ",", "String", "id", ")", "{", "Class", "<", "?", ">", "cacheKey", "=", "cacheKeyMapping", ".", "getEntityCacheKey", "(", "type", ")", ";", "CachedDbEntity", "cachedDbEntity", "=", "getCachedEntity", "(", "cacheKey", ",", "id", ")", ";", "if", "(", "cachedDbEntity", "!=", "null", ")", "{", "DbEntity", "dbEntity", "=", "cachedDbEntity", ".", "getEntity", "(", ")", ";", "try", "{", "return", "(", "T", ")", "dbEntity", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "throw", "LOG", ".", "entityCacheLookupException", "(", "type", ",", "id", ",", "dbEntity", ".", "getClass", "(", ")", ",", "e", ")", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}" ]
get an object from the cache @param type the type of the object @param id the id of the object @return the object or 'null' if the object is not in the cache @throws ProcessEngineException if an object for the given id can be found but is of the wrong type.
[ "get", "an", "object", "from", "the", "cache" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/cache/DbEntityCache.java#L78-L92
16,548
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/cache/DbEntityCache.java
DbEntityCache.getCachedEntity
public CachedDbEntity getCachedEntity(Class<?> type, String id) { Class<?> cacheKey = cacheKeyMapping.getEntityCacheKey(type); Map<String, CachedDbEntity> entitiesByType = cachedEntites.get(cacheKey); if(entitiesByType != null) { return entitiesByType.get(id); } else { return null; } }
java
public CachedDbEntity getCachedEntity(Class<?> type, String id) { Class<?> cacheKey = cacheKeyMapping.getEntityCacheKey(type); Map<String, CachedDbEntity> entitiesByType = cachedEntites.get(cacheKey); if(entitiesByType != null) { return entitiesByType.get(id); } else { return null; } }
[ "public", "CachedDbEntity", "getCachedEntity", "(", "Class", "<", "?", ">", "type", ",", "String", "id", ")", "{", "Class", "<", "?", ">", "cacheKey", "=", "cacheKeyMapping", ".", "getEntityCacheKey", "(", "type", ")", ";", "Map", "<", "String", ",", "CachedDbEntity", ">", "entitiesByType", "=", "cachedEntites", ".", "get", "(", "cacheKey", ")", ";", "if", "(", "entitiesByType", "!=", "null", ")", "{", "return", "entitiesByType", ".", "get", "(", "id", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Looks up an entity in the cache. @param type the type of the object @param id the id of the CachedEntity to lookup @return the cached entity or null if the entity does not exist.
[ "Looks", "up", "an", "entity", "in", "the", "cache", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/cache/DbEntityCache.java#L126-L134
16,549
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/cache/DbEntityCache.java
DbEntityCache.remove
public boolean remove(DbEntity e) { Class<?> cacheKey = cacheKeyMapping.getEntityCacheKey(e.getClass()); Map<String, CachedDbEntity> typeMap = cachedEntites.get(cacheKey); if(typeMap != null) { return typeMap.remove(e.getId()) != null; } else { return false; } }
java
public boolean remove(DbEntity e) { Class<?> cacheKey = cacheKeyMapping.getEntityCacheKey(e.getClass()); Map<String, CachedDbEntity> typeMap = cachedEntites.get(cacheKey); if(typeMap != null) { return typeMap.remove(e.getId()) != null; } else { return false; } }
[ "public", "boolean", "remove", "(", "DbEntity", "e", ")", "{", "Class", "<", "?", ">", "cacheKey", "=", "cacheKeyMapping", ".", "getEntityCacheKey", "(", "e", ".", "getClass", "(", ")", ")", ";", "Map", "<", "String", ",", "CachedDbEntity", ">", "typeMap", "=", "cachedEntites", ".", "get", "(", "cacheKey", ")", ";", "if", "(", "typeMap", "!=", "null", ")", "{", "return", "typeMap", ".", "remove", "(", "e", ".", "getId", "(", ")", ")", "!=", "null", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Remove an entity from the cache @param e the entity to remove @return
[ "Remove", "an", "entity", "from", "the", "cache" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/cache/DbEntityCache.java#L264-L272
16,550
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/cache/DbEntityCache.java
DbEntityCache.isDeleted
public boolean isDeleted(DbEntity dbEntity) { CachedDbEntity cachedDbEntity = getCachedEntity(dbEntity); if(cachedDbEntity == null) { return false; } else { return cachedDbEntity.getEntityState() == DELETED_MERGED || cachedDbEntity.getEntityState() == DELETED_PERSISTENT || cachedDbEntity.getEntityState() == DELETED_TRANSIENT; } }
java
public boolean isDeleted(DbEntity dbEntity) { CachedDbEntity cachedDbEntity = getCachedEntity(dbEntity); if(cachedDbEntity == null) { return false; } else { return cachedDbEntity.getEntityState() == DELETED_MERGED || cachedDbEntity.getEntityState() == DELETED_PERSISTENT || cachedDbEntity.getEntityState() == DELETED_TRANSIENT; } }
[ "public", "boolean", "isDeleted", "(", "DbEntity", "dbEntity", ")", "{", "CachedDbEntity", "cachedDbEntity", "=", "getCachedEntity", "(", "dbEntity", ")", ";", "if", "(", "cachedDbEntity", "==", "null", ")", "{", "return", "false", ";", "}", "else", "{", "return", "cachedDbEntity", ".", "getEntityState", "(", ")", "==", "DELETED_MERGED", "||", "cachedDbEntity", ".", "getEntityState", "(", ")", "==", "DELETED_PERSISTENT", "||", "cachedDbEntity", ".", "getEntityState", "(", ")", "==", "DELETED_TRANSIENT", ";", "}", "}" ]
Allows checking whether the provided entity is present in the cache and is marked to be deleted. @param dbEntity the entity to check @return true if the provided entity is present in the cache and is marked to be deleted
[ "Allows", "checking", "whether", "the", "provided", "entity", "is", "present", "in", "the", "cache", "and", "is", "marked", "to", "be", "deleted", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/cache/DbEntityCache.java#L316-L325
16,551
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/cache/DbEntityCache.java
DbEntityCache.setDeleted
public void setDeleted(DbEntity dbEntity) { CachedDbEntity cachedEntity = getCachedEntity(dbEntity); if(cachedEntity != null) { if(cachedEntity.getEntityState() == TRANSIENT) { cachedEntity.setEntityState(DELETED_TRANSIENT); } else if(cachedEntity.getEntityState() == PERSISTENT){ cachedEntity.setEntityState(DELETED_PERSISTENT); } else if(cachedEntity.getEntityState() == MERGED){ cachedEntity.setEntityState(DELETED_MERGED); } } else { // put a deleted merged into the cache CachedDbEntity cachedDbEntity = new CachedDbEntity(); cachedDbEntity.setEntity(dbEntity); cachedDbEntity.setEntityState(DELETED_MERGED); putInternal(cachedDbEntity); } }
java
public void setDeleted(DbEntity dbEntity) { CachedDbEntity cachedEntity = getCachedEntity(dbEntity); if(cachedEntity != null) { if(cachedEntity.getEntityState() == TRANSIENT) { cachedEntity.setEntityState(DELETED_TRANSIENT); } else if(cachedEntity.getEntityState() == PERSISTENT){ cachedEntity.setEntityState(DELETED_PERSISTENT); } else if(cachedEntity.getEntityState() == MERGED){ cachedEntity.setEntityState(DELETED_MERGED); } } else { // put a deleted merged into the cache CachedDbEntity cachedDbEntity = new CachedDbEntity(); cachedDbEntity.setEntity(dbEntity); cachedDbEntity.setEntityState(DELETED_MERGED); putInternal(cachedDbEntity); } }
[ "public", "void", "setDeleted", "(", "DbEntity", "dbEntity", ")", "{", "CachedDbEntity", "cachedEntity", "=", "getCachedEntity", "(", "dbEntity", ")", ";", "if", "(", "cachedEntity", "!=", "null", ")", "{", "if", "(", "cachedEntity", ".", "getEntityState", "(", ")", "==", "TRANSIENT", ")", "{", "cachedEntity", ".", "setEntityState", "(", "DELETED_TRANSIENT", ")", ";", "}", "else", "if", "(", "cachedEntity", ".", "getEntityState", "(", ")", "==", "PERSISTENT", ")", "{", "cachedEntity", ".", "setEntityState", "(", "DELETED_PERSISTENT", ")", ";", "}", "else", "if", "(", "cachedEntity", ".", "getEntityState", "(", ")", "==", "MERGED", ")", "{", "cachedEntity", ".", "setEntityState", "(", "DELETED_MERGED", ")", ";", "}", "}", "else", "{", "// put a deleted merged into the cache", "CachedDbEntity", "cachedDbEntity", "=", "new", "CachedDbEntity", "(", ")", ";", "cachedDbEntity", ".", "setEntity", "(", "dbEntity", ")", ";", "cachedDbEntity", ".", "setEntityState", "(", "DELETED_MERGED", ")", ";", "putInternal", "(", "cachedDbEntity", ")", ";", "}", "}" ]
Sets an object to a deleted state. It will not be removed from the cache but transition to one of the DELETED states, depending on it's current state. @param dbEntity the object to mark deleted.
[ "Sets", "an", "object", "to", "a", "deleted", "state", ".", "It", "will", "not", "be", "removed", "from", "the", "cache", "but", "transition", "to", "one", "of", "the", "DELETED", "states", "depending", "on", "it", "s", "current", "state", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/cache/DbEntityCache.java#L358-L378
16,552
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java
EventSubscriptionManager.findSignalEventSubscriptionsByEventName
@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); }
java
@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); }
[ "@", "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)
[ "Find", "all", "signal", "event", "subscriptions", "with", "the", "given", "event", "name", "for", "any", "tenant", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java#L93-L105
16,553
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java
EventSubscriptionManager.findSignalEventSubscriptionsByEventNameAndTenantId
@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); }
java
@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); }
[ "@", "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.
[ "Find", "all", "signal", "event", "subscriptions", "with", "the", "given", "event", "name", "and", "tenant", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/EventSubscriptionManager.java#L110-L126
16,554
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java
ReflectUtil.urlToURI
public static URI urlToURI(URL url) { try { return url.toURI(); } catch (URISyntaxException e) { throw LOG.cannotConvertUrlToUri(url, e); } }
java
public static URI urlToURI(URL url) { try { return url.toURI(); } catch (URISyntaxException e) { throw LOG.cannotConvertUrlToUri(url, e); } }
[ "public", "static", "URI", "urlToURI", "(", "URL", "url", ")", "{", "try", "{", "return", "url", ".", "toURI", "(", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "LOG", ".", "cannotConvertUrlToUri", "(", "url", ",", "e", ")", ";", "}", "}" ]
Converts an url to an uri. Escapes whitespaces if needed. @param url the url to convert @return the resulting uri @throws ProcessEngineException if the url has invalid syntax
[ "Converts", "an", "url", "to", "an", "uri", ".", "Escapes", "whitespaces", "if", "needed", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java#L171-L178
16,555
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java
ReflectUtil.getField
public static Field getField(String fieldName, Class<?> clazz) { Field field = null; try { field = clazz.getDeclaredField(fieldName); } catch (SecurityException e) { throw LOG.unableToAccessField(field, clazz.getName()); } catch (NoSuchFieldException e) { // for some reason getDeclaredFields doesnt search superclasses // (which getFields() does ... but that gives only public fields) Class<?> superClass = clazz.getSuperclass(); if (superClass != null) { return getField(fieldName, superClass); } } return field; }
java
public static Field getField(String fieldName, Class<?> clazz) { Field field = null; try { field = clazz.getDeclaredField(fieldName); } catch (SecurityException e) { throw LOG.unableToAccessField(field, clazz.getName()); } catch (NoSuchFieldException e) { // for some reason getDeclaredFields doesnt search superclasses // (which getFields() does ... but that gives only public fields) Class<?> superClass = clazz.getSuperclass(); if (superClass != null) { return getField(fieldName, superClass); } } return field; }
[ "public", "static", "Field", "getField", "(", "String", "fieldName", ",", "Class", "<", "?", ">", "clazz", ")", "{", "Field", "field", "=", "null", ";", "try", "{", "field", "=", "clazz", ".", "getDeclaredField", "(", "fieldName", ")", ";", "}", "catch", "(", "SecurityException", "e", ")", "{", "throw", "LOG", ".", "unableToAccessField", "(", "field", ",", "clazz", ".", "getName", "(", ")", ")", ";", "}", "catch", "(", "NoSuchFieldException", "e", ")", "{", "// for some reason getDeclaredFields doesnt search superclasses", "// (which getFields() does ... but that gives only public fields)", "Class", "<", "?", ">", "superClass", "=", "clazz", ".", "getSuperclass", "(", ")", ";", "if", "(", "superClass", "!=", "null", ")", "{", "return", "getField", "(", "fieldName", ",", "superClass", ")", ";", "}", "}", "return", "field", ";", "}" ]
Returns the field of the given class or null if it doesnt exist.
[ "Returns", "the", "field", "of", "the", "given", "class", "or", "null", "if", "it", "doesnt", "exist", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java#L222-L239
16,556
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java
ReflectUtil.getSingleSetter
public static Method getSingleSetter(String fieldName, Class<?> clazz) { String setterName = buildSetterName(fieldName); try { // Using getMathods(), getMathod(...) expects exact parameter type // matching and ignores inheritance-tree. Method[] methods = clazz.getMethods(); List<Method> candidates = new ArrayList<Method>(); Set<Class<?>> parameterTypes = new HashSet<Class<?>>(); for(Method method : methods) { if(method.getName().equals(setterName)) { Class<?>[] paramTypes = method.getParameterTypes(); if(paramTypes != null && paramTypes.length == 1) { candidates.add(method); parameterTypes.add(paramTypes[0]); } } } if (parameterTypes.size() > 1) { throw LOG.ambiguousSetterMethod(setterName, clazz.getName()); } if (candidates.size() >= 1) { return candidates.get(0); } return null; } catch (SecurityException e) { throw LOG.unableToAccessMethod(setterName, clazz.getName()); } }
java
public static Method getSingleSetter(String fieldName, Class<?> clazz) { String setterName = buildSetterName(fieldName); try { // Using getMathods(), getMathod(...) expects exact parameter type // matching and ignores inheritance-tree. Method[] methods = clazz.getMethods(); List<Method> candidates = new ArrayList<Method>(); Set<Class<?>> parameterTypes = new HashSet<Class<?>>(); for(Method method : methods) { if(method.getName().equals(setterName)) { Class<?>[] paramTypes = method.getParameterTypes(); if(paramTypes != null && paramTypes.length == 1) { candidates.add(method); parameterTypes.add(paramTypes[0]); } } } if (parameterTypes.size() > 1) { throw LOG.ambiguousSetterMethod(setterName, clazz.getName()); } if (candidates.size() >= 1) { return candidates.get(0); } return null; } catch (SecurityException e) { throw LOG.unableToAccessMethod(setterName, clazz.getName()); } }
[ "public", "static", "Method", "getSingleSetter", "(", "String", "fieldName", ",", "Class", "<", "?", ">", "clazz", ")", "{", "String", "setterName", "=", "buildSetterName", "(", "fieldName", ")", ";", "try", "{", "// Using getMathods(), getMathod(...) expects exact parameter type", "// matching and ignores inheritance-tree.", "Method", "[", "]", "methods", "=", "clazz", ".", "getMethods", "(", ")", ";", "List", "<", "Method", ">", "candidates", "=", "new", "ArrayList", "<", "Method", ">", "(", ")", ";", "Set", "<", "Class", "<", "?", ">", ">", "parameterTypes", "=", "new", "HashSet", "<", "Class", "<", "?", ">", ">", "(", ")", ";", "for", "(", "Method", "method", ":", "methods", ")", "{", "if", "(", "method", ".", "getName", "(", ")", ".", "equals", "(", "setterName", ")", ")", "{", "Class", "<", "?", ">", "[", "]", "paramTypes", "=", "method", ".", "getParameterTypes", "(", ")", ";", "if", "(", "paramTypes", "!=", "null", "&&", "paramTypes", ".", "length", "==", "1", ")", "{", "candidates", ".", "add", "(", "method", ")", ";", "parameterTypes", ".", "add", "(", "paramTypes", "[", "0", "]", ")", ";", "}", "}", "}", "if", "(", "parameterTypes", ".", "size", "(", ")", ">", "1", ")", "{", "throw", "LOG", ".", "ambiguousSetterMethod", "(", "setterName", ",", "clazz", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "candidates", ".", "size", "(", ")", ">=", "1", ")", "{", "return", "candidates", ".", "get", "(", "0", ")", ";", "}", "return", "null", ";", "}", "catch", "(", "SecurityException", "e", ")", "{", "throw", "LOG", ".", "unableToAccessMethod", "(", "setterName", ",", "clazz", ".", "getName", "(", ")", ")", ";", "}", "}" ]
Returns a setter method based on the fieldName and the java beans setter naming convention or null if none exists. If multiple setters with different parameter types are present, an exception is thrown. If they have the same parameter type, one of those methods is returned.
[ "Returns", "a", "setter", "method", "based", "on", "the", "fieldName", "and", "the", "java", "beans", "setter", "naming", "convention", "or", "null", "if", "none", "exists", ".", "If", "multiple", "setters", "with", "different", "parameter", "types", "are", "present", "an", "exception", "is", "thrown", ".", "If", "they", "have", "the", "same", "parameter", "type", "one", "of", "those", "methods", "is", "returned", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java#L280-L311
16,557
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java
ReflectUtil.getMethod
public static Method getMethod(Class<?> declaringType, String methodName, Class<?>... parameterTypes) { return findMethod(declaringType, methodName, parameterTypes); }
java
public static Method getMethod(Class<?> declaringType, String methodName, Class<?>... parameterTypes) { return findMethod(declaringType, methodName, parameterTypes); }
[ "public", "static", "Method", "getMethod", "(", "Class", "<", "?", ">", "declaringType", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "return", "findMethod", "(", "declaringType", ",", "methodName", ",", "parameterTypes", ")", ";", "}" ]
Finds a method by name and parameter types. @param declaringType the name of the class @param methodName the name of the method to look for @param parameterTypes the types of the parameters
[ "Finds", "a", "method", "by", "name", "and", "parameter", "types", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ReflectUtil.java#L397-L399
16,558
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/externaltask/LockedExternalTaskImpl.java
LockedExternalTaskImpl.fromEntity
public static LockedExternalTaskImpl fromEntity(ExternalTaskEntity externalTaskEntity, List<String> variablesToFetch, boolean isLocal, boolean deserializeVariables) { LockedExternalTaskImpl result = new LockedExternalTaskImpl(); result.id = externalTaskEntity.getId(); result.topicName = externalTaskEntity.getTopicName(); result.workerId = externalTaskEntity.getWorkerId(); result.lockExpirationTime = externalTaskEntity.getLockExpirationTime(); 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.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); return result; }
java
public static LockedExternalTaskImpl fromEntity(ExternalTaskEntity externalTaskEntity, List<String> variablesToFetch, boolean isLocal, boolean deserializeVariables) { LockedExternalTaskImpl result = new LockedExternalTaskImpl(); result.id = externalTaskEntity.getId(); result.topicName = externalTaskEntity.getTopicName(); result.workerId = externalTaskEntity.getWorkerId(); result.lockExpirationTime = externalTaskEntity.getLockExpirationTime(); 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.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); return result; }
[ "public", "static", "LockedExternalTaskImpl", "fromEntity", "(", "ExternalTaskEntity", "externalTaskEntity", ",", "List", "<", "String", ">", "variablesToFetch", ",", "boolean", "isLocal", ",", "boolean", "deserializeVariables", ")", "{", "LockedExternalTaskImpl", "result", "=", "new", "LockedExternalTaskImpl", "(", ")", ";", "result", ".", "id", "=", "externalTaskEntity", ".", "getId", "(", ")", ";", "result", ".", "topicName", "=", "externalTaskEntity", ".", "getTopicName", "(", ")", ";", "result", ".", "workerId", "=", "externalTaskEntity", ".", "getWorkerId", "(", ")", ";", "result", ".", "lockExpirationTime", "=", "externalTaskEntity", ".", "getLockExpirationTime", "(", ")", ";", "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", ".", "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", ")", ";", "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
[ "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", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/externaltask/LockedExternalTaskImpl.java#L137-L162
16,559
camunda/camunda-bpm-platform
distro/wildfly/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/util/JBossCompatibilityExtension.java
JBossCompatibilityExtension.addServerExecutorDependency
public static void addServerExecutorDependency(ServiceBuilder<?> serviceBuilder, InjectedValue<ExecutorService> injector, boolean optional) { ServiceBuilder.DependencyType type = optional ? ServiceBuilder.DependencyType.OPTIONAL : ServiceBuilder.DependencyType.REQUIRED; serviceBuilder.addDependency(type, JBOSS_SERVER_EXECUTOR, ExecutorService.class, injector); }
java
public static void addServerExecutorDependency(ServiceBuilder<?> serviceBuilder, InjectedValue<ExecutorService> injector, boolean optional) { ServiceBuilder.DependencyType type = optional ? ServiceBuilder.DependencyType.OPTIONAL : ServiceBuilder.DependencyType.REQUIRED; serviceBuilder.addDependency(type, JBOSS_SERVER_EXECUTOR, ExecutorService.class, injector); }
[ "public", "static", "void", "addServerExecutorDependency", "(", "ServiceBuilder", "<", "?", ">", "serviceBuilder", ",", "InjectedValue", "<", "ExecutorService", ">", "injector", ",", "boolean", "optional", ")", "{", "ServiceBuilder", ".", "DependencyType", "type", "=", "optional", "?", "ServiceBuilder", ".", "DependencyType", ".", "OPTIONAL", ":", "ServiceBuilder", ".", "DependencyType", ".", "REQUIRED", ";", "serviceBuilder", ".", "addDependency", "(", "type", ",", "JBOSS_SERVER_EXECUTOR", ",", "ExecutorService", ".", "class", ",", "injector", ")", ";", "}" ]
Adds the JBoss server executor as a dependency to the given service. Copied from org.jboss.as.server.Services - JBoss 7.2.0.Final
[ "Adds", "the", "JBoss", "server", "executor", "as", "a", "dependency", "to", "the", "given", "service", ".", "Copied", "from", "org", ".", "jboss", ".", "as", ".", "server", ".", "Services", "-", "JBoss", "7", ".", "2", ".", "0", ".", "Final" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/distro/wildfly/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/util/JBossCompatibilityExtension.java#L47-L50
16,560
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/cfg/ProcessEngineConfigurationImpl.java
ProcessEngineConfigurationImpl.checkForMariaDb
protected String checkForMariaDb(DatabaseMetaData databaseMetaData, String databaseName) { try { String databaseProductVersion = databaseMetaData.getDatabaseProductVersion(); if (databaseProductVersion != null && databaseProductVersion.toLowerCase().contains("mariadb")) { return MARIA_DB_PRODUCT_NAME; } } catch (SQLException ignore) { } try { String driverName = databaseMetaData.getDriverName(); if (driverName != null && driverName.toLowerCase().contains("mariadb")) { return MARIA_DB_PRODUCT_NAME; } } catch (SQLException ignore) { } String metaDataClassName = databaseMetaData.getClass().getName(); if (metaDataClassName != null && metaDataClassName.toLowerCase().contains("mariadb")) { return MARIA_DB_PRODUCT_NAME; } return databaseName; }
java
protected String checkForMariaDb(DatabaseMetaData databaseMetaData, String databaseName) { try { String databaseProductVersion = databaseMetaData.getDatabaseProductVersion(); if (databaseProductVersion != null && databaseProductVersion.toLowerCase().contains("mariadb")) { return MARIA_DB_PRODUCT_NAME; } } catch (SQLException ignore) { } try { String driverName = databaseMetaData.getDriverName(); if (driverName != null && driverName.toLowerCase().contains("mariadb")) { return MARIA_DB_PRODUCT_NAME; } } catch (SQLException ignore) { } String metaDataClassName = databaseMetaData.getClass().getName(); if (metaDataClassName != null && metaDataClassName.toLowerCase().contains("mariadb")) { return MARIA_DB_PRODUCT_NAME; } return databaseName; }
[ "protected", "String", "checkForMariaDb", "(", "DatabaseMetaData", "databaseMetaData", ",", "String", "databaseName", ")", "{", "try", "{", "String", "databaseProductVersion", "=", "databaseMetaData", ".", "getDatabaseProductVersion", "(", ")", ";", "if", "(", "databaseProductVersion", "!=", "null", "&&", "databaseProductVersion", ".", "toLowerCase", "(", ")", ".", "contains", "(", "\"mariadb\"", ")", ")", "{", "return", "MARIA_DB_PRODUCT_NAME", ";", "}", "}", "catch", "(", "SQLException", "ignore", ")", "{", "}", "try", "{", "String", "driverName", "=", "databaseMetaData", ".", "getDriverName", "(", ")", ";", "if", "(", "driverName", "!=", "null", "&&", "driverName", ".", "toLowerCase", "(", ")", ".", "contains", "(", "\"mariadb\"", ")", ")", "{", "return", "MARIA_DB_PRODUCT_NAME", ";", "}", "}", "catch", "(", "SQLException", "ignore", ")", "{", "}", "String", "metaDataClassName", "=", "databaseMetaData", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "if", "(", "metaDataClassName", "!=", "null", "&&", "metaDataClassName", ".", "toLowerCase", "(", ")", ".", "contains", "(", "\"mariadb\"", ")", ")", "{", "return", "MARIA_DB_PRODUCT_NAME", ";", "}", "return", "databaseName", ";", "}" ]
The product name of mariadb is still 'MySQL'. This method tries if it can find some evidence for mariadb. If it is successful it will return "MariaDB", otherwise the provided database name.
[ "The", "product", "name", "of", "mariadb", "is", "still", "MySQL", ".", "This", "method", "tries", "if", "it", "can", "find", "some", "evidence", "for", "mariadb", ".", "If", "it", "is", "successful", "it", "will", "return", "MariaDB", "otherwise", "the", "provided", "database", "name", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L1353-L1376
16,561
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/cfg/ProcessEngineConfigurationImpl.java
ProcessEngineConfigurationImpl.ensurePrefixAndSchemaFitToegether
protected void ensurePrefixAndSchemaFitToegether(String prefix, String schema) { if (schema == null) { return; } else if (prefix == null || (prefix != null && !prefix.startsWith(schema + "."))) { throw new ProcessEngineException("When setting a schema the prefix has to be schema + '.'. Received schema: " + schema + " prefix: " + prefix); } }
java
protected void ensurePrefixAndSchemaFitToegether(String prefix, String schema) { if (schema == null) { return; } else if (prefix == null || (prefix != null && !prefix.startsWith(schema + "."))) { throw new ProcessEngineException("When setting a schema the prefix has to be schema + '.'. Received schema: " + schema + " prefix: " + prefix); } }
[ "protected", "void", "ensurePrefixAndSchemaFitToegether", "(", "String", "prefix", ",", "String", "schema", ")", "{", "if", "(", "schema", "==", "null", ")", "{", "return", ";", "}", "else", "if", "(", "prefix", "==", "null", "||", "(", "prefix", "!=", "null", "&&", "!", "prefix", ".", "startsWith", "(", "schema", "+", "\".\"", ")", ")", ")", "{", "throw", "new", "ProcessEngineException", "(", "\"When setting a schema the prefix has to be schema + '.'. Received schema: \"", "+", "schema", "+", "\" prefix: \"", "+", "prefix", ")", ";", "}", "}" ]
When providing a schema and a prefix the prefix has to be the schema ending with a dot.
[ "When", "providing", "a", "schema", "and", "a", "prefix", "the", "prefix", "has", "to", "be", "the", "schema", "ending", "with", "a", "dot", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L1677-L1683
16,562
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/ExternalTaskActivityBehavior.java
ExternalTaskActivityBehavior.propagateBpmnError
@Override public void propagateBpmnError(BpmnError error, ActivityExecution execution) throws Exception { super.propagateBpmnError(error, execution); }
java
@Override public void propagateBpmnError(BpmnError error, ActivityExecution execution) throws Exception { super.propagateBpmnError(error, execution); }
[ "@", "Override", "public", "void", "propagateBpmnError", "(", "BpmnError", "error", ",", "ActivityExecution", "execution", ")", "throws", "Exception", "{", "super", ".", "propagateBpmnError", "(", "error", ",", "execution", ")", ";", "}" ]
Overrides the propagateBpmnError method to made it public. Is used to propagate the bpmn error from an external task. @param error the error which should be propagated @param execution the current activity execution @throws Exception throwsn an exception if no handler was found
[ "Overrides", "the", "propagateBpmnError", "method", "to", "made", "it", "public", ".", "Is", "used", "to", "propagate", "the", "bpmn", "error", "from", "an", "external", "task", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/ExternalTaskActivityBehavior.java#L76-L79
16,563
camunda/camunda-bpm-platform
engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java
BusinessProcess.associateExecutionById
public void associateExecutionById(String executionId) { Execution execution = processEngine.getRuntimeService() .createExecutionQuery() .executionId(executionId) .singleResult(); if(execution == null) { throw new ProcessEngineCdiException("Cannot associate execution by id: no execution with id '"+executionId+"' found."); } associationManager.setExecution(execution); }
java
public void associateExecutionById(String executionId) { Execution execution = processEngine.getRuntimeService() .createExecutionQuery() .executionId(executionId) .singleResult(); if(execution == null) { throw new ProcessEngineCdiException("Cannot associate execution by id: no execution with id '"+executionId+"' found."); } associationManager.setExecution(execution); }
[ "public", "void", "associateExecutionById", "(", "String", "executionId", ")", "{", "Execution", "execution", "=", "processEngine", ".", "getRuntimeService", "(", ")", ".", "createExecutionQuery", "(", ")", ".", "executionId", "(", "executionId", ")", ".", "singleResult", "(", ")", ";", "if", "(", "execution", "==", "null", ")", "{", "throw", "new", "ProcessEngineCdiException", "(", "\"Cannot associate execution by id: no execution with id '\"", "+", "executionId", "+", "\"' found.\"", ")", ";", "}", "associationManager", ".", "setExecution", "(", "execution", ")", ";", "}" ]
Associate with the provided execution. This starts a unit of work. @param executionId the id of the execution to associate with. @throw ProcessEngineCdiException if no such execution exists
[ "Associate", "with", "the", "provided", "execution", ".", "This", "starts", "a", "unit", "of", "work", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java#L228-L237
16,564
camunda/camunda-bpm-platform
engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java
BusinessProcess.saveTask
public void saveTask() { assertCommandContextNotActive(); assertTaskAssociated(); final Task task = getTask(); // save the task processEngine.getTaskService().saveTask(task); }
java
public void saveTask() { assertCommandContextNotActive(); assertTaskAssociated(); final Task task = getTask(); // save the task processEngine.getTaskService().saveTask(task); }
[ "public", "void", "saveTask", "(", ")", "{", "assertCommandContextNotActive", "(", ")", ";", "assertTaskAssociated", "(", ")", ";", "final", "Task", "task", "=", "getTask", "(", ")", ";", "// save the task", "processEngine", ".", "getTaskService", "(", ")", ".", "saveTask", "(", "task", ")", ";", "}" ]
Save the currently associated task. @throws ProcessEngineCdiException if called from a process engine command or if no Task is currently associated.
[ "Save", "the", "currently", "associated", "task", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java#L365-L372
16,565
camunda/camunda-bpm-platform
engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java
BusinessProcess.getProcessInstanceId
public String getProcessInstanceId() { Execution execution = associationManager.getExecution(); return execution != null ? execution.getProcessInstanceId() : null; }
java
public String getProcessInstanceId() { Execution execution = associationManager.getExecution(); return execution != null ? execution.getProcessInstanceId() : null; }
[ "public", "String", "getProcessInstanceId", "(", ")", "{", "Execution", "execution", "=", "associationManager", ".", "getExecution", "(", ")", ";", "return", "execution", "!=", "null", "?", "execution", ".", "getProcessInstanceId", "(", ")", ":", "null", ";", "}" ]
Returns the id of the currently associated process instance or 'null'
[ "Returns", "the", "id", "of", "the", "currently", "associated", "process", "instance", "or", "null" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java#L673-L676
16,566
camunda/camunda-bpm-platform
engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java
BusinessProcess.getTaskId
public String getTaskId() { Task task = getTask(); return task != null ? task.getId() : null; }
java
public String getTaskId() { Task task = getTask(); return task != null ? task.getId() : null; }
[ "public", "String", "getTaskId", "(", ")", "{", "Task", "task", "=", "getTask", "(", ")", ";", "return", "task", "!=", "null", "?", "task", ".", "getId", "(", ")", ":", "null", ";", "}" ]
Returns the id of the task associated with the current conversation or 'null'.
[ "Returns", "the", "id", "of", "the", "task", "associated", "with", "the", "current", "conversation", "or", "null", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java#L681-L684
16,567
camunda/camunda-bpm-platform
engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/sub/task/impl/TaskResourceImpl.java
TaskResourceImpl.getTaskById
protected Task getTaskById(String id) { return engine.getTaskService().createTaskQuery().taskId(id).initializeFormKeys().singleResult(); }
java
protected Task getTaskById(String id) { return engine.getTaskService().createTaskQuery().taskId(id).initializeFormKeys().singleResult(); }
[ "protected", "Task", "getTaskById", "(", "String", "id", ")", "{", "return", "engine", ".", "getTaskService", "(", ")", ".", "createTaskQuery", "(", ")", ".", "taskId", "(", "id", ")", ".", "initializeFormKeys", "(", ")", ".", "singleResult", "(", ")", ";", "}" ]
Returns the task with the given id @param id @return
[ "Returns", "the", "task", "with", "the", "given", "id" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/sub/task/impl/TaskResourceImpl.java#L286-L288
16,568
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExternalTaskEntity.java
ExternalTaskEntity.failed
public void failed(String errorMessage, String errorDetails, int retries, long retryDuration) { ensureActive(); this.setErrorMessage(errorMessage); if (errorDetails != null) { setErrorDetails(errorDetails); } this.lockExpirationTime = new Date(ClockUtil.getCurrentTime().getTime() + retryDuration); setRetriesAndManageIncidents(retries); produceHistoricExternalTaskFailedEvent(); }
java
public void failed(String errorMessage, String errorDetails, int retries, long retryDuration) { ensureActive(); this.setErrorMessage(errorMessage); if (errorDetails != null) { setErrorDetails(errorDetails); } this.lockExpirationTime = new Date(ClockUtil.getCurrentTime().getTime() + retryDuration); setRetriesAndManageIncidents(retries); produceHistoricExternalTaskFailedEvent(); }
[ "public", "void", "failed", "(", "String", "errorMessage", ",", "String", "errorDetails", ",", "int", "retries", ",", "long", "retryDuration", ")", "{", "ensureActive", "(", ")", ";", "this", ".", "setErrorMessage", "(", "errorMessage", ")", ";", "if", "(", "errorDetails", "!=", "null", ")", "{", "setErrorDetails", "(", "errorDetails", ")", ";", "}", "this", ".", "lockExpirationTime", "=", "new", "Date", "(", "ClockUtil", ".", "getCurrentTime", "(", ")", ".", "getTime", "(", ")", "+", "retryDuration", ")", ";", "setRetriesAndManageIncidents", "(", "retries", ")", ";", "produceHistoricExternalTaskFailedEvent", "(", ")", ";", "}" ]
process failed state, make sure that binary entity is created for the errorMessage, shortError message does not exceed limit, handle properly retry counts and incidents @param errorMessage - short error message text @param errorDetails - full error details @param retries - updated value of retries left @param retryDuration - used for lockExpirationTime calculation
[ "process", "failed", "state", "make", "sure", "that", "binary", "entity", "is", "created", "for", "the", "errorMessage", "shortError", "message", "does", "not", "exceed", "limit", "handle", "properly", "retry", "counts", "and", "incidents" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExternalTaskEntity.java#L361-L371
16,569
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/operation/DbOperationManager.java
DbOperationManager.addSortedModifications
protected void addSortedModifications(List<DbOperation> flush) { // calculate sorted set of all modified entity types SortedSet<Class<?>> modifiedEntityTypes = new TreeSet<Class<?>>(MODIFICATION_TYPE_COMPARATOR); modifiedEntityTypes.addAll(updates.keySet()); modifiedEntityTypes.addAll(deletes.keySet()); modifiedEntityTypes.addAll(bulkOperations.keySet()); for (Class<?> type : modifiedEntityTypes) { // first perform entity UPDATES addSortedModificationsForType(type, updates.get(type), flush); // next perform entity DELETES addSortedModificationsForType(type, deletes.get(type), flush); // last perform bulk operations SortedSet<DbBulkOperation> bulkOperationsForType = bulkOperations.get(type); if(bulkOperationsForType != null) { flush.addAll(bulkOperationsForType); } } //the very last perform bulk operations for which the order is important if(bulkOperationsInsertionOrder != null) { flush.addAll(bulkOperationsInsertionOrder); } }
java
protected void addSortedModifications(List<DbOperation> flush) { // calculate sorted set of all modified entity types SortedSet<Class<?>> modifiedEntityTypes = new TreeSet<Class<?>>(MODIFICATION_TYPE_COMPARATOR); modifiedEntityTypes.addAll(updates.keySet()); modifiedEntityTypes.addAll(deletes.keySet()); modifiedEntityTypes.addAll(bulkOperations.keySet()); for (Class<?> type : modifiedEntityTypes) { // first perform entity UPDATES addSortedModificationsForType(type, updates.get(type), flush); // next perform entity DELETES addSortedModificationsForType(type, deletes.get(type), flush); // last perform bulk operations SortedSet<DbBulkOperation> bulkOperationsForType = bulkOperations.get(type); if(bulkOperationsForType != null) { flush.addAll(bulkOperationsForType); } } //the very last perform bulk operations for which the order is important if(bulkOperationsInsertionOrder != null) { flush.addAll(bulkOperationsInsertionOrder); } }
[ "protected", "void", "addSortedModifications", "(", "List", "<", "DbOperation", ">", "flush", ")", "{", "// calculate sorted set of all modified entity types", "SortedSet", "<", "Class", "<", "?", ">", ">", "modifiedEntityTypes", "=", "new", "TreeSet", "<", "Class", "<", "?", ">", ">", "(", "MODIFICATION_TYPE_COMPARATOR", ")", ";", "modifiedEntityTypes", ".", "addAll", "(", "updates", ".", "keySet", "(", ")", ")", ";", "modifiedEntityTypes", ".", "addAll", "(", "deletes", ".", "keySet", "(", ")", ")", ";", "modifiedEntityTypes", ".", "addAll", "(", "bulkOperations", ".", "keySet", "(", ")", ")", ";", "for", "(", "Class", "<", "?", ">", "type", ":", "modifiedEntityTypes", ")", "{", "// first perform entity UPDATES", "addSortedModificationsForType", "(", "type", ",", "updates", ".", "get", "(", "type", ")", ",", "flush", ")", ";", "// next perform entity DELETES", "addSortedModificationsForType", "(", "type", ",", "deletes", ".", "get", "(", "type", ")", ",", "flush", ")", ";", "// last perform bulk operations", "SortedSet", "<", "DbBulkOperation", ">", "bulkOperationsForType", "=", "bulkOperations", ".", "get", "(", "type", ")", ";", "if", "(", "bulkOperationsForType", "!=", "null", ")", "{", "flush", ".", "addAll", "(", "bulkOperationsForType", ")", ";", "}", "}", "//the very last perform bulk operations for which the order is important", "if", "(", "bulkOperationsInsertionOrder", "!=", "null", ")", "{", "flush", ".", "addAll", "(", "bulkOperationsInsertionOrder", ")", ";", "}", "}" ]
Adds a correctly ordered list of UPDATE and DELETE operations to the flush. @param flush
[ "Adds", "a", "correctly", "ordered", "list", "of", "UPDATE", "and", "DELETE", "operations", "to", "the", "flush", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/operation/DbOperationManager.java#L156-L180
16,570
camunda/camunda-bpm-platform
engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/hal/HalLinker.java
HalLinker.createLink
public void createLink(HalRelation rel, String... pathParams) { if(pathParams != null && pathParams.length > 0 && pathParams[0] != null) { Set<String> linkedResourceIds = linkedResources.get(rel); if(linkedResourceIds == null) { linkedResourceIds = new HashSet<String>(); linkedResources.put(rel, linkedResourceIds); } // Hmm... use the last id in the pathParams as linked resource id linkedResourceIds.add(pathParams[pathParams.length - 1]); resource.addLink(rel.relName, rel.uriTemplate.build((Object[])pathParams)); } }
java
public void createLink(HalRelation rel, String... pathParams) { if(pathParams != null && pathParams.length > 0 && pathParams[0] != null) { Set<String> linkedResourceIds = linkedResources.get(rel); if(linkedResourceIds == null) { linkedResourceIds = new HashSet<String>(); linkedResources.put(rel, linkedResourceIds); } // Hmm... use the last id in the pathParams as linked resource id linkedResourceIds.add(pathParams[pathParams.length - 1]); resource.addLink(rel.relName, rel.uriTemplate.build((Object[])pathParams)); } }
[ "public", "void", "createLink", "(", "HalRelation", "rel", ",", "String", "...", "pathParams", ")", "{", "if", "(", "pathParams", "!=", "null", "&&", "pathParams", ".", "length", ">", "0", "&&", "pathParams", "[", "0", "]", "!=", "null", ")", "{", "Set", "<", "String", ">", "linkedResourceIds", "=", "linkedResources", ".", "get", "(", "rel", ")", ";", "if", "(", "linkedResourceIds", "==", "null", ")", "{", "linkedResourceIds", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "linkedResources", ".", "put", "(", "rel", ",", "linkedResourceIds", ")", ";", "}", "// Hmm... use the last id in the pathParams as linked resource id", "linkedResourceIds", ".", "add", "(", "pathParams", "[", "pathParams", ".", "length", "-", "1", "]", ")", ";", "resource", ".", "addLink", "(", "rel", ".", "relName", ",", "rel", ".", "uriTemplate", ".", "build", "(", "(", "Object", "[", "]", ")", "pathParams", ")", ")", ";", "}", "}" ]
Creates a link in a given relation. @param rel the {@link HalRelation} for which a link should be constructed @param pathParams the path params to populate the url template with.
[ "Creates", "a", "link", "in", "a", "given", "relation", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/hal/HalLinker.java#L55-L68
16,571
camunda/camunda-bpm-platform
engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/hal/HalLinker.java
HalLinker.resolve
public List<HalResource<?>> resolve(HalRelation relation, ProcessEngine processEngine) { HalLinkResolver linkResolver = hal.getLinkResolver(relation.resourceType); if(linkResolver != null) { Set<String> linkedIds = getLinkedResourceIdsByRelation(relation); if(!linkedIds.isEmpty()) { return linkResolver.resolveLinks(linkedIds.toArray(new String[linkedIds.size()]), processEngine); } else { return Collections.emptyList(); } } else { throw new RuntimeException("Cannot find HAL link resolver for resource type '"+relation.resourceType+"'."); } }
java
public List<HalResource<?>> resolve(HalRelation relation, ProcessEngine processEngine) { HalLinkResolver linkResolver = hal.getLinkResolver(relation.resourceType); if(linkResolver != null) { Set<String> linkedIds = getLinkedResourceIdsByRelation(relation); if(!linkedIds.isEmpty()) { return linkResolver.resolveLinks(linkedIds.toArray(new String[linkedIds.size()]), processEngine); } else { return Collections.emptyList(); } } else { throw new RuntimeException("Cannot find HAL link resolver for resource type '"+relation.resourceType+"'."); } }
[ "public", "List", "<", "HalResource", "<", "?", ">", ">", "resolve", "(", "HalRelation", "relation", ",", "ProcessEngine", "processEngine", ")", "{", "HalLinkResolver", "linkResolver", "=", "hal", ".", "getLinkResolver", "(", "relation", ".", "resourceType", ")", ";", "if", "(", "linkResolver", "!=", "null", ")", "{", "Set", "<", "String", ">", "linkedIds", "=", "getLinkedResourceIdsByRelation", "(", "relation", ")", ";", "if", "(", "!", "linkedIds", ".", "isEmpty", "(", ")", ")", "{", "return", "linkResolver", ".", "resolveLinks", "(", "linkedIds", ".", "toArray", "(", "new", "String", "[", "linkedIds", ".", "size", "(", ")", "]", ")", ",", "processEngine", ")", ";", "}", "else", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "}", "else", "{", "throw", "new", "RuntimeException", "(", "\"Cannot find HAL link resolver for resource type '\"", "+", "relation", ".", "resourceType", "+", "\"'.\"", ")", ";", "}", "}" ]
Resolves a relation. Locates a HalLinkResolver for resolving the set of all linked resources in the relation. @param relation the relation to resolve @param processEngine the process engine to use @return the list of resolved resources @throws RuntimeException if no HalLinkResolver can be found for the linked resource type.
[ "Resolves", "a", "relation", ".", "Locates", "a", "HalLinkResolver", "for", "resolving", "the", "set", "of", "all", "linked", "resources", "in", "the", "relation", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/hal/HalLinker.java#L91-L103
16,572
camunda/camunda-bpm-platform
engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/hal/HalLinker.java
HalLinker.mergeLinks
public void mergeLinks(HalResource<?> embedded) { for (Entry<HalRelation, Set<String>> linkentry : embedded.linker.linkedResources.entrySet()) { Set<String> linkedIdSet = linkedResources.get(linkentry.getKey()); if(linkedIdSet != null) { linkedIdSet.addAll(linkentry.getValue()); }else { linkedResources.put(linkentry.getKey(), linkentry.getValue()); } } }
java
public void mergeLinks(HalResource<?> embedded) { for (Entry<HalRelation, Set<String>> linkentry : embedded.linker.linkedResources.entrySet()) { Set<String> linkedIdSet = linkedResources.get(linkentry.getKey()); if(linkedIdSet != null) { linkedIdSet.addAll(linkentry.getValue()); }else { linkedResources.put(linkentry.getKey(), linkentry.getValue()); } } }
[ "public", "void", "mergeLinks", "(", "HalResource", "<", "?", ">", "embedded", ")", "{", "for", "(", "Entry", "<", "HalRelation", ",", "Set", "<", "String", ">", ">", "linkentry", ":", "embedded", ".", "linker", ".", "linkedResources", ".", "entrySet", "(", ")", ")", "{", "Set", "<", "String", ">", "linkedIdSet", "=", "linkedResources", ".", "get", "(", "linkentry", ".", "getKey", "(", ")", ")", ";", "if", "(", "linkedIdSet", "!=", "null", ")", "{", "linkedIdSet", ".", "addAll", "(", "linkentry", ".", "getValue", "(", ")", ")", ";", "}", "else", "{", "linkedResources", ".", "put", "(", "linkentry", ".", "getKey", "(", ")", ",", "linkentry", ".", "getValue", "(", ")", ")", ";", "}", "}", "}" ]
merge the links of an embedded resource into this linker. This is useful when building resources which are actually resource collections. You can then merge the relations of all resources in the collection and the unique the set of linked resources to embed. @param embedded the embedded resource for which the links should be merged into this linker.
[ "merge", "the", "links", "of", "an", "embedded", "resource", "into", "this", "linker", ".", "This", "is", "useful", "when", "building", "resources", "which", "are", "actually", "resource", "collections", ".", "You", "can", "then", "merge", "the", "relations", "of", "all", "resources", "in", "the", "collection", "and", "the", "unique", "the", "set", "of", "linked", "resources", "to", "embed", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/hal/HalLinker.java#L112-L121
16,573
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/ActivityExecutionTreeMapping.java
ActivityExecutionTreeMapping.isLeaf
protected boolean isLeaf(ExecutionEntity execution) { if (CompensationBehavior.isCompensationThrowing(execution)) { return true; } else { return !execution.isEventScope() && execution.getNonEventScopeExecutions().isEmpty(); } }
java
protected boolean isLeaf(ExecutionEntity execution) { if (CompensationBehavior.isCompensationThrowing(execution)) { return true; } else { return !execution.isEventScope() && execution.getNonEventScopeExecutions().isEmpty(); } }
[ "protected", "boolean", "isLeaf", "(", "ExecutionEntity", "execution", ")", "{", "if", "(", "CompensationBehavior", ".", "isCompensationThrowing", "(", "execution", ")", ")", "{", "return", "true", ";", "}", "else", "{", "return", "!", "execution", ".", "isEventScope", "(", ")", "&&", "execution", ".", "getNonEventScopeExecutions", "(", ")", ".", "isEmpty", "(", ")", ";", "}", "}" ]
event-scope executions are not considered in this mapping and must be ignored
[ "event", "-", "scope", "executions", "are", "not", "considered", "in", "this", "mapping", "and", "must", "be", "ignored" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/ActivityExecutionTreeMapping.java#L169-L176
16,574
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/StringUtil.java
StringUtil.toByteArray
public static byte[] toByteArray(String string) { EnsureUtil.ensureActiveCommandContext("StringUtil.toByteArray"); ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); return toByteArray(string, processEngineConfiguration.getProcessEngine()); }
java
public static byte[] toByteArray(String string) { EnsureUtil.ensureActiveCommandContext("StringUtil.toByteArray"); ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); return toByteArray(string, processEngineConfiguration.getProcessEngine()); }
[ "public", "static", "byte", "[", "]", "toByteArray", "(", "String", "string", ")", "{", "EnsureUtil", ".", "ensureActiveCommandContext", "(", "\"StringUtil.toByteArray\"", ")", ";", "ProcessEngineConfigurationImpl", "processEngineConfiguration", "=", "Context", ".", "getProcessEngineConfiguration", "(", ")", ";", "return", "toByteArray", "(", "string", ",", "processEngineConfiguration", ".", "getProcessEngine", "(", ")", ")", ";", "}" ]
Gets the bytes from a string using the current process engine's default charset @param string the string to get the bytes form @return the byte array
[ "Gets", "the", "bytes", "from", "a", "string", "using", "the", "current", "process", "engine", "s", "default", "charset" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/StringUtil.java#L151-L155
16,575
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/StringUtil.java
StringUtil.toByteArray
public static byte[] toByteArray(String string, ProcessEngine processEngine) { ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration(); Charset charset = processEngineConfiguration.getDefaultCharset(); return string.getBytes(charset); }
java
public static byte[] toByteArray(String string, ProcessEngine processEngine) { ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration(); Charset charset = processEngineConfiguration.getDefaultCharset(); return string.getBytes(charset); }
[ "public", "static", "byte", "[", "]", "toByteArray", "(", "String", "string", ",", "ProcessEngine", "processEngine", ")", "{", "ProcessEngineConfigurationImpl", "processEngineConfiguration", "=", "(", "(", "ProcessEngineImpl", ")", "processEngine", ")", ".", "getProcessEngineConfiguration", "(", ")", ";", "Charset", "charset", "=", "processEngineConfiguration", ".", "getDefaultCharset", "(", ")", ";", "return", "string", ".", "getBytes", "(", "charset", ")", ";", "}" ]
Gets the bytes from a string using the provided process engine's default charset @param string the string to get the bytes form @param processEngine the process engine to use @return the byte array
[ "Gets", "the", "bytes", "from", "a", "string", "using", "the", "provided", "process", "engine", "s", "default", "charset" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/StringUtil.java#L164-L168
16,576
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/ExceptionUtil.java
ExceptionUtil.createExceptionByteArray
public static ByteArrayEntity createExceptionByteArray(String name, byte[] byteArray, ResourceType type) { ByteArrayEntity result = null; if (byteArray != null) { result = new ByteArrayEntity(name, byteArray, type); Context.getCommandContext() .getByteArrayManager() .insertByteArray(result); } return result; }
java
public static ByteArrayEntity createExceptionByteArray(String name, byte[] byteArray, ResourceType type) { ByteArrayEntity result = null; if (byteArray != null) { result = new ByteArrayEntity(name, byteArray, type); Context.getCommandContext() .getByteArrayManager() .insertByteArray(result); } return result; }
[ "public", "static", "ByteArrayEntity", "createExceptionByteArray", "(", "String", "name", ",", "byte", "[", "]", "byteArray", ",", "ResourceType", "type", ")", "{", "ByteArrayEntity", "result", "=", "null", ";", "if", "(", "byteArray", "!=", "null", ")", "{", "result", "=", "new", "ByteArrayEntity", "(", "name", ",", "byteArray", ",", "type", ")", ";", "Context", ".", "getCommandContext", "(", ")", ".", "getByteArrayManager", "(", ")", ".", "insertByteArray", "(", "result", ")", ";", "}", "return", "result", ";", "}" ]
create ByteArrayEntity with specified name and payload and make sure it's persisted used in Jobs and ExternalTasks @param name - type\source of the exception @param byteArray - payload of the exception @param type - resource type of the exception @return persisted entity
[ "create", "ByteArrayEntity", "with", "specified", "name", "and", "payload", "and", "make", "sure", "it", "s", "persisted" ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ExceptionUtil.java#L66-L77
16,577
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/dmn/entity/repository/DecisionDefinitionEntity.java
DecisionDefinitionEntity.updateModifiableFieldsFromEntity
@Override public void updateModifiableFieldsFromEntity(DecisionDefinitionEntity updatingDecisionDefinition) { if (this.key.equals(updatingDecisionDefinition.key) && this.deploymentId.equals(updatingDecisionDefinition.deploymentId)) { this.revision = updatingDecisionDefinition.revision; this.historyTimeToLive = updatingDecisionDefinition.historyTimeToLive; } else { LOG.logUpdateUnrelatedDecisionDefinitionEntity(this.key, updatingDecisionDefinition.key, this.deploymentId, updatingDecisionDefinition.deploymentId); } }
java
@Override public void updateModifiableFieldsFromEntity(DecisionDefinitionEntity updatingDecisionDefinition) { if (this.key.equals(updatingDecisionDefinition.key) && this.deploymentId.equals(updatingDecisionDefinition.deploymentId)) { this.revision = updatingDecisionDefinition.revision; this.historyTimeToLive = updatingDecisionDefinition.historyTimeToLive; } else { LOG.logUpdateUnrelatedDecisionDefinitionEntity(this.key, updatingDecisionDefinition.key, this.deploymentId, updatingDecisionDefinition.deploymentId); } }
[ "@", "Override", "public", "void", "updateModifiableFieldsFromEntity", "(", "DecisionDefinitionEntity", "updatingDecisionDefinition", ")", "{", "if", "(", "this", ".", "key", ".", "equals", "(", "updatingDecisionDefinition", ".", "key", ")", "&&", "this", ".", "deploymentId", ".", "equals", "(", "updatingDecisionDefinition", ".", "deploymentId", ")", ")", "{", "this", ".", "revision", "=", "updatingDecisionDefinition", ".", "revision", ";", "this", ".", "historyTimeToLive", "=", "updatingDecisionDefinition", ".", "historyTimeToLive", ";", "}", "else", "{", "LOG", ".", "logUpdateUnrelatedDecisionDefinitionEntity", "(", "this", ".", "key", ",", "updatingDecisionDefinition", ".", "key", ",", "this", ".", "deploymentId", ",", "updatingDecisionDefinition", ".", "deploymentId", ")", ";", "}", "}" ]
Updates all modifiable fields from another decision definition entity. @param updatingDecisionDefinition
[ "Updates", "all", "modifiable", "fields", "from", "another", "decision", "definition", "entity", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/dmn/entity/repository/DecisionDefinitionEntity.java#L182-L190
16,578
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/migration/MigrateProcessInstanceCmd.java
MigrateProcessInstanceCmd.migrateProcessInstance
protected void migrateProcessInstance(MigratingProcessInstance migratingProcessInstance) { MigratingActivityInstance rootActivityInstance = migratingProcessInstance.getRootInstance(); MigratingProcessElementInstanceTopDownWalker walker = new MigratingProcessElementInstanceTopDownWalker(rootActivityInstance); walker.addPreVisitor( new MigratingActivityInstanceVisitor( executionBuilder.isSkipCustomListeners(), executionBuilder.isSkipIoMappings())); walker.addPreVisitor(new MigrationCompensationInstanceVisitor()); walker.walkUntil(); }
java
protected void migrateProcessInstance(MigratingProcessInstance migratingProcessInstance) { MigratingActivityInstance rootActivityInstance = migratingProcessInstance.getRootInstance(); MigratingProcessElementInstanceTopDownWalker walker = new MigratingProcessElementInstanceTopDownWalker(rootActivityInstance); walker.addPreVisitor( new MigratingActivityInstanceVisitor( executionBuilder.isSkipCustomListeners(), executionBuilder.isSkipIoMappings())); walker.addPreVisitor(new MigrationCompensationInstanceVisitor()); walker.walkUntil(); }
[ "protected", "void", "migrateProcessInstance", "(", "MigratingProcessInstance", "migratingProcessInstance", ")", "{", "MigratingActivityInstance", "rootActivityInstance", "=", "migratingProcessInstance", ".", "getRootInstance", "(", ")", ";", "MigratingProcessElementInstanceTopDownWalker", "walker", "=", "new", "MigratingProcessElementInstanceTopDownWalker", "(", "rootActivityInstance", ")", ";", "walker", ".", "addPreVisitor", "(", "new", "MigratingActivityInstanceVisitor", "(", "executionBuilder", ".", "isSkipCustomListeners", "(", ")", ",", "executionBuilder", ".", "isSkipIoMappings", "(", ")", ")", ")", ";", "walker", ".", "addPreVisitor", "(", "new", "MigrationCompensationInstanceVisitor", "(", ")", ")", ";", "walker", ".", "walkUntil", "(", ")", ";", "}" ]
Migrate activity instances to their new activities and process definition. Creates new scope instances as necessary.
[ "Migrate", "activity", "instances", "to", "their", "new", "activities", "and", "process", "definition", ".", "Creates", "new", "scope", "instances", "as", "necessary", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/migration/MigrateProcessInstanceCmd.java#L305-L317
16,579
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/cmmn/model/CmmnActivity.java
CmmnActivity.getVariableListeners
public Map<String, List<VariableListener<?>>> getVariableListeners(String eventName, boolean includeCustomListeners) { Map<String, Map<String, List<VariableListener<?>>>> listenerCache; if (includeCustomListeners) { if (resolvedVariableListeners == null) { resolvedVariableListeners = new HashMap<String, Map<String,List<VariableListener<?>>>>(); } listenerCache = resolvedVariableListeners; } else { if (resolvedBuiltInVariableListeners == null) { resolvedBuiltInVariableListeners = new HashMap<String, Map<String,List<VariableListener<?>>>>(); } listenerCache = resolvedBuiltInVariableListeners; } Map<String, List<VariableListener<?>>> resolvedListenersForEvent = listenerCache.get(eventName); if (resolvedListenersForEvent == null) { resolvedListenersForEvent = new HashMap<String, List<VariableListener<?>>>(); listenerCache.put(eventName, resolvedListenersForEvent); CmmnActivity currentActivity = this; while (currentActivity != null) { List<VariableListener<?>> localListeners = null; if (includeCustomListeners) { localListeners = currentActivity.getVariableListenersLocal(eventName); } else { localListeners = currentActivity.getBuiltInVariableListenersLocal(eventName); } if (localListeners != null && !localListeners.isEmpty()) { resolvedListenersForEvent.put(currentActivity.getId(), localListeners); } currentActivity = currentActivity.getParent(); } } return resolvedListenersForEvent; }
java
public Map<String, List<VariableListener<?>>> getVariableListeners(String eventName, boolean includeCustomListeners) { Map<String, Map<String, List<VariableListener<?>>>> listenerCache; if (includeCustomListeners) { if (resolvedVariableListeners == null) { resolvedVariableListeners = new HashMap<String, Map<String,List<VariableListener<?>>>>(); } listenerCache = resolvedVariableListeners; } else { if (resolvedBuiltInVariableListeners == null) { resolvedBuiltInVariableListeners = new HashMap<String, Map<String,List<VariableListener<?>>>>(); } listenerCache = resolvedBuiltInVariableListeners; } Map<String, List<VariableListener<?>>> resolvedListenersForEvent = listenerCache.get(eventName); if (resolvedListenersForEvent == null) { resolvedListenersForEvent = new HashMap<String, List<VariableListener<?>>>(); listenerCache.put(eventName, resolvedListenersForEvent); CmmnActivity currentActivity = this; while (currentActivity != null) { List<VariableListener<?>> localListeners = null; if (includeCustomListeners) { localListeners = currentActivity.getVariableListenersLocal(eventName); } else { localListeners = currentActivity.getBuiltInVariableListenersLocal(eventName); } if (localListeners != null && !localListeners.isEmpty()) { resolvedListenersForEvent.put(currentActivity.getId(), localListeners); } currentActivity = currentActivity.getParent(); } } return resolvedListenersForEvent; }
[ "public", "Map", "<", "String", ",", "List", "<", "VariableListener", "<", "?", ">", ">", ">", "getVariableListeners", "(", "String", "eventName", ",", "boolean", "includeCustomListeners", ")", "{", "Map", "<", "String", ",", "Map", "<", "String", ",", "List", "<", "VariableListener", "<", "?", ">", ">", ">", ">", "listenerCache", ";", "if", "(", "includeCustomListeners", ")", "{", "if", "(", "resolvedVariableListeners", "==", "null", ")", "{", "resolvedVariableListeners", "=", "new", "HashMap", "<", "String", ",", "Map", "<", "String", ",", "List", "<", "VariableListener", "<", "?", ">", ">", ">", ">", "(", ")", ";", "}", "listenerCache", "=", "resolvedVariableListeners", ";", "}", "else", "{", "if", "(", "resolvedBuiltInVariableListeners", "==", "null", ")", "{", "resolvedBuiltInVariableListeners", "=", "new", "HashMap", "<", "String", ",", "Map", "<", "String", ",", "List", "<", "VariableListener", "<", "?", ">", ">", ">", ">", "(", ")", ";", "}", "listenerCache", "=", "resolvedBuiltInVariableListeners", ";", "}", "Map", "<", "String", ",", "List", "<", "VariableListener", "<", "?", ">", ">", ">", "resolvedListenersForEvent", "=", "listenerCache", ".", "get", "(", "eventName", ")", ";", "if", "(", "resolvedListenersForEvent", "==", "null", ")", "{", "resolvedListenersForEvent", "=", "new", "HashMap", "<", "String", ",", "List", "<", "VariableListener", "<", "?", ">", ">", ">", "(", ")", ";", "listenerCache", ".", "put", "(", "eventName", ",", "resolvedListenersForEvent", ")", ";", "CmmnActivity", "currentActivity", "=", "this", ";", "while", "(", "currentActivity", "!=", "null", ")", "{", "List", "<", "VariableListener", "<", "?", ">", ">", "localListeners", "=", "null", ";", "if", "(", "includeCustomListeners", ")", "{", "localListeners", "=", "currentActivity", ".", "getVariableListenersLocal", "(", "eventName", ")", ";", "}", "else", "{", "localListeners", "=", "currentActivity", ".", "getBuiltInVariableListenersLocal", "(", "eventName", ")", ";", "}", "if", "(", "localListeners", "!=", "null", "&&", "!", "localListeners", ".", "isEmpty", "(", ")", ")", "{", "resolvedListenersForEvent", ".", "put", "(", "currentActivity", ".", "getId", "(", ")", ",", "localListeners", ")", ";", "}", "currentActivity", "=", "currentActivity", ".", "getParent", "(", ")", ";", "}", "}", "return", "resolvedListenersForEvent", ";", "}" ]
Returns a map of all variable listeners defined on this activity or any of its parents activities. The map's key is the id of the respective activity the listener is defined on.
[ "Returns", "a", "map", "of", "all", "variable", "listeners", "defined", "on", "this", "activity", "or", "any", "of", "its", "parents", "activities", ".", "The", "map", "s", "key", "is", "the", "id", "of", "the", "respective", "activity", "the", "listener", "is", "defined", "on", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/cmmn/model/CmmnActivity.java#L181-L221
16,580
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java
PropertyHelper.convertToClass
public static Object convertToClass(String value, Class<?> clazz) { Object propertyValue; if (clazz.isAssignableFrom(int.class)) { propertyValue = Integer.parseInt(value); } else if (clazz.isAssignableFrom(long.class)) { propertyValue = Long.parseLong(value); } else if (clazz.isAssignableFrom(float.class)) { propertyValue = Float.parseFloat(value); } else if (clazz.isAssignableFrom(boolean.class)) { propertyValue = Boolean.parseBoolean(value); } else { propertyValue = value; } return propertyValue; }
java
public static Object convertToClass(String value, Class<?> clazz) { Object propertyValue; if (clazz.isAssignableFrom(int.class)) { propertyValue = Integer.parseInt(value); } else if (clazz.isAssignableFrom(long.class)) { propertyValue = Long.parseLong(value); } else if (clazz.isAssignableFrom(float.class)) { propertyValue = Float.parseFloat(value); } else if (clazz.isAssignableFrom(boolean.class)) { propertyValue = Boolean.parseBoolean(value); } else { propertyValue = value; } return propertyValue; }
[ "public", "static", "Object", "convertToClass", "(", "String", "value", ",", "Class", "<", "?", ">", "clazz", ")", "{", "Object", "propertyValue", ";", "if", "(", "clazz", ".", "isAssignableFrom", "(", "int", ".", "class", ")", ")", "{", "propertyValue", "=", "Integer", ".", "parseInt", "(", "value", ")", ";", "}", "else", "if", "(", "clazz", ".", "isAssignableFrom", "(", "long", ".", "class", ")", ")", "{", "propertyValue", "=", "Long", ".", "parseLong", "(", "value", ")", ";", "}", "else", "if", "(", "clazz", ".", "isAssignableFrom", "(", "float", ".", "class", ")", ")", "{", "propertyValue", "=", "Float", ".", "parseFloat", "(", "value", ")", ";", "}", "else", "if", "(", "clazz", ".", "isAssignableFrom", "(", "boolean", ".", "class", ")", ")", "{", "propertyValue", "=", "Boolean", ".", "parseBoolean", "(", "value", ")", ";", "}", "else", "{", "propertyValue", "=", "value", ";", "}", "return", "propertyValue", ";", "}" ]
Converts a value to the type of the given field. @param value @param field @return
[ "Converts", "a", "value", "to", "the", "type", "of", "the", "given", "field", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java#L59-L76
16,581
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java
PropertyHelper.applyProperties
public static void applyProperties(Object configuration, Map<String, String> properties) { for (Map.Entry<String, String> property : properties.entrySet()) { applyProperty(configuration, property.getKey(), property.getValue()); } }
java
public static void applyProperties(Object configuration, Map<String, String> properties) { for (Map.Entry<String, String> property : properties.entrySet()) { applyProperty(configuration, property.getKey(), property.getValue()); } }
[ "public", "static", "void", "applyProperties", "(", "Object", "configuration", ",", "Map", "<", "String", ",", "String", ">", "properties", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "property", ":", "properties", ".", "entrySet", "(", ")", ")", "{", "applyProperty", "(", "configuration", ",", "property", ".", "getKey", "(", ")", ",", "property", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
Sets an objects fields via reflection from String values. Depending on the field's type the respective values are converted to int or boolean. @param configuration @param properties @throws ProcessEngineException if a property is supplied that matches no field or if the field's type is not String, nor int, nor boolean.
[ "Sets", "an", "objects", "fields", "via", "reflection", "from", "String", "values", ".", "Depending", "on", "the", "field", "s", "type", "the", "respective", "values", "are", "converted", "to", "int", "or", "boolean", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/container/impl/metadata/PropertyHelper.java#L108-L112
16,582
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/cmd/GetActivityInstanceCmd.java
GetActivityInstanceCmd.loadChildExecutionsFromCache
protected void loadChildExecutionsFromCache(ExecutionEntity execution, List<ExecutionEntity> childExecutions) { List<ExecutionEntity> childrenOfThisExecution = execution.getExecutions(); if(childrenOfThisExecution != null) { childExecutions.addAll(childrenOfThisExecution); for (ExecutionEntity child : childrenOfThisExecution) { loadChildExecutionsFromCache(child, childExecutions); } } }
java
protected void loadChildExecutionsFromCache(ExecutionEntity execution, List<ExecutionEntity> childExecutions) { List<ExecutionEntity> childrenOfThisExecution = execution.getExecutions(); if(childrenOfThisExecution != null) { childExecutions.addAll(childrenOfThisExecution); for (ExecutionEntity child : childrenOfThisExecution) { loadChildExecutionsFromCache(child, childExecutions); } } }
[ "protected", "void", "loadChildExecutionsFromCache", "(", "ExecutionEntity", "execution", ",", "List", "<", "ExecutionEntity", ">", "childExecutions", ")", "{", "List", "<", "ExecutionEntity", ">", "childrenOfThisExecution", "=", "execution", ".", "getExecutions", "(", ")", ";", "if", "(", "childrenOfThisExecution", "!=", "null", ")", "{", "childExecutions", ".", "addAll", "(", "childrenOfThisExecution", ")", ";", "for", "(", "ExecutionEntity", "child", ":", "childrenOfThisExecution", ")", "{", "loadChildExecutionsFromCache", "(", "child", ",", "childExecutions", ")", ";", "}", "}", "}" ]
Loads all executions that are part of this process instance tree from the dbSqlSession cache. (optionally querying the db if a child is not already loaded. @param execution the current root execution (already contained in childExecutions) @param childExecutions the list in which all child executions should be collected
[ "Loads", "all", "executions", "that", "are", "part", "of", "this", "process", "instance", "tree", "from", "the", "dbSqlSession", "cache", ".", "(", "optionally", "querying", "the", "db", "if", "a", "child", "is", "not", "already", "loaded", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/cmd/GetActivityInstanceCmd.java#L392-L400
16,583
camunda/camunda-bpm-platform
engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/hal/HalResource.java
HalResource.embed
@SuppressWarnings("unchecked") public T embed(HalRelation relation, ProcessEngine processEngine) { List<HalResource<?>> resolvedLinks = linker.resolve(relation, processEngine); if(resolvedLinks != null && resolvedLinks.size() > 0) { addEmbedded(relation.relName, resolvedLinks); } return (T) this; }
java
@SuppressWarnings("unchecked") public T embed(HalRelation relation, ProcessEngine processEngine) { List<HalResource<?>> resolvedLinks = linker.resolve(relation, processEngine); if(resolvedLinks != null && resolvedLinks.size() > 0) { addEmbedded(relation.relName, resolvedLinks); } return (T) this; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "T", "embed", "(", "HalRelation", "relation", ",", "ProcessEngine", "processEngine", ")", "{", "List", "<", "HalResource", "<", "?", ">", ">", "resolvedLinks", "=", "linker", ".", "resolve", "(", "relation", ",", "processEngine", ")", ";", "if", "(", "resolvedLinks", "!=", "null", "&&", "resolvedLinks", ".", "size", "(", ")", ">", "0", ")", "{", "addEmbedded", "(", "relation", ".", "relName", ",", "resolvedLinks", ")", ";", "}", "return", "(", "T", ")", "this", ";", "}" ]
Can be used to embed a relation. Embedded all linked resources in the given relation. @param relation the relation to embedded @param processEngine used to resolve the resources @return the resource itself.
[ "Can", "be", "used", "to", "embed", "a", "relation", ".", "Embedded", "all", "linked", "resources", "in", "the", "given", "relation", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/hal/HalResource.java#L97-L104
16,584
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/ExecuteJobHelper.java
ExecuteJobHelper.callFailedJobListenerWithRetries
private static OptimisticLockingException callFailedJobListenerWithRetries(CommandExecutor commandExecutor, FailedJobListener failedJobListener) { try { commandExecutor.execute(failedJobListener); return null; } catch (OptimisticLockingException ex) { failedJobListener.incrementCountRetries(); if (failedJobListener.getRetriesLeft() > 0) { return callFailedJobListenerWithRetries(commandExecutor, failedJobListener); } return ex; } }
java
private static OptimisticLockingException callFailedJobListenerWithRetries(CommandExecutor commandExecutor, FailedJobListener failedJobListener) { try { commandExecutor.execute(failedJobListener); return null; } catch (OptimisticLockingException ex) { failedJobListener.incrementCountRetries(); if (failedJobListener.getRetriesLeft() > 0) { return callFailedJobListenerWithRetries(commandExecutor, failedJobListener); } return ex; } }
[ "private", "static", "OptimisticLockingException", "callFailedJobListenerWithRetries", "(", "CommandExecutor", "commandExecutor", ",", "FailedJobListener", "failedJobListener", ")", "{", "try", "{", "commandExecutor", ".", "execute", "(", "failedJobListener", ")", ";", "return", "null", ";", "}", "catch", "(", "OptimisticLockingException", "ex", ")", "{", "failedJobListener", ".", "incrementCountRetries", "(", ")", ";", "if", "(", "failedJobListener", ".", "getRetriesLeft", "(", ")", ">", "0", ")", "{", "return", "callFailedJobListenerWithRetries", "(", "commandExecutor", ",", "failedJobListener", ")", ";", "}", "return", "ex", ";", "}", "}" ]
Calls FailedJobListener, in case of OptimisticLockException retries configured amount of times. @return exception or null if succeeded
[ "Calls", "FailedJobListener", "in", "case", "of", "OptimisticLockException", "retries", "configured", "amount", "of", "times", "." ]
1a464fc887ef3760e53d6f91b9e5b871a0d77cc0
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/jobexecutor/ExecuteJobHelper.java#L93-L104
16,585
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java
Taint.addLocation
public void addLocation(TaintLocation location, boolean isKnownTaintSource) { Objects.requireNonNull(location, "location is null"); if (isKnownTaintSource) { taintLocations.add(location); } else { unknownLocations.add(location); } }
java
public void addLocation(TaintLocation location, boolean isKnownTaintSource) { Objects.requireNonNull(location, "location is null"); if (isKnownTaintSource) { taintLocations.add(location); } else { unknownLocations.add(location); } }
[ "public", "void", "addLocation", "(", "TaintLocation", "location", ",", "boolean", "isKnownTaintSource", ")", "{", "Objects", ".", "requireNonNull", "(", "location", ",", "\"location is null\"", ")", ";", "if", "(", "isKnownTaintSource", ")", "{", "taintLocations", ".", "add", "(", "location", ")", ";", "}", "else", "{", "unknownLocations", ".", "add", "(", "location", ")", ";", "}", "}" ]
Adds location for a taint source or path to remember for reporting @param location location to remember @param isKnownTaintSource true for tainted value, false if just not safe @throws NullPointerException if location is null
[ "Adds", "location", "for", "a", "taint", "source", "or", "path", "to", "remember", "for", "reporting" ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java#L239-L246
16,586
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java
Taint.hasOneTag
public boolean hasOneTag(Tag... tags) { for(Tag t : tags) { if (this.tags.contains(t)) return true; } return false; }
java
public boolean hasOneTag(Tag... tags) { for(Tag t : tags) { if (this.tags.contains(t)) return true; } return false; }
[ "public", "boolean", "hasOneTag", "(", "Tag", "...", "tags", ")", "{", "for", "(", "Tag", "t", ":", "tags", ")", "{", "if", "(", "this", ".", "tags", ".", "contains", "(", "t", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
Checks whether one of the specified taint tag is present for this fact @param tags Tags to test @return true if at least one is present, false otherwise
[ "Checks", "whether", "one", "of", "the", "specified", "taint", "tag", "is", "present", "for", "this", "fact" ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java#L399-L404
16,587
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java
Taint.valueOf
public static Taint valueOf(State state) { Objects.requireNonNull(state, "state is null"); if (state == State.INVALID) { return null; } return new Taint(state); }
java
public static Taint valueOf(State state) { Objects.requireNonNull(state, "state is null"); if (state == State.INVALID) { return null; } return new Taint(state); }
[ "public", "static", "Taint", "valueOf", "(", "State", "state", ")", "{", "Objects", ".", "requireNonNull", "(", "state", ",", "\"state is null\"", ")", ";", "if", "(", "state", "==", "State", ".", "INVALID", ")", "{", "return", "null", ";", "}", "return", "new", "Taint", "(", "state", ")", ";", "}" ]
Constructs a new instance of taint from the specified state @param state the specified state @return the constructed instance @throws NullPointerException if state is null
[ "Constructs", "a", "new", "instance", "of", "taint", "from", "the", "specified", "state" ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java#L504-L510
16,588
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java
Taint.merge
public static Taint merge(Taint a, Taint b) { if (a == null) { if (b == null) { return null; } else { return new Taint(b); } } else if (b == null) { return new Taint(a); } assert a != null && b != null; Taint result = new Taint(State.merge(a.getState(), b.getState())); if (a.variableIndex == b.variableIndex) { result.variableIndex = a.variableIndex; } result.taintLocations.addAll(a.taintLocations); result.taintLocations.addAll(b.taintLocations); result.unknownLocations.addAll(a.unknownLocations); result.unknownLocations.addAll(b.unknownLocations); if (!result.isTainted()) { mergeParameters(a, b, result); } mergeRealInstanceClass(a, b, result); mergeTags(a, b, result); if (a.constantValue != null && a.constantValue.equals(b.constantValue)) { result.constantValue = a.constantValue; } if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) { result.setDebugInfo("[" + a.getDebugInfo() + "]+[" + b.getDebugInfo() + "]"); } assert !result.hasParameters() || result.isUnknown(); if(a.potentialValue != null) { result.potentialValue = a.potentialValue; } else if(b.potentialValue != null) { result.potentialValue = b.potentialValue; } result.addAllSources(a.sources); result.addAllSources(b.sources); return result; }
java
public static Taint merge(Taint a, Taint b) { if (a == null) { if (b == null) { return null; } else { return new Taint(b); } } else if (b == null) { return new Taint(a); } assert a != null && b != null; Taint result = new Taint(State.merge(a.getState(), b.getState())); if (a.variableIndex == b.variableIndex) { result.variableIndex = a.variableIndex; } result.taintLocations.addAll(a.taintLocations); result.taintLocations.addAll(b.taintLocations); result.unknownLocations.addAll(a.unknownLocations); result.unknownLocations.addAll(b.unknownLocations); if (!result.isTainted()) { mergeParameters(a, b, result); } mergeRealInstanceClass(a, b, result); mergeTags(a, b, result); if (a.constantValue != null && a.constantValue.equals(b.constantValue)) { result.constantValue = a.constantValue; } if (FindSecBugsGlobalConfig.getInstance().isDebugTaintState()) { result.setDebugInfo("[" + a.getDebugInfo() + "]+[" + b.getDebugInfo() + "]"); } assert !result.hasParameters() || result.isUnknown(); if(a.potentialValue != null) { result.potentialValue = a.potentialValue; } else if(b.potentialValue != null) { result.potentialValue = b.potentialValue; } result.addAllSources(a.sources); result.addAllSources(b.sources); return result; }
[ "public", "static", "Taint", "merge", "(", "Taint", "a", ",", "Taint", "b", ")", "{", "if", "(", "a", "==", "null", ")", "{", "if", "(", "b", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "new", "Taint", "(", "b", ")", ";", "}", "}", "else", "if", "(", "b", "==", "null", ")", "{", "return", "new", "Taint", "(", "a", ")", ";", "}", "assert", "a", "!=", "null", "&&", "b", "!=", "null", ";", "Taint", "result", "=", "new", "Taint", "(", "State", ".", "merge", "(", "a", ".", "getState", "(", ")", ",", "b", ".", "getState", "(", ")", ")", ")", ";", "if", "(", "a", ".", "variableIndex", "==", "b", ".", "variableIndex", ")", "{", "result", ".", "variableIndex", "=", "a", ".", "variableIndex", ";", "}", "result", ".", "taintLocations", ".", "addAll", "(", "a", ".", "taintLocations", ")", ";", "result", ".", "taintLocations", ".", "addAll", "(", "b", ".", "taintLocations", ")", ";", "result", ".", "unknownLocations", ".", "addAll", "(", "a", ".", "unknownLocations", ")", ";", "result", ".", "unknownLocations", ".", "addAll", "(", "b", ".", "unknownLocations", ")", ";", "if", "(", "!", "result", ".", "isTainted", "(", ")", ")", "{", "mergeParameters", "(", "a", ",", "b", ",", "result", ")", ";", "}", "mergeRealInstanceClass", "(", "a", ",", "b", ",", "result", ")", ";", "mergeTags", "(", "a", ",", "b", ",", "result", ")", ";", "if", "(", "a", ".", "constantValue", "!=", "null", "&&", "a", ".", "constantValue", ".", "equals", "(", "b", ".", "constantValue", ")", ")", "{", "result", ".", "constantValue", "=", "a", ".", "constantValue", ";", "}", "if", "(", "FindSecBugsGlobalConfig", ".", "getInstance", "(", ")", ".", "isDebugTaintState", "(", ")", ")", "{", "result", ".", "setDebugInfo", "(", "\"[\"", "+", "a", ".", "getDebugInfo", "(", ")", "+", "\"]+[\"", "+", "b", ".", "getDebugInfo", "(", ")", "+", "\"]\"", ")", ";", "}", "assert", "!", "result", ".", "hasParameters", "(", ")", "||", "result", ".", "isUnknown", "(", ")", ";", "if", "(", "a", ".", "potentialValue", "!=", "null", ")", "{", "result", ".", "potentialValue", "=", "a", ".", "potentialValue", ";", "}", "else", "if", "(", "b", ".", "potentialValue", "!=", "null", ")", "{", "result", ".", "potentialValue", "=", "b", ".", "potentialValue", ";", "}", "result", ".", "addAllSources", "(", "a", ".", "sources", ")", ";", "result", ".", "addAllSources", "(", "b", ".", "sources", ")", ";", "return", "result", ";", "}" ]
Returns the merge of the facts such that it can represent any of them @param a first state to merge @param b second state to merge @return constructed merge of the specified facts
[ "Returns", "the", "merge", "of", "the", "facts", "such", "that", "it", "can", "represent", "any", "of", "them" ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java#L519-L559
16,589
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintConfig.java
TaintConfig.dump
public void dump(PrintStream output) { TreeSet<String> keys = new TreeSet<String>(keySet()); for (String key : keys) { output.println(key + ":" + get(key)); } }
java
public void dump(PrintStream output) { TreeSet<String> keys = new TreeSet<String>(keySet()); for (String key : keys) { output.println(key + ":" + get(key)); } }
[ "public", "void", "dump", "(", "PrintStream", "output", ")", "{", "TreeSet", "<", "String", ">", "keys", "=", "new", "TreeSet", "<", "String", ">", "(", "keySet", "(", ")", ")", ";", "for", "(", "String", "key", ":", "keys", ")", "{", "output", ".", "println", "(", "key", "+", "\":\"", "+", "get", "(", "key", ")", ")", ";", "}", "}" ]
Dumps all the summaries for debugging @param output stream where to output the summaries
[ "Dumps", "all", "the", "summaries", "for", "debugging" ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintConfig.java#L61-L66
16,590
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintConfig.java
TaintConfig.load
public void load(InputStream input, final boolean checkRewrite) throws IOException { new TaintConfigLoader().load(input, new TaintConfigLoader.TaintConfigReceiver() { @Override public void receiveTaintConfig(String typeSignature, String config) throws IOException { if (TaintMethodConfig.accepts(typeSignature, config)) { if (checkRewrite && containsKey(typeSignature)) { throw new IllegalStateException("Config for " + typeSignature + " already loaded"); } TaintMethodConfig taintMethodConfig = new TaintMethodConfig(true).load(config); taintMethodConfig.setTypeSignature(typeSignature); put(typeSignature, taintMethodConfig); return; } if (TaintClassConfig.accepts(typeSignature, config)) { if (checkRewrite && taintClassConfigMap.containsKey(typeSignature)) { throw new IllegalStateException("Config for " + typeSignature + " already loaded"); } TaintClassConfig taintClassConfig = new TaintClassConfig().load(config); taintClassConfigMap.put(typeSignature, taintClassConfig); return; } if (TaintMethodConfigWithArgumentsAndLocation.accepts(typeSignature, config)) { if (checkRewrite && taintMethodConfigWithArgumentsAndLocationMap.containsKey(typeSignature)) { throw new IllegalStateException("Config for " + typeSignature + " already loaded"); } TaintMethodConfigWithArgumentsAndLocation methodConfig = new TaintMethodConfigWithArgumentsAndLocation().load(config); methodConfig.setTypeSignature(typeSignature); String key = typeSignature + '@' + methodConfig.getLocation(); taintMethodConfigWithArgumentsAndLocationMap.put(key, methodConfig); return; } throw new IllegalArgumentException("Invalid full method name " + typeSignature + " configured"); } }); }
java
public void load(InputStream input, final boolean checkRewrite) throws IOException { new TaintConfigLoader().load(input, new TaintConfigLoader.TaintConfigReceiver() { @Override public void receiveTaintConfig(String typeSignature, String config) throws IOException { if (TaintMethodConfig.accepts(typeSignature, config)) { if (checkRewrite && containsKey(typeSignature)) { throw new IllegalStateException("Config for " + typeSignature + " already loaded"); } TaintMethodConfig taintMethodConfig = new TaintMethodConfig(true).load(config); taintMethodConfig.setTypeSignature(typeSignature); put(typeSignature, taintMethodConfig); return; } if (TaintClassConfig.accepts(typeSignature, config)) { if (checkRewrite && taintClassConfigMap.containsKey(typeSignature)) { throw new IllegalStateException("Config for " + typeSignature + " already loaded"); } TaintClassConfig taintClassConfig = new TaintClassConfig().load(config); taintClassConfigMap.put(typeSignature, taintClassConfig); return; } if (TaintMethodConfigWithArgumentsAndLocation.accepts(typeSignature, config)) { if (checkRewrite && taintMethodConfigWithArgumentsAndLocationMap.containsKey(typeSignature)) { throw new IllegalStateException("Config for " + typeSignature + " already loaded"); } TaintMethodConfigWithArgumentsAndLocation methodConfig = new TaintMethodConfigWithArgumentsAndLocation().load(config); methodConfig.setTypeSignature(typeSignature); String key = typeSignature + '@' + methodConfig.getLocation(); taintMethodConfigWithArgumentsAndLocationMap.put(key, methodConfig); return; } throw new IllegalArgumentException("Invalid full method name " + typeSignature + " configured"); } }); }
[ "public", "void", "load", "(", "InputStream", "input", ",", "final", "boolean", "checkRewrite", ")", "throws", "IOException", "{", "new", "TaintConfigLoader", "(", ")", ".", "load", "(", "input", ",", "new", "TaintConfigLoader", ".", "TaintConfigReceiver", "(", ")", "{", "@", "Override", "public", "void", "receiveTaintConfig", "(", "String", "typeSignature", ",", "String", "config", ")", "throws", "IOException", "{", "if", "(", "TaintMethodConfig", ".", "accepts", "(", "typeSignature", ",", "config", ")", ")", "{", "if", "(", "checkRewrite", "&&", "containsKey", "(", "typeSignature", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Config for \"", "+", "typeSignature", "+", "\" already loaded\"", ")", ";", "}", "TaintMethodConfig", "taintMethodConfig", "=", "new", "TaintMethodConfig", "(", "true", ")", ".", "load", "(", "config", ")", ";", "taintMethodConfig", ".", "setTypeSignature", "(", "typeSignature", ")", ";", "put", "(", "typeSignature", ",", "taintMethodConfig", ")", ";", "return", ";", "}", "if", "(", "TaintClassConfig", ".", "accepts", "(", "typeSignature", ",", "config", ")", ")", "{", "if", "(", "checkRewrite", "&&", "taintClassConfigMap", ".", "containsKey", "(", "typeSignature", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Config for \"", "+", "typeSignature", "+", "\" already loaded\"", ")", ";", "}", "TaintClassConfig", "taintClassConfig", "=", "new", "TaintClassConfig", "(", ")", ".", "load", "(", "config", ")", ";", "taintClassConfigMap", ".", "put", "(", "typeSignature", ",", "taintClassConfig", ")", ";", "return", ";", "}", "if", "(", "TaintMethodConfigWithArgumentsAndLocation", ".", "accepts", "(", "typeSignature", ",", "config", ")", ")", "{", "if", "(", "checkRewrite", "&&", "taintMethodConfigWithArgumentsAndLocationMap", ".", "containsKey", "(", "typeSignature", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Config for \"", "+", "typeSignature", "+", "\" already loaded\"", ")", ";", "}", "TaintMethodConfigWithArgumentsAndLocation", "methodConfig", "=", "new", "TaintMethodConfigWithArgumentsAndLocation", "(", ")", ".", "load", "(", "config", ")", ";", "methodConfig", ".", "setTypeSignature", "(", "typeSignature", ")", ";", "String", "key", "=", "typeSignature", "+", "'", "'", "+", "methodConfig", ".", "getLocation", "(", ")", ";", "taintMethodConfigWithArgumentsAndLocationMap", ".", "put", "(", "key", ",", "methodConfig", ")", ";", "return", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"Invalid full method name \"", "+", "typeSignature", "+", "\" configured\"", ")", ";", "}", "}", ")", ";", "}" ]
Loads summaries from stream checking the format @param input input stream of configured summaries @param checkRewrite whether to check duplicit summaries @throws IOException if cannot read the stream or the format is bad @throws IllegalArgumentException for bad method format @throws IllegalStateException if there are duplicit configurations
[ "Loads", "summaries", "from", "stream", "checking", "the", "format" ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintConfig.java#L77-L118
16,591
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintAnalysis.java
TaintAnalysis.initEntryFact
@Override public void initEntryFact(TaintFrame fact) { fact.setValid(); fact.clearStack(); boolean inMainMethod = isInMainMethod(); int numSlots = fact.getNumSlots(); int numLocals = fact.getNumLocals(); for (int i = 0; i < numSlots; ++i) { Taint value = new Taint(Taint.State.UNKNOWN); if (i < numLocals) { if (i < parameterStackSize) { int stackOffset = parameterStackSize - i - 1; if (isTaintedByAnnotation(i - 1)) { value = new Taint(Taint.State.TAINTED); // this would add line number for the first instruction in the method //value.addLocation(new TaintLocation(methodDescriptor, 0,""), true); } else if (inMainMethod) { if (FindSecBugsGlobalConfig.getInstance().isTaintedMainArgument()) { value = new Taint(Taint.State.TAINTED); } else { value = new Taint(Taint.State.SAFE); } } else { value.addParameter(stackOffset); } value.addSource(new UnknownSource(UnknownSourceType.PARAMETER,value.getState()).setParameterIndex(stackOffset)); } value.setVariableIndex(i); } fact.setValue(i, value); } }
java
@Override public void initEntryFact(TaintFrame fact) { fact.setValid(); fact.clearStack(); boolean inMainMethod = isInMainMethod(); int numSlots = fact.getNumSlots(); int numLocals = fact.getNumLocals(); for (int i = 0; i < numSlots; ++i) { Taint value = new Taint(Taint.State.UNKNOWN); if (i < numLocals) { if (i < parameterStackSize) { int stackOffset = parameterStackSize - i - 1; if (isTaintedByAnnotation(i - 1)) { value = new Taint(Taint.State.TAINTED); // this would add line number for the first instruction in the method //value.addLocation(new TaintLocation(methodDescriptor, 0,""), true); } else if (inMainMethod) { if (FindSecBugsGlobalConfig.getInstance().isTaintedMainArgument()) { value = new Taint(Taint.State.TAINTED); } else { value = new Taint(Taint.State.SAFE); } } else { value.addParameter(stackOffset); } value.addSource(new UnknownSource(UnknownSourceType.PARAMETER,value.getState()).setParameterIndex(stackOffset)); } value.setVariableIndex(i); } fact.setValue(i, value); } }
[ "@", "Override", "public", "void", "initEntryFact", "(", "TaintFrame", "fact", ")", "{", "fact", ".", "setValid", "(", ")", ";", "fact", ".", "clearStack", "(", ")", ";", "boolean", "inMainMethod", "=", "isInMainMethod", "(", ")", ";", "int", "numSlots", "=", "fact", ".", "getNumSlots", "(", ")", ";", "int", "numLocals", "=", "fact", ".", "getNumLocals", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numSlots", ";", "++", "i", ")", "{", "Taint", "value", "=", "new", "Taint", "(", "Taint", ".", "State", ".", "UNKNOWN", ")", ";", "if", "(", "i", "<", "numLocals", ")", "{", "if", "(", "i", "<", "parameterStackSize", ")", "{", "int", "stackOffset", "=", "parameterStackSize", "-", "i", "-", "1", ";", "if", "(", "isTaintedByAnnotation", "(", "i", "-", "1", ")", ")", "{", "value", "=", "new", "Taint", "(", "Taint", ".", "State", ".", "TAINTED", ")", ";", "// this would add line number for the first instruction in the method", "//value.addLocation(new TaintLocation(methodDescriptor, 0,\"\"), true);", "}", "else", "if", "(", "inMainMethod", ")", "{", "if", "(", "FindSecBugsGlobalConfig", ".", "getInstance", "(", ")", ".", "isTaintedMainArgument", "(", ")", ")", "{", "value", "=", "new", "Taint", "(", "Taint", ".", "State", ".", "TAINTED", ")", ";", "}", "else", "{", "value", "=", "new", "Taint", "(", "Taint", ".", "State", ".", "SAFE", ")", ";", "}", "}", "else", "{", "value", ".", "addParameter", "(", "stackOffset", ")", ";", "}", "value", ".", "addSource", "(", "new", "UnknownSource", "(", "UnknownSourceType", ".", "PARAMETER", ",", "value", ".", "getState", "(", ")", ")", ".", "setParameterIndex", "(", "stackOffset", ")", ")", ";", "}", "value", ".", "setVariableIndex", "(", "i", ")", ";", "}", "fact", ".", "setValue", "(", "i", ",", "value", ")", ";", "}", "}" ]
Initialize the initial state of a TaintFrame. @param fact Initial frame
[ "Initialize", "the", "initial", "state", "of", "a", "TaintFrame", "." ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintAnalysis.java#L102-L133
16,592
find-sec-bugs/find-sec-bugs
findsecbugs-samples-deps/src/main/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java
ClassLoaderObjectInputStream.resolveClass
@Override protected Class<?> resolveClass(final ObjectStreamClass objectStreamClass) throws IOException, ClassNotFoundException { try { return Class.forName(objectStreamClass.getName(), false, classLoader); } catch (final ClassNotFoundException cnfe) { // delegate to super class loader which can resolve primitives return super.resolveClass(objectStreamClass); } }
java
@Override protected Class<?> resolveClass(final ObjectStreamClass objectStreamClass) throws IOException, ClassNotFoundException { try { return Class.forName(objectStreamClass.getName(), false, classLoader); } catch (final ClassNotFoundException cnfe) { // delegate to super class loader which can resolve primitives return super.resolveClass(objectStreamClass); } }
[ "@", "Override", "protected", "Class", "<", "?", ">", "resolveClass", "(", "final", "ObjectStreamClass", "objectStreamClass", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "try", "{", "return", "Class", ".", "forName", "(", "objectStreamClass", ".", "getName", "(", ")", ",", "false", ",", "classLoader", ")", ";", "}", "catch", "(", "final", "ClassNotFoundException", "cnfe", ")", "{", "// delegate to super class loader which can resolve primitives", "return", "super", ".", "resolveClass", "(", "objectStreamClass", ")", ";", "}", "}" ]
Resolve a class specified by the descriptor using the specified ClassLoader or the super ClassLoader. @param objectStreamClass descriptor of the class @return the Class object described by the ObjectStreamClass @throws IOException in case of an I/O error @throws ClassNotFoundException if the Class cannot be found
[ "Resolve", "a", "class", "specified", "by", "the", "descriptor", "using", "the", "specified", "ClassLoader", "or", "the", "super", "ClassLoader", "." ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-samples-deps/src/main/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java#L45-L55
16,593
find-sec-bugs/find-sec-bugs
findsecbugs-samples-deps/src/main/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java
ClassLoaderObjectInputStream.resolveProxyClass
@Override protected Class<?> resolveProxyClass(final String[] interfaces) throws IOException, ClassNotFoundException { final Class<?>[] interfaceClasses = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { interfaceClasses[i] = Class.forName(interfaces[i], false, classLoader); } try { return Proxy.getProxyClass(classLoader, interfaceClasses); } catch (final IllegalArgumentException e) { return super.resolveProxyClass(interfaces); } }
java
@Override protected Class<?> resolveProxyClass(final String[] interfaces) throws IOException, ClassNotFoundException { final Class<?>[] interfaceClasses = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { interfaceClasses[i] = Class.forName(interfaces[i], false, classLoader); } try { return Proxy.getProxyClass(classLoader, interfaceClasses); } catch (final IllegalArgumentException e) { return super.resolveProxyClass(interfaces); } }
[ "@", "Override", "protected", "Class", "<", "?", ">", "resolveProxyClass", "(", "final", "String", "[", "]", "interfaces", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "final", "Class", "<", "?", ">", "[", "]", "interfaceClasses", "=", "new", "Class", "[", "interfaces", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "interfaces", ".", "length", ";", "i", "++", ")", "{", "interfaceClasses", "[", "i", "]", "=", "Class", ".", "forName", "(", "interfaces", "[", "i", "]", ",", "false", ",", "classLoader", ")", ";", "}", "try", "{", "return", "Proxy", ".", "getProxyClass", "(", "classLoader", ",", "interfaceClasses", ")", ";", "}", "catch", "(", "final", "IllegalArgumentException", "e", ")", "{", "return", "super", ".", "resolveProxyClass", "(", "interfaces", ")", ";", "}", "}" ]
Create a proxy class that implements the specified interfaces using the specified ClassLoader or the super ClassLoader. @param interfaces the interfaces to implement @return a proxy class implementing the interfaces @throws IOException in case of an I/O error @throws ClassNotFoundException if the Class cannot be found @see java.io.ObjectInputStream#resolveProxyClass(java.lang.String[]) @since 2.1
[ "Create", "a", "proxy", "class", "that", "implements", "the", "specified", "interfaces", "using", "the", "specified", "ClassLoader", "or", "the", "super", "ClassLoader", "." ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-samples-deps/src/main/java/org/apache/commons/io/input/ClassLoaderObjectInputStream.java#L68-L80
16,594
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/serial/DeserializationGadgetDetector.java
DeserializationGadgetDetector.hasCustomReadObject
private boolean hasCustomReadObject(Method m, ClassContext classContext,List<String> classesToIgnore) throws CFGBuilderException, DataflowAnalysisException { ConstantPoolGen cpg = classContext.getConstantPoolGen(); CFG cfg = classContext.getCFG(m); int count = 0; for (Iterator<Location> i = cfg.locationIterator(); i.hasNext(); ) { Location location = i.next(); Instruction inst = location.getHandle().getInstruction(); //ByteCode.printOpCode(inst,cpg); if(inst instanceof InvokeInstruction) { InvokeInstruction invoke = (InvokeInstruction) inst; if (!READ_DESERIALIZATION_METHODS.contains(invoke.getMethodName(cpg)) && !classesToIgnore.contains(invoke.getClassName(cpg))) { count +=1; } } } return count > 3; }
java
private boolean hasCustomReadObject(Method m, ClassContext classContext,List<String> classesToIgnore) throws CFGBuilderException, DataflowAnalysisException { ConstantPoolGen cpg = classContext.getConstantPoolGen(); CFG cfg = classContext.getCFG(m); int count = 0; for (Iterator<Location> i = cfg.locationIterator(); i.hasNext(); ) { Location location = i.next(); Instruction inst = location.getHandle().getInstruction(); //ByteCode.printOpCode(inst,cpg); if(inst instanceof InvokeInstruction) { InvokeInstruction invoke = (InvokeInstruction) inst; if (!READ_DESERIALIZATION_METHODS.contains(invoke.getMethodName(cpg)) && !classesToIgnore.contains(invoke.getClassName(cpg))) { count +=1; } } } return count > 3; }
[ "private", "boolean", "hasCustomReadObject", "(", "Method", "m", ",", "ClassContext", "classContext", ",", "List", "<", "String", ">", "classesToIgnore", ")", "throws", "CFGBuilderException", ",", "DataflowAnalysisException", "{", "ConstantPoolGen", "cpg", "=", "classContext", ".", "getConstantPoolGen", "(", ")", ";", "CFG", "cfg", "=", "classContext", ".", "getCFG", "(", "m", ")", ";", "int", "count", "=", "0", ";", "for", "(", "Iterator", "<", "Location", ">", "i", "=", "cfg", ".", "locationIterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "Location", "location", "=", "i", ".", "next", "(", ")", ";", "Instruction", "inst", "=", "location", ".", "getHandle", "(", ")", ".", "getInstruction", "(", ")", ";", "//ByteCode.printOpCode(inst,cpg);", "if", "(", "inst", "instanceof", "InvokeInstruction", ")", "{", "InvokeInstruction", "invoke", "=", "(", "InvokeInstruction", ")", "inst", ";", "if", "(", "!", "READ_DESERIALIZATION_METHODS", ".", "contains", "(", "invoke", ".", "getMethodName", "(", "cpg", ")", ")", "&&", "!", "classesToIgnore", ".", "contains", "(", "invoke", ".", "getClassName", "(", "cpg", ")", ")", ")", "{", "count", "+=", "1", ";", "}", "}", "}", "return", "count", ">", "3", ";", "}" ]
Check if the readObject is doing multiple external call beyond the basic readByte, readBoolean, etc.. @param m @param classContext @return @throws CFGBuilderException @throws DataflowAnalysisException
[ "Check", "if", "the", "readObject", "is", "doing", "multiple", "external", "call", "beyond", "the", "basic", "readByte", "readBoolean", "etc", ".." ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/serial/DeserializationGadgetDetector.java#L129-L147
16,595
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintConfigLoader.java
TaintConfigLoader.load
public void load(InputStream input, TaintConfigReceiver receiver) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(input, "UTF-8")); for (;;) { String line = reader.readLine(); if (line == null) { break; } line = line.trim(); if (line.isEmpty()) { continue; } putFromLine(line, receiver); } }
java
public void load(InputStream input, TaintConfigReceiver receiver) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(input, "UTF-8")); for (;;) { String line = reader.readLine(); if (line == null) { break; } line = line.trim(); if (line.isEmpty()) { continue; } putFromLine(line, receiver); } }
[ "public", "void", "load", "(", "InputStream", "input", ",", "TaintConfigReceiver", "receiver", ")", "throws", "IOException", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "input", ",", "\"UTF-8\"", ")", ")", ";", "for", "(", ";", ";", ")", "{", "String", "line", "=", "reader", ".", "readLine", "(", ")", ";", "if", "(", "line", "==", "null", ")", "{", "break", ";", "}", "line", "=", "line", ".", "trim", "(", ")", ";", "if", "(", "line", ".", "isEmpty", "(", ")", ")", "{", "continue", ";", "}", "putFromLine", "(", "line", ",", "receiver", ")", ";", "}", "}" ]
Loads the summaries and do what is specified @param input input stream with configured summaries @param receiver specifies the action for each summary when loaded @throws IOException if cannot read the stream or the format is bad
[ "Loads", "the", "summaries", "and", "do", "what", "is", "specified" ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintConfigLoader.java#L37-L50
16,596
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/injection/InjectionSink.java
InjectionSink.addLines
public void addLines(Collection<TaintLocation> locations) { Objects.requireNonNull(detector, "locations"); for (TaintLocation location : locations) { lines.add(SourceLineAnnotation.fromVisitedInstruction( location.getMethodDescriptor(), location.getPosition())); } }
java
public void addLines(Collection<TaintLocation> locations) { Objects.requireNonNull(detector, "locations"); for (TaintLocation location : locations) { lines.add(SourceLineAnnotation.fromVisitedInstruction( location.getMethodDescriptor(), location.getPosition())); } }
[ "public", "void", "addLines", "(", "Collection", "<", "TaintLocation", ">", "locations", ")", "{", "Objects", ".", "requireNonNull", "(", "detector", ",", "\"locations\"", ")", ";", "for", "(", "TaintLocation", "location", ":", "locations", ")", "{", "lines", ".", "add", "(", "SourceLineAnnotation", ".", "fromVisitedInstruction", "(", "location", ".", "getMethodDescriptor", "(", ")", ",", "location", ".", "getPosition", "(", ")", ")", ")", ";", "}", "}" ]
Adds lines with tainted source or path for reporting @param locations collection of locations used to extract lines
[ "Adds", "lines", "with", "tainted", "source", "or", "path", "for", "reporting" ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/injection/InjectionSink.java#L127-L133
16,597
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/injection/InjectionSink.java
InjectionSink.generateBugInstance
public BugInstance generateBugInstance(boolean taintedInsideMethod) { BugInstance bug = new BugInstance(detector, bugType, originalPriority); bug.addClassAndMethod(classContext.getJavaClass(), method); bug.addSourceLine(SourceLineAnnotation.fromVisitedInstruction(classContext, method, instructionHandle)); addMessage(bug, "Sink method", sinkMethod); addMessage(bug, "Sink parameter", String.valueOf(parameterOffset)); for(UnknownSource source : sources) { if(source.getSourceType() == UnknownSourceType.FIELD) { addMessage(bug, "Unknown source", source.getSignatureField()); } else if(source.getSourceType() == UnknownSourceType.RETURN) { if(isExclude(source.getSignatureMethod())) continue; addMessage(bug, "Unknown source", source.getSignatureMethod()); } // if(isExclude(source.getTaintSource())) { continue; } // addMessage(bug, "Unknown source", source.getTaintSource()); } if (sinkPriority != UNKNOWN_SINK_PRIORITY) { // higher priority is represented by lower integer if (sinkPriority < originalPriority) { bug.setPriority(sinkPriority); addMessage(bug, "Method usage", "with tainted arguments detected"); } else if (sinkPriority > originalPriority) { bug.setPriority(Priorities.LOW_PRIORITY); addMessage(bug, "Method usage", "detected only with safe arguments"); } } else if (!taintedInsideMethod) { addMessage(bug, "Method usage", "not detected"); } Collections.sort(lines); SourceLineAnnotation annotation = null; for (Iterator<SourceLineAnnotation> it = lines.iterator(); it.hasNext();) { SourceLineAnnotation prev = annotation; annotation = it.next(); if (prev != null && prev.getClassName().equals(annotation.getClassName()) && prev.getStartLine() == annotation.getStartLine()) { // keep only one annotation per line it.remove(); } } for (SourceLineAnnotation sourceLine : lines) { bug.addSourceLine(sourceLine); } return bug; }
java
public BugInstance generateBugInstance(boolean taintedInsideMethod) { BugInstance bug = new BugInstance(detector, bugType, originalPriority); bug.addClassAndMethod(classContext.getJavaClass(), method); bug.addSourceLine(SourceLineAnnotation.fromVisitedInstruction(classContext, method, instructionHandle)); addMessage(bug, "Sink method", sinkMethod); addMessage(bug, "Sink parameter", String.valueOf(parameterOffset)); for(UnknownSource source : sources) { if(source.getSourceType() == UnknownSourceType.FIELD) { addMessage(bug, "Unknown source", source.getSignatureField()); } else if(source.getSourceType() == UnknownSourceType.RETURN) { if(isExclude(source.getSignatureMethod())) continue; addMessage(bug, "Unknown source", source.getSignatureMethod()); } // if(isExclude(source.getTaintSource())) { continue; } // addMessage(bug, "Unknown source", source.getTaintSource()); } if (sinkPriority != UNKNOWN_SINK_PRIORITY) { // higher priority is represented by lower integer if (sinkPriority < originalPriority) { bug.setPriority(sinkPriority); addMessage(bug, "Method usage", "with tainted arguments detected"); } else if (sinkPriority > originalPriority) { bug.setPriority(Priorities.LOW_PRIORITY); addMessage(bug, "Method usage", "detected only with safe arguments"); } } else if (!taintedInsideMethod) { addMessage(bug, "Method usage", "not detected"); } Collections.sort(lines); SourceLineAnnotation annotation = null; for (Iterator<SourceLineAnnotation> it = lines.iterator(); it.hasNext();) { SourceLineAnnotation prev = annotation; annotation = it.next(); if (prev != null && prev.getClassName().equals(annotation.getClassName()) && prev.getStartLine() == annotation.getStartLine()) { // keep only one annotation per line it.remove(); } } for (SourceLineAnnotation sourceLine : lines) { bug.addSourceLine(sourceLine); } return bug; }
[ "public", "BugInstance", "generateBugInstance", "(", "boolean", "taintedInsideMethod", ")", "{", "BugInstance", "bug", "=", "new", "BugInstance", "(", "detector", ",", "bugType", ",", "originalPriority", ")", ";", "bug", ".", "addClassAndMethod", "(", "classContext", ".", "getJavaClass", "(", ")", ",", "method", ")", ";", "bug", ".", "addSourceLine", "(", "SourceLineAnnotation", ".", "fromVisitedInstruction", "(", "classContext", ",", "method", ",", "instructionHandle", ")", ")", ";", "addMessage", "(", "bug", ",", "\"Sink method\"", ",", "sinkMethod", ")", ";", "addMessage", "(", "bug", ",", "\"Sink parameter\"", ",", "String", ".", "valueOf", "(", "parameterOffset", ")", ")", ";", "for", "(", "UnknownSource", "source", ":", "sources", ")", "{", "if", "(", "source", ".", "getSourceType", "(", ")", "==", "UnknownSourceType", ".", "FIELD", ")", "{", "addMessage", "(", "bug", ",", "\"Unknown source\"", ",", "source", ".", "getSignatureField", "(", ")", ")", ";", "}", "else", "if", "(", "source", ".", "getSourceType", "(", ")", "==", "UnknownSourceType", ".", "RETURN", ")", "{", "if", "(", "isExclude", "(", "source", ".", "getSignatureMethod", "(", ")", ")", ")", "continue", ";", "addMessage", "(", "bug", ",", "\"Unknown source\"", ",", "source", ".", "getSignatureMethod", "(", ")", ")", ";", "}", "// if(isExclude(source.getTaintSource())) { continue; }", "// addMessage(bug, \"Unknown source\", source.getTaintSource());", "}", "if", "(", "sinkPriority", "!=", "UNKNOWN_SINK_PRIORITY", ")", "{", "// higher priority is represented by lower integer", "if", "(", "sinkPriority", "<", "originalPriority", ")", "{", "bug", ".", "setPriority", "(", "sinkPriority", ")", ";", "addMessage", "(", "bug", ",", "\"Method usage\"", ",", "\"with tainted arguments detected\"", ")", ";", "}", "else", "if", "(", "sinkPriority", ">", "originalPriority", ")", "{", "bug", ".", "setPriority", "(", "Priorities", ".", "LOW_PRIORITY", ")", ";", "addMessage", "(", "bug", ",", "\"Method usage\"", ",", "\"detected only with safe arguments\"", ")", ";", "}", "}", "else", "if", "(", "!", "taintedInsideMethod", ")", "{", "addMessage", "(", "bug", ",", "\"Method usage\"", ",", "\"not detected\"", ")", ";", "}", "Collections", ".", "sort", "(", "lines", ")", ";", "SourceLineAnnotation", "annotation", "=", "null", ";", "for", "(", "Iterator", "<", "SourceLineAnnotation", ">", "it", "=", "lines", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "SourceLineAnnotation", "prev", "=", "annotation", ";", "annotation", "=", "it", ".", "next", "(", ")", ";", "if", "(", "prev", "!=", "null", "&&", "prev", ".", "getClassName", "(", ")", ".", "equals", "(", "annotation", ".", "getClassName", "(", ")", ")", "&&", "prev", ".", "getStartLine", "(", ")", "==", "annotation", ".", "getStartLine", "(", ")", ")", "{", "// keep only one annotation per line", "it", ".", "remove", "(", ")", ";", "}", "}", "for", "(", "SourceLineAnnotation", "sourceLine", ":", "lines", ")", "{", "bug", ".", "addSourceLine", "(", "sourceLine", ")", ";", "}", "return", "bug", ";", "}" ]
Uses immutable values, updated priority and added lines for reporting @param taintedInsideMethod true if not influenced by method arguments @return new bug instance filled with information
[ "Uses", "immutable", "values", "updated", "priority", "and", "added", "lines", "for", "reporting" ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/injection/InjectionSink.java#L141-L188
16,598
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintFrameModelingVisitor.java
TaintFrameModelingVisitor.finishAnalysis
public void finishAnalysis() { assert analyzedMethodConfig != null; Taint outputTaint = analyzedMethodConfig.getOutputTaint(); if (outputTaint == null) { // void methods return; } String returnType = getReturnType(methodDescriptor.getSignature()); if (taintConfig.isClassTaintSafe(returnType) && outputTaint.getState() != Taint.State.NULL) { // we do not have to store summaries with safe output return; } String realInstanceClassName = outputTaint.getRealInstanceClassName(); if (returnType.equals("L" + realInstanceClassName + ";")) { // storing it in method summary is useless outputTaint.setRealInstanceClass(null); analyzedMethodConfig.setOuputTaint(outputTaint); } String className = methodDescriptor.getSlashedClassName(); String methodId = "." + methodDescriptor.getName() + methodDescriptor.getSignature(); if (analyzedMethodConfig.isInformative() || taintConfig.getSuperMethodConfig(className, methodId) != null) { String fullMethodName = className.concat(methodId); if (!taintConfig.containsKey(fullMethodName)) { // prefer configured summaries to derived taintConfig.put(fullMethodName, analyzedMethodConfig); } } }
java
public void finishAnalysis() { assert analyzedMethodConfig != null; Taint outputTaint = analyzedMethodConfig.getOutputTaint(); if (outputTaint == null) { // void methods return; } String returnType = getReturnType(methodDescriptor.getSignature()); if (taintConfig.isClassTaintSafe(returnType) && outputTaint.getState() != Taint.State.NULL) { // we do not have to store summaries with safe output return; } String realInstanceClassName = outputTaint.getRealInstanceClassName(); if (returnType.equals("L" + realInstanceClassName + ";")) { // storing it in method summary is useless outputTaint.setRealInstanceClass(null); analyzedMethodConfig.setOuputTaint(outputTaint); } String className = methodDescriptor.getSlashedClassName(); String methodId = "." + methodDescriptor.getName() + methodDescriptor.getSignature(); if (analyzedMethodConfig.isInformative() || taintConfig.getSuperMethodConfig(className, methodId) != null) { String fullMethodName = className.concat(methodId); if (!taintConfig.containsKey(fullMethodName)) { // prefer configured summaries to derived taintConfig.put(fullMethodName, analyzedMethodConfig); } } }
[ "public", "void", "finishAnalysis", "(", ")", "{", "assert", "analyzedMethodConfig", "!=", "null", ";", "Taint", "outputTaint", "=", "analyzedMethodConfig", ".", "getOutputTaint", "(", ")", ";", "if", "(", "outputTaint", "==", "null", ")", "{", "// void methods", "return", ";", "}", "String", "returnType", "=", "getReturnType", "(", "methodDescriptor", ".", "getSignature", "(", ")", ")", ";", "if", "(", "taintConfig", ".", "isClassTaintSafe", "(", "returnType", ")", "&&", "outputTaint", ".", "getState", "(", ")", "!=", "Taint", ".", "State", ".", "NULL", ")", "{", "// we do not have to store summaries with safe output", "return", ";", "}", "String", "realInstanceClassName", "=", "outputTaint", ".", "getRealInstanceClassName", "(", ")", ";", "if", "(", "returnType", ".", "equals", "(", "\"L\"", "+", "realInstanceClassName", "+", "\";\"", ")", ")", "{", "// storing it in method summary is useless", "outputTaint", ".", "setRealInstanceClass", "(", "null", ")", ";", "analyzedMethodConfig", ".", "setOuputTaint", "(", "outputTaint", ")", ";", "}", "String", "className", "=", "methodDescriptor", ".", "getSlashedClassName", "(", ")", ";", "String", "methodId", "=", "\".\"", "+", "methodDescriptor", ".", "getName", "(", ")", "+", "methodDescriptor", ".", "getSignature", "(", ")", ";", "if", "(", "analyzedMethodConfig", ".", "isInformative", "(", ")", "||", "taintConfig", ".", "getSuperMethodConfig", "(", "className", ",", "methodId", ")", "!=", "null", ")", "{", "String", "fullMethodName", "=", "className", ".", "concat", "(", "methodId", ")", ";", "if", "(", "!", "taintConfig", ".", "containsKey", "(", "fullMethodName", ")", ")", "{", "// prefer configured summaries to derived", "taintConfig", ".", "put", "(", "fullMethodName", ",", "analyzedMethodConfig", ")", ";", "}", "}", "}" ]
This method must be called from outside at the end of the method analysis
[ "This", "method", "must", "be", "called", "from", "outside", "at", "the", "end", "of", "the", "method", "analysis" ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/TaintFrameModelingVisitor.java#L770-L798
16,599
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/crypto/WeakTrustManagerDetector.java
WeakTrustManagerDetector.isEmptyImplementation
private boolean isEmptyImplementation(MethodGen methodGen){ boolean invokeInst = false; boolean loadField = false; for (Iterator itIns = methodGen.getInstructionList().iterator();itIns.hasNext();) { Instruction inst = ((InstructionHandle) itIns.next()).getInstruction(); if (DEBUG) System.out.println(inst.toString(true)); if (inst instanceof InvokeInstruction) { invokeInst = true; } if (inst instanceof GETFIELD) { loadField = true; } } return !invokeInst && !loadField; }
java
private boolean isEmptyImplementation(MethodGen methodGen){ boolean invokeInst = false; boolean loadField = false; for (Iterator itIns = methodGen.getInstructionList().iterator();itIns.hasNext();) { Instruction inst = ((InstructionHandle) itIns.next()).getInstruction(); if (DEBUG) System.out.println(inst.toString(true)); if (inst instanceof InvokeInstruction) { invokeInst = true; } if (inst instanceof GETFIELD) { loadField = true; } } return !invokeInst && !loadField; }
[ "private", "boolean", "isEmptyImplementation", "(", "MethodGen", "methodGen", ")", "{", "boolean", "invokeInst", "=", "false", ";", "boolean", "loadField", "=", "false", ";", "for", "(", "Iterator", "itIns", "=", "methodGen", ".", "getInstructionList", "(", ")", ".", "iterator", "(", ")", ";", "itIns", ".", "hasNext", "(", ")", ";", ")", "{", "Instruction", "inst", "=", "(", "(", "InstructionHandle", ")", "itIns", ".", "next", "(", ")", ")", ".", "getInstruction", "(", ")", ";", "if", "(", "DEBUG", ")", "System", ".", "out", ".", "println", "(", "inst", ".", "toString", "(", "true", ")", ")", ";", "if", "(", "inst", "instanceof", "InvokeInstruction", ")", "{", "invokeInst", "=", "true", ";", "}", "if", "(", "inst", "instanceof", "GETFIELD", ")", "{", "loadField", "=", "true", ";", "}", "}", "return", "!", "invokeInst", "&&", "!", "loadField", ";", "}" ]
Currently the detection is pretty weak. It will catch Dummy implementation that have empty method implementation @return If the implementation is "empty" (direct return or dummy code)
[ "Currently", "the", "detection", "is", "pretty", "weak", ".", "It", "will", "catch", "Dummy", "implementation", "that", "have", "empty", "method", "implementation" ]
362da013cef4925e6a1506dd3511fe5bdcc5fba3
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/crypto/WeakTrustManagerDetector.java#L103-L120