name
stringlengths
12
178
code_snippet
stringlengths
8
36.5k
score
float64
3.26
3.68
Activiti_WSOperation_m0_rdh
/** * {@inheritDoc } */ public MessageInstance m0(MessageInstance message, Operation operation, ConcurrentMap<QName, URL> overridenEndpointAddresses) throws Exception { Object[] arguments = this.getArguments(message); Object[] results = this.safeSend(arguments, overridenEndpointAddresses); return this.createResponseMessage(results, operation); }
3.26
Activiti_WSOperation_getName_rdh
/** * {@inheritDoc } */ public String getName() { return this.name; }
3.26
Activiti_WSOperation_getId_rdh
/** * {@inheritDoc } */ public String getId() {return this.id; }
3.26
Activiti_NativeHistoricProcessInstanceQueryImpl_executeList_rdh
// results //////////////////////////////////////////////////////////////// public List<HistoricProcessInstance> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) { return commandContext.getHistoricProcessInstanceEntityManager().findHistoricProcessInstancesByNativeQuery(parameterMap, firstResult, maxResults); }
3.26
Activiti_LongToString_primTransform_rdh
/** * {@inheritDoc } */ @Override protected Object primTransform(Object anObject) throws Exception { return ((Long) (anObject)).toString(); }
3.26
Activiti_TreeMethodExpression_isLiteralText_rdh
/** * * @return <code>true</code> if this is a literal text expression */ @Override public boolean isLiteralText() { return node.isLiteralText(); }
3.26
Activiti_TreeMethodExpression_isDeferred_rdh
/** * Answer <code>true</code> if this is a deferred expression (starting with <code>#{</code>) */public boolean isDeferred() { return deferred; }
3.26
Activiti_TreeMethodExpression_m0_rdh
/** * Evaluates the expression and answers information about the method * * @param context * used to resolve properties (<code>base.property</code> and <code>base[property]</code>) * @return method information or <code>null</code> for literal expressions * @throws ELException * if evaluation fails (e.g. suitable method not found) */ @Overridepublic MethodInfo m0(ELContext context) throws ELException { return node.getMethodInfo(bindings, context, f0, types); }
3.26
Activiti_TreeMethodExpression_invoke_rdh
/** * Evaluates the expression and invokes the method. * * @param context * used to resolve properties (<code>base.property</code> and <code>base[property]</code>) * @param paramValues * @return method result or <code>null</code> if this is a literal text expression * @throws ELException * if evaluation fails (e.g. suitable method not found) */ @Override public Object invoke(ELContext context, Object[] paramValues) throws ELException { return node.invoke(bindings, context, f0, types, paramValues); }
3.26
Activiti_TreeMethodExpression_equals_rdh
/** * Expressions are compared using the concept of a <em>structural id</em>: * variable and function names are anonymized such that two expressions with * same tree structure will also have the same structural id and vice versa. * Two method expressions are equal if * <ol> * <li>their builders are equal</li> * <li>their structural id's are equal</li> * <li>their bindings are equal</li> * <li>their expected types match</li> * <li>their parameter types are equal</li> * </ol> */ @Override public boolean equals(Object obj) { if ((obj != null) && (obj.getClass() == getClass())) { TreeMethodExpression other = ((TreeMethodExpression) (obj)); if (!builder.equals(other.builder)) { return false; } if (f0 != other.f0) { return false; } if (!Arrays.equals(types, other.types)) { return false; } return getStructuralId().equals(other.getStructuralId()) && bindings.equals(other.bindings); } return false; }
3.26
Activiti_TreeMethodExpression_isParametersProvided_rdh
/** * * @return <code>true</code> if this is a method invocation expression */ @Override public boolean isParametersProvided() { return node.isMethodInvocation(); }
3.26
Activiti_TreeMethodExpression_dump_rdh
/** * Print the parse tree. * * @param writer */ public void dump(PrintWriter writer) { NodePrinter.dump(writer, node); }
3.26
Activiti_UserTaskParseHandler_getHandledType_rdh
/** */
3.26
Activiti_ExclusiveGatewayActivityBehavior_leave_rdh
/** * The default behaviour of BPMN, taking every outgoing sequence flow (where the condition evaluates to true), is not valid for an exclusive gateway. * * Hence, this behaviour is overridden and replaced by the correct behavior: selecting the first sequence flow which condition evaluates to true (or which hasn't got a condition) and leaving the * activity through that sequence flow. * * If no sequence flow is selected (ie all conditions evaluate to false), then the default sequence flow is taken (if defined). */ @Override public void leave(DelegateExecution execution) {if (log.isDebugEnabled()) { log.debug("Leaving exclusive gateway '{}'", execution.getCurrentActivityId());} ExclusiveGateway exclusiveGateway = ((ExclusiveGateway) (execution.getCurrentFlowElement())); if ((Context.getProcessEngineConfiguration() != null) && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createActivityEvent(ActivitiEventType.ACTIVITY_COMPLETED, execution, exclusiveGateway)); } SequenceFlow outgoingSequenceFlow = null; SequenceFlow defaultSequenceFlow = null; String defaultSequenceFlowId = exclusiveGateway.getDefaultFlow(); // Determine sequence flow to take Iterator<SequenceFlow> sequenceFlowIterator = exclusiveGateway.getOutgoingFlows().iterator(); while ((outgoingSequenceFlow == null) && sequenceFlowIterator.hasNext()) { SequenceFlow sequenceFlow = sequenceFlowIterator.next(); String skipExpressionString = sequenceFlow.getSkipExpression(); if (!SkipExpressionUtil.isSkipExpressionEnabled(execution, skipExpressionString)) { boolean conditionEvaluatesToTrue = ConditionUtil.hasTrueCondition(sequenceFlow, execution); if (conditionEvaluatesToTrue && ((defaultSequenceFlowId == null) || (!defaultSequenceFlowId.equals(sequenceFlow.getId())))) { if (log.isDebugEnabled()) { log.debug("Sequence flow '{}'selected as outgoing sequence flow.", sequenceFlow.getId()); } outgoingSequenceFlow = sequenceFlow; } } else if (SkipExpressionUtil.shouldSkipFlowElement(Context.getCommandContext(), execution, skipExpressionString)) { outgoingSequenceFlow = sequenceFlow; } // Already store it, if we would need it later. Saves one for loop. if ((defaultSequenceFlowId != null) && defaultSequenceFlowId.equals(sequenceFlow.getId())) { defaultSequenceFlow = sequenceFlow; } } // We have to record the end here, or else we're already past it Context.getCommandContext().getHistoryManager().recordActivityEnd(((ExecutionEntity) (execution)), null); // Leave the gateway if (outgoingSequenceFlow != null) { execution.setCurrentFlowElement(outgoingSequenceFlow); } else if (defaultSequenceFlow != null) { execution.setCurrentFlowElement(defaultSequenceFlow); } else { // No sequence flow could be found, not even a default one throw new ActivitiException(("No outgoing sequence flow of the exclusive gateway '" + exclusiveGateway.getId()) + "' could be selected for continuing the process"); } super.leave(execution); }
3.26
Activiti_LongToInteger_primTransform_rdh
/** * {@inheritDoc } */ @Override protected Object primTransform(Object anObject) throws Exception { return Integer.valueOf(((Long) (anObject)).toString()); }
3.26
Activiti_BusinessRuleParseHandler_getHandledType_rdh
/** */public class BusinessRuleParseHandler extends AbstractActivityBpmnParseHandler<BusinessRuleTask> { public Class<? extends BaseElement> getHandledType() { return BusinessRuleTask.class; }
3.26
Activiti_Activiti_signallingMessageHandler_rdh
/** * Any message that enters this {@link org.springframework.messaging.MessageHandler} * containing a {@code executionId} parameter will trigger a * {@link org.activiti.engine.RuntimeService#signalEventReceived(String)}. */ public static MessageHandler signallingMessageHandler(final ProcessEngine processEngine) { return new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { String executionId = (message.getHeaders().containsKey("executionId")) ? ((String) (message.getHeaders().get("executionId"))) : ((String) (null)); if (null != executionId) processEngine.getRuntimeService().trigger(executionId); } }; }
3.26
Activiti_TablePage_getTotal_rdh
/** * * @return the total rowcount of the table from which this page is only a subset. */ public long getTotal() { return total; }
3.26
Activiti_TablePage_getRows_rdh
/** * * @return the actual table content. */ public List<Map<String, Object>> getRows() { return rowData; }
3.26
Activiti_TablePage_getFirstResult_rdh
/** * * @return the start index of this page (ie the index of the first element in the page) */ public long getFirstResult() { return firstResult; }
3.26
Activiti_TablePage_getSize_rdh
/** * * @return the actual number of rows in this page. */ public long getSize() { return rowData.size(); }
3.26
Activiti_Builder_main_rdh
/** * Dump out abstract syntax tree for a given expression * * @param args * array with one element, containing the expression string */ public static void main(String[] args) { if (args.length != 1) { System.err.println(("usage: java " + Builder.class.getName()) + " <expression string>"); System.exit(1); } PrintWriter out = new PrintWriter(System.out); Tree tree = null; try { tree = new Builder(Feature.METHOD_INVOCATIONS).build(args[0]); } catch (TreeBuilderException e) { System.out.println(e.getMessage()); System.exit(0); } NodePrinter.dump(out, tree.getRoot()); if ((!tree.getFunctionNodes().iterator().hasNext()) && (!tree.getIdentifierNodes().iterator().hasNext())) { ELContext context = new ELContext() {@Overridepublic VariableMapper getVariableMapper() { return null;} @Override public FunctionMapper getFunctionMapper() {return null; } @Override public ELResolver getELResolver() { return null; } }; out.print(">> "); try { out.println(tree.getRoot().getValue(new Bindings(null, null), context, null));} catch (ELException e) { out.println(e.getMessage()); } } out.flush(); }
3.26
Activiti_Builder_isEnabled_rdh
/** * * @return <code>true</code> iff the specified feature is supported. */ public boolean isEnabled(Feature feature) { return features.contains(feature); }
3.26
Activiti_Builder_build_rdh
/** * Parse expression. */ public Tree build(String expression) throws TreeBuilderException { try { return createParser(expression).tree(); } catch (Scanner.ScanException e) { throw new TreeBuilderException(expression, e.position, e.encountered, e.expected, e.getMessage()); } catch (ParseException e) { throw new TreeBuilderException(expression, e.position, e.encountered, e.expected, e.getMessage()); } }
3.26
Activiti_DelegateExpressionTransactionDependentExecutionListener_m0_rdh
/** * returns the expression text for this execution listener. Comes in handy if you want to check which listeners you already have. */ public String m0() { return expression.getExpressionText();}
3.26
Activiti_AbstractProcessEngineConfiguration_springProcessEngineBean_rdh
/** * Provides sane definitions for the various beans required to be productive with Activiti in Spring. */ public
3.26
Activiti_DelegateHelper_getFieldExpression_rdh
/** * Similar to {@link #getFieldExpression(DelegateExecution, String)}, but for use within a {@link TaskListener}. */ public static Expression getFieldExpression(DelegateTask task, String fieldName) { if (task.getCurrentActivitiListener() != null) { List<FieldExtension> fieldExtensions = task.getCurrentActivitiListener().getFieldExtensions(); if ((fieldExtensions != null) && (fieldExtensions.size() > 0)) { for (FieldExtension fieldExtension : fieldExtensions) { if (fieldName.equals(fieldExtension.getFieldName())) { return createExpressionForField(fieldExtension); } } } } return null; }
3.26
Activiti_DelegateHelper_getField_rdh
/** * Returns the {@link FieldExtension} matching the provided 'fieldName' which * is defined for the current activity of the provided * {@link DelegateExecution}. * <p> * Returns null if no such {@link FieldExtension} can be found. * <p> * If the execution is currently being used for executing an * {@link ExecutionListener}, the field of the listener will be returned. Use * {@link #getFlowElementField(DelegateExecution, String)} or * {@link #getListenerField(DelegateExecution, String)} for specifically * getting the field from either the flow element or the listener. */ public static FieldExtension getField(DelegateExecution execution, String fieldName) { if (isExecutingExecutionListener(execution)) { return getListenerField(execution, fieldName); } else { return getFlowElementField(execution, fieldName); } }
3.26
Activiti_DelegateHelper_getExtensionElements_rdh
/** * Returns for the activityId of the passed {@link DelegateExecution} the * {@link Map} of {@link ExtensionElement} instances. These represent the * extension elements defined in the BPMN 2.0 XML as part of that particular * activity. * <p> * If the execution is currently being used for executing an * {@link ExecutionListener}, the extension elements of the listener will be * used. Use the {@link #getFlowElementExtensionElements(DelegateExecution)} * or {@link #getListenerExtensionElements(DelegateExecution)} instead to * specifically get the extension elements of either the flow element or the * listener. */ public static Map<String, List<ExtensionElement>> getExtensionElements(DelegateExecution execution) { if (isExecutingExecutionListener(execution)) { return m0(execution); } else { return getFlowElementExtensionElements(execution);} }
3.26
Activiti_DelegateHelper_getBpmnModel_rdh
/** * Returns the {@link BpmnModel} matching the process definition bpmn model * for the process definition of the passed {@link DelegateExecution}. */ public static BpmnModel getBpmnModel(DelegateExecution execution) { if (execution == null) { throw new ActivitiException("Null execution passed"); } return ProcessDefinitionUtil.getBpmnModel(execution.getProcessDefinitionId()); }
3.26
Activiti_DelegateHelper_isExecutingExecutionListener_rdh
/** * Returns whether or not the provided execution is being use for executing an {@link ExecutionListener}. */ public static boolean isExecutingExecutionListener(DelegateExecution execution) {return execution.getCurrentActivitiListener() != null; }
3.26
Activiti_DelegateHelper_leaveDelegate_rdh
/** * To be used in an {@link ActivityBehavior} or {@link JavaDelegate}: leaves * the current activity via one specific sequenceflow. */ public static void leaveDelegate(DelegateExecution delegateExecution, String sequenceFlowId) { String v0 = delegateExecution.getProcessDefinitionId(); Process process = ProcessDefinitionUtil.getProcess(v0); FlowElement flowElement = process.getFlowElement(sequenceFlowId); if (flowElement instanceof SequenceFlow) { delegateExecution.setCurrentFlowElement(flowElement); Context.getAgenda().planTakeOutgoingSequenceFlowsOperation(((ExecutionEntity) (delegateExecution)), false); } else { throw new ActivitiException(sequenceFlowId + " does not match a sequence flow"); } }
3.26
Activiti_DelegateHelper_getFlowElement_rdh
/** * Returns the current {@link FlowElement} where the {@link DelegateExecution} is currently at. */ public static FlowElement getFlowElement(DelegateExecution execution) { BpmnModel bpmnModel = getBpmnModel(execution); FlowElement flowElement = bpmnModel.getFlowElement(execution.getCurrentActivityId()); if (flowElement == null) { throw new ActivitiException("Could not find a FlowElement for activityId " + execution.getCurrentActivityId()); } return flowElement; }
3.26
Activiti_DelegateHelper_createExpressionForField_rdh
/** * Creates an {@link Expression} for the {@link FieldExtension}. */ public static Expression createExpressionForField(FieldExtension fieldExtension) { if (StringUtils.isNotEmpty(fieldExtension.getExpression())) { ExpressionManager v10 = Context.getProcessEngineConfiguration().getExpressionManager(); return v10.createExpression(fieldExtension.getExpression()); } else { return new FixedValue(fieldExtension.getStringValue()); } }
3.26
Activiti_DelegateHelper_getFields_rdh
/** * Returns the list of field extensions, represented as instances of * {@link FieldExtension}, for the current activity of the passed * {@link DelegateExecution}. * <p> * If the execution is currently being used for executing an * {@link ExecutionListener}, the fields of the listener will be returned. Use * {@link #getFlowElementFields(DelegateExecution)} or * {@link #getListenerFields(DelegateExecution)} if needing the flow element * of listener fields specifically. */public static List<FieldExtension> getFields(DelegateExecution execution) { if (isExecutingExecutionListener(execution)) { return getListenerFields(execution); } else { return getFlowElementFields(execution); } }
3.26
Activiti_TreeStore_get_rdh
/** * Get a {@link Tree}. * If a tree for the given expression is present in the cache, it is * taken from there; otherwise, the expression string is parsed and * the resulting tree is added to the cache. * * @param expression * expression string * @return expression tree */ public Tree get(String expression) throws TreeBuilderException { if (cache == null) { return builder.build(expression); }Tree tree = cache.get(expression); if (tree == null) { cache.put(expression, tree = builder.build(expression)); } return tree; }
3.26
Activiti_TreeValueExpression_getValue_rdh
/** * Evaluates the expression as an rvalue and answers the result. * * @param context * used to resolve properties (<code>base.property</code> and <code>base[property]</code>) * and to determine the result from the last base/property pair * @return rvalue evaluation result * @throws ELException * if evaluation fails (e.g. property not found, type conversion failed, ...) */ @Override public Object getValue(ELContext context) throws ELException { return node.getValue(bindings, context, type);}
3.26
Activiti_TreeValueExpression_isLiteralText_rdh
/** * * @return <code>true</code> if this is a literal text expression */ @Override public boolean isLiteralText() { return node.isLiteralText(); }
3.26
Activiti_TreeValueExpression_isDeferred_rdh
/** * Answer <code>true</code> if this is a deferred expression (containing * sub-expressions starting with <code>#{</code>) */ public boolean isDeferred() { return deferred; }
3.26
Activiti_TreeValueExpression_equals_rdh
/** * Expressions are compared using the concept of a <em>structural id</em>: * variable and function names are anonymized such that two expressions with * same tree structure will also have the same structural id and vice versa. * Two value expressions are equal if * <ol> * <li>their structural id's are equal</li> * <li>their bindings are equal</li> * <li>their expected types are equal</li> * </ol> */ @Override public boolean equals(Object obj) { if ((obj != null) && (obj.getClass() == getClass())) { TreeValueExpression other = ((TreeValueExpression) (obj)); if (!builder.equals(other.builder)) { return false; } if (type != other.type) { return false; } return getStructuralId().equals(other.getStructuralId()) && bindings.equals(other.bindings);} return false; }
3.26
Activiti_TreeValueExpression_getType_rdh
/** * Evaluates the expression as an lvalue and answers the result type. * * @param context * used to resolve properties (<code>base.property</code> and <code>base[property]</code>) * and to determine the result from the last base/property pair * @return lvalue evaluation type or <code>null</code> for rvalue expressions * @throws ELException * if evaluation fails (e.g. property not found, type conversion failed, ...) */ @Override public Class<?> getType(ELContext context) throws ELException { return node.getType(bindings, context); }
3.26
Activiti_TreeValueExpression_setValue_rdh
/** * Evaluates the expression as an lvalue and assigns the given value. * * @param context * used to resolve properties (<code>base.property</code> and <code>base[property]</code>) * and to perform the assignment to the last base/property pair * @throws ELException * if evaluation fails (e.g. property not found, type conversion failed, assignment failed...) */ @Override public void setValue(ELContext context, Object value) throws ELException { node.setValue(bindings, context, value); }
3.26
Activiti_TreeValueExpression_isReadOnly_rdh
/** * Evaluates the expression as an lvalue and determines if {@link #setValue(ELContext, Object)} * will always fail. * * @param context * used to resolve properties (<code>base.property</code> and <code>base[property]</code>) * and to determine the result from the last base/property pair * @return <code>true</code> if {@link #setValue(ELContext, Object)} always fails. * @throws ELException * if evaluation fails (e.g. property not found, type conversion failed, ...) */ @Override public boolean isReadOnly(ELContext context) throws ELException { return node.isReadOnly(bindings, context); }
3.26
Activiti_BigDecimalToString_primTransform_rdh
/** * {@inheritDoc } */ @Override protected Object primTransform(Object anObject) throws Exception { return format.format(((BigDecimal) (anObject))); }
3.26
Activiti_ObjectValueExpression_equals_rdh
/** * Two object value expressions are equal if and only if their wrapped objects are equal. */ @Override public boolean equals(Object obj) { if ((obj != null) && (obj.getClass() == getClass())) { ObjectValueExpression other = ((ObjectValueExpression) (obj));if (type != other.type) { return false; } return (object == other.object) || ((object != null) && object.equals(other.object)); } return false; }
3.26
Activiti_ObjectValueExpression_setValue_rdh
/** * Throw an exception. */ @Override public void setValue(ELContext context, Object value) { throw new ELException(LocalMessages.get("error.value.set.rvalue", "<object value expression>")); }
3.26
Activiti_ObjectValueExpression_getType_rdh
/** * Answer <code>null</code>. */@Override public Class<?> getType(ELContext context) { return null; }
3.26
Activiti_NativeHistoricTaskInstanceQueryImpl_executeList_rdh
// results //////////////////////////////////////////////////////////////// public List<HistoricTaskInstance> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) { return commandContext.getHistoricTaskInstanceEntityManager().findHistoricTaskInstancesByNativeQuery(parameterMap, firstResult, maxResults); }
3.26
Activiti_AstNode_findPublicAccessibleMethod_rdh
/** * Find accessible method. Searches the inheritance tree of the class declaring * the method until it finds a method that can be invoked. * * @param method * method * @return accessible method or <code>null</code> */ private static Method findPublicAccessibleMethod(Method method) { if ((method == null) || (!Modifier.isPublic(method.getModifiers()))) { return null; } if (method.isAccessible() || Modifier.isPublic(method.getDeclaringClass().getModifiers())) { return method;} for (Class<?> cls : method.getDeclaringClass().getInterfaces()) { Method mth = null; try { mth = findPublicAccessibleMethod(cls.getMethod(method.getName(), method.getParameterTypes())); if (mth != null) { return mth; } } catch (NoSuchMethodException ignore) { // do nothing } } Class<?> cls = method.getDeclaringClass().getSuperclass(); if (cls != null) { Method mth = null; try { mth = findPublicAccessibleMethod(cls.getMethod(method.getName(), method.getParameterTypes())); if (mth != null) { return mth; } } catch (NoSuchMethodException ignore) { // do nothing } } return null; }
3.26
Activiti_AstNode_getValue_rdh
/** * evaluate and return the (optionally coerced) result. */ public final Object getValue(Bindings bindings, ELContext context, Class<?> type) { Object value = eval(bindings, context); if (type != null) { value = bindings.convert(value, type); } return value; }
3.26
Activiti_DefaultServiceTaskBehavior_execute_rdh
/** * We have two different implementation strategy that can be executed * in according if we have a connector action definition match or not. */ @Override public void execute(DelegateExecution execution) { Connector connector = getConnector(getImplementation(execution)); IntegrationContext integrationContext = connector.apply(integrationContextBuilder.from(execution)); variablesPropagator.propagate(execution, integrationContext.getOutBoundVariables()); leave(execution); }
3.26
Activiti_StringToBoolean_primTransform_rdh
/** * Transforms a {@link String} to a {@link Boolean} */public class StringToBoolean extends AbstractTransformer { @Override protected Object primTransform(Object anObject) throws Exception {return Boolean.valueOf(((String) (anObject))); }
3.26
Activiti_TimerManager_removeObsoleteTimers_rdh
/** * Manages timers for newly-deployed process definitions and their previous versions. */public class TimerManager { protected void removeObsoleteTimers(ProcessDefinitionEntity processDefinition) { List<TimerJobEntity> jobsToDelete = null; if ((processDefinition.getTenantId() != null) && (!ProcessEngineConfiguration.NO_TENANT_ID.equals(processDefinition.getTenantId()))) { jobsToDelete = Context.getCommandContext().getTimerJobEntityManager().findJobsByTypeAndProcessDefinitionKeyAndTenantId(TimerStartEventJobHandler.TYPE, processDefinition.getKey(), processDefinition.getTenantId()); } else { jobsToDelete = Context.getCommandContext().getTimerJobEntityManager().findJobsByTypeAndProcessDefinitionKeyNoTenantId(TimerStartEventJobHandler.TYPE, processDefinition.getKey()); } if (jobsToDelete != null) { for (TimerJobEntity job : jobsToDelete) { new CancelJobsCmd(job.getId()).execute(Context.getCommandContext());} } }
3.26
Activiti_AbstractTransformer_transform_rdh
/** * {@inheritDoc } */ public Object transform(Object anObject) { try { return this.primTransform(anObject);} catch (Exception e) { throw new ActivitiException((("Error while executing transformation from object: " + anObject) + " using transformer ") + this); } }
3.26
Activiti_NativeHistoricActivityInstanceQueryImpl_m0_rdh
// results //////////////////////////////////////////////////////////////// public List<HistoricActivityInstance> m0(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) { return commandContext.getHistoricActivityInstanceEntityManager().findHistoricActivityInstancesByNativeQuery(parameterMap, firstResult, maxResults); }
3.26
Activiti_IoUtil_closeSilently_rdh
/** * Closes the given stream. The same as calling {@link OutputStream#close()} , but errors while closing are silently ignored. */ public static void closeSilently(OutputStream outputStream) { try {if (outputStream != null) { outputStream.close(); } } catch (IOException ignore) { // Exception is silently ignored } }
3.26
Activiti_ScriptingEngines_createBindings_rdh
/** * override to build a spring aware ScriptingEngines */ protected Bindings createBindings(VariableScope variableScope, boolean storeScriptVariables) { return scriptBindingsFactory.createBindings(variableScope, storeScriptVariables); }
3.26
Activiti_ActivitiEventDispatcherImpl_extractBpmnModelFromEvent_rdh
/** * In case no process-context is active, this method attempts to extract a process-definition based on the event. In case it's an event related to an entity, this can be deducted by inspecting the * entity, without additional queries to the database. * * If not an entity-related event, the process-definition will be retrieved based on the processDefinitionId (if filled in). This requires an additional query to the database in case not already * cached. However, queries will only occur when the definition is not yet in the cache, which is very unlikely to happen, unless evicted. * * @param event * @return */ protected BpmnModel extractBpmnModelFromEvent(ActivitiEvent event) { BpmnModel result = null; if ((result == null) && (event.getProcessDefinitionId() != null)) { ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(event.getProcessDefinitionId(), true); if (processDefinition != null) { result = Context.getProcessEngineConfiguration().getDeploymentManager().resolveProcessDefinition(processDefinition).getBpmnModel(); } } return result; }
3.26
Activiti_BaseEntityEventListener_onCreate_rdh
/** * Called when an entity create event is received. */ protected void onCreate(ActivitiEvent event) { // Default implementation is a NO-OP }
3.26
Activiti_BaseEntityEventListener_onEntityEvent_rdh
/** * Called when an event is received, which is not a create, an update or delete. */ protected void onEntityEvent(ActivitiEvent event) {// Default implementation is a NO-OP }
3.26
Activiti_BaseEntityEventListener_onDelete_rdh
/** * Called when an entity delete event is received. */ protected void onDelete(ActivitiEvent event) { // Default implementation is a NO-OP }
3.26
Activiti_BaseEntityEventListener_onInitialized_rdh
/** * Called when an entity initialized event is received. */ protected void onInitialized(ActivitiEvent event) {// Default implementation is a NO-OP }
3.26
Activiti_BaseEntityEventListener_m0_rdh
/** * * @return true, if the event is an {@link ActivitiEntityEvent} and (if needed) the entityClass set in this instance, is assignable from the entity class in the event. */ protected boolean m0(ActivitiEvent event) { boolean valid = false; if (event instanceof ActivitiEntityEvent) {if (entityClass == null) { valid = true; } else { valid = entityClass.isAssignableFrom(((ActivitiEntityEvent) (event)).getEntity().getClass()); } }return valid;}
3.26
Activiti_BpmnDeploymentHelper_setResourceNamesOnProcessDefinitions_rdh
/** * Updates all the process definition entities to have the correct resource names. */ public void setResourceNamesOnProcessDefinitions(ParsedDeployment parsedDeployment) { for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) { String resourceName = parsedDeployment.getResourceForProcessDefinition(processDefinition).getName(); processDefinition.setResourceName(resourceName); } }
3.26
Activiti_BpmnDeploymentHelper_copyDeploymentValuesToProcessDefinitions_rdh
/** * Updates all the process definition entities to match the deployment's values for tenant, * engine version, and deployment id. */ public void copyDeploymentValuesToProcessDefinitions(DeploymentEntity deployment, List<ProcessDefinitionEntity> processDefinitions) { String engineVersion = deployment.getEngineVersion(); String tenantId = deployment.getTenantId(); String deploymentId = deployment.getId(); for (ProcessDefinitionEntity processDefinition : processDefinitions) { // Backwards compatibility if (engineVersion != null) { processDefinition.setEngineVersion(engineVersion); } // process definition inherits the tenant id if (tenantId != null) { processDefinition.setTenantId(tenantId); } processDefinition.setDeploymentId(deploymentId); } }
3.26
Activiti_BpmnDeploymentHelper_getMostRecentVersionOfProcessDefinition_rdh
/** * Gets the most recent persisted process definition that matches this one for tenant and key. * If none is found, returns null. This method assumes that the tenant and key are properly * set on the process definition entity. */ public ProcessDefinitionEntity getMostRecentVersionOfProcessDefinition(ProcessDefinitionEntity processDefinition) { String key = processDefinition.getKey(); String tenantId = processDefinition.getTenantId(); ProcessDefinitionEntityManager processDefinitionManager = Context.getCommandContext().getProcessEngineConfiguration().getProcessDefinitionEntityManager(); ProcessDefinitionEntity existingDefinition = null; if ((tenantId != null) && (!tenantId.equals(ProcessEngineConfiguration.NO_TENANT_ID))) { existingDefinition = processDefinitionManager.findLatestProcessDefinitionByKeyAndTenantId(key, tenantId); } else { existingDefinition = processDefinitionManager.findLatestProcessDefinitionByKey(key); } return existingDefinition; }
3.26
Activiti_BpmnDeploymentHelper_verifyProcessDefinitionsDoNotShareKeys_rdh
/** * Verifies that no two process definitions share the same key, to prevent database unique * index violation. * * @throws ActivitiException * if any two processes have the same key */ public void verifyProcessDefinitionsDoNotShareKeys(Collection<ProcessDefinitionEntity> processDefinitions) { Set<String> keySet = new LinkedHashSet<String>(); for (ProcessDefinitionEntity processDefinition : processDefinitions) { if (keySet.contains(processDefinition.getKey())) { throw new ActivitiException("The deployment contains process definitions with the same key (process id attribute), this is not allowed"); } keySet.add(processDefinition.getKey()); } }
3.26
Activiti_BpmnDeploymentHelper_updateTimersAndEvents_rdh
/** * Updates all timers and events for the process definition. This removes obsolete message and signal * subscriptions and timers, and adds new ones. */ public void updateTimersAndEvents(ProcessDefinitionEntity processDefinition, ProcessDefinitionEntity previousProcessDefinition, ParsedDeployment parsedDeployment) { Process process = parsedDeployment.getProcessModelForProcessDefinition(processDefinition); BpmnModel bpmnModel = parsedDeployment.getBpmnModelForProcessDefinition(processDefinition); eventSubscriptionManager.removeObsoleteMessageEventSubscriptions(previousProcessDefinition); eventSubscriptionManager.addMessageEventSubscriptions(processDefinition, process, bpmnModel); eventSubscriptionManager.removeObsoleteSignalEventSubScription(previousProcessDefinition); eventSubscriptionManager.addSignalEventSubscriptions(Context.getCommandContext(), processDefinition, process, bpmnModel); timerManager.removeObsoleteTimers(processDefinition); timerManager.scheduleTimers(processDefinition, process); }
3.26
Activiti_BpmnDeploymentHelper_getPersistedInstanceOfProcessDefinition_rdh
/** * Gets the persisted version of the already-deployed process definition. Note that this is * different from {@link #getMostRecentVersionOfProcessDefinition} as it looks specifically for * a process definition that is already persisted and attached to a particular deployment, * rather than the latest version across all deployments. */ public ProcessDefinitionEntity getPersistedInstanceOfProcessDefinition(ProcessDefinitionEntity processDefinition) { String deploymentId = processDefinition.getDeploymentId(); if (StringUtils.isEmpty(processDefinition.getDeploymentId())) { throw new IllegalStateException("Provided process definition must have a deployment id."); } ProcessDefinitionEntityManager processDefinitionManager = Context.getCommandContext().getProcessEngineConfiguration().getProcessDefinitionEntityManager(); ProcessDefinitionEntity persistedProcessDefinition = null; if ((processDefinition.getTenantId() == null) || ProcessEngineConfiguration.NO_TENANT_ID.equals(processDefinition.getTenantId())) { persistedProcessDefinition = processDefinitionManager.findProcessDefinitionByDeploymentAndKey(deploymentId, processDefinition.getKey()); } else { persistedProcessDefinition = processDefinitionManager.findProcessDefinitionByDeploymentAndKeyAndTenantId(deploymentId, processDefinition.getKey(), processDefinition.getTenantId()); }return persistedProcessDefinition; }
3.26
Activiti_ExecutionGraphUtil_isReachable_rdh
/** * Verifies if the element with the given source identifier can reach the element with the target identifier through following sequence flow. */ public static boolean isReachable(String processDefinitionId, String sourceElementId, String targetElementId) { // Fetch source and target elements Process process = ProcessDefinitionUtil.getProcess(processDefinitionId); FlowElement sourceFlowElement = process.getFlowElement(sourceElementId, true); FlowNode sourceElement = null; if (sourceFlowElement instanceof FlowNode) { sourceElement = ((FlowNode) (sourceFlowElement)); } else if (sourceFlowElement instanceof SequenceFlow) { sourceElement = ((FlowNode) (((SequenceFlow) (sourceFlowElement)).getTargetFlowElement())); } FlowElement targetFlowElement = process.getFlowElement(targetElementId, true); FlowNode targetElement = null; if (targetFlowElement instanceof FlowNode) { targetElement = ((FlowNode) (targetFlowElement)); } else if (targetFlowElement instanceof SequenceFlow) { targetElement = ((FlowNode) (((SequenceFlow) (targetFlowElement)).getTargetFlowElement())); } if (sourceElement == null) {throw new ActivitiException(((("Invalid sourceElementId '" + sourceElementId) + "': no element found for this id n process definition '") + processDefinitionId) + "'"); } if (targetElement == null) { throw new ActivitiException(((("Invalid targetElementId '" + targetElementId) + "': no element found for this id n process definition '") + processDefinitionId) + "'");} Set<String> visitedElements = new HashSet<String>(); return isReachable(process, sourceElement, targetElement, visitedElements); }
3.26
Activiti_ExecutionGraphUtil_orderFromRootToLeaf_rdh
/** * Takes in a collection of executions belonging to the same process instance. Orders the executions in a list, first elements are the leaf, last element is the root elements. */ public static List<ExecutionEntity> orderFromRootToLeaf(Collection<ExecutionEntity> executions) { List<ExecutionEntity> orderedList = new ArrayList<ExecutionEntity>(executions.size()); // Root elements HashSet<String> previousIds = new HashSet<String>(); for (ExecutionEntity execution : executions) { if (execution.getParentId() == null) { orderedList.add(execution); previousIds.add(execution.getId()); } } // Non-root elements while (orderedList.size() < executions.size()) { for (ExecutionEntity execution : executions) { if ((!previousIds.contains(execution.getId())) && previousIds.contains(execution.getParentId())) { orderedList.add(execution); previousIds.add(execution.getId());} } } return orderedList; }
3.26
Activiti_DelegateExpressionExecutionListener_getExpressionText_rdh
/** * returns the expression text for this execution listener. Comes in handy if you want to check which listeners you already have. */ public String getExpressionText() { return expression.getExpressionText(); }
3.26
Activiti_SimpleContext_getVariableMapper_rdh
/** * Get our variable mapper. */ @Override public VariableMapper getVariableMapper() { if (variables == null) { variables = new Variables(); } return variables;}
3.26
Activiti_SimpleContext_getELResolver_rdh
/** * Get our resolver. Lazy initialize to a {@link SimpleResolver} if necessary. */ @Override public ELResolver getELResolver() { if (resolver == null) { resolver = new SimpleResolver(); } return resolver; }
3.26
Activiti_SimpleContext_setVariable_rdh
/** * Define a variable. */ public ValueExpression setVariable(String name, ValueExpression expression) { if (variables == null) { variables = new Variables(); } return variables.setVariable(name, expression); }
3.26
Activiti_JsonConverterUtil_gatherLongPropertyFromJsonNodes_rdh
// GENERIC /** * Loops through a list of {@link JsonNode} instances, and stores the given property with given type in the returned list. * * In Java 8, this probably could be done a lot cooler. */ public static Set<Long> gatherLongPropertyFromJsonNodes(Iterable<JsonNode> jsonNodes, String propertyName) { Set<Long> result = new HashSet<Long>();// Using a Set to filter out doubles for (JsonNode node : jsonNodes) { if (node.has(propertyName)) { Long propertyValue = node.get(propertyName).asLong(); if (propertyValue > 0) { // Just to be safe result.add(propertyValue); } }} return result; }
3.26
Activiti_JsonConverterUtil_getAppModelReferencedProcessModels_rdh
// APP MODEL public static List<JsonNode> getAppModelReferencedProcessModels(JsonNode appModelJson) { List<JsonNode> result = new ArrayList<JsonNode>(); if (appModelJson.has("models")) { ArrayNode modelsArrayNode = ((ArrayNode) (appModelJson.get("models"))); Iterator<JsonNode> modelArrayIterator = modelsArrayNode.iterator(); while (modelArrayIterator.hasNext()) { result.add(modelArrayIterator.next()); } } return result; }
3.26
Activiti_JsonConverterUtil_getBpmnProcessModelChildShapesPropertyValues_rdh
/** * Usable for BPMN 2.0 editor json: traverses all child shapes (also nested), goes into * the properties and sees if there is a matching property in the * 'properties' of the childshape and returns those in a list. * * Returns a map with said json nodes, with the key the name of the childshape. */ protected static List<JsonLookupResult> getBpmnProcessModelChildShapesPropertyValues(JsonNode editorJsonNode, String propertyName, List<String> allowedStencilTypes) { List<JsonLookupResult> result = new ArrayList<JsonLookupResult>(); internalGetBpmnProcessChildShapePropertyValues(editorJsonNode, propertyName, allowedStencilTypes, result); return result; }
3.26
Activiti_IntegerToString_primTransform_rdh
/** * {@inheritDoc } */ @Override protected Object primTransform(Object anObject) throws Exception { return ((Integer) (anObject)).toString(); }
3.26
Activiti_FlowNodeActivityBehavior_leave_rdh
/** * Default way of leaving a BPMN 2.0 activity: evaluate the conditions on the outgoing sequence flow and take those that evaluate to true. */ public void leave(DelegateExecution execution) { bpmnActivityBehavior.performDefaultOutgoingBehavior(((ExecutionEntity) (execution))); }
3.26
Activiti_FlowNodeActivityBehavior_execute_rdh
/** * Default behaviour: just leave the activity with no extra functionality. */ public void execute(DelegateExecution execution) { leave(execution);}
3.26
Activiti_DelegateExpressionTaskListener_getExpressionText_rdh
/** * returns the expression text for this task listener. Comes in handy if you want to check which listeners you already have. */ public String getExpressionText() { return expression.getExpressionText(); }
3.26
Activiti_ThrowMessage_builder_rdh
/** * Creates builder to build {@link ThrowMessage}. * * @return created builder */ public static INameStage builder() { return new ThrowMessagBuilder(); }
3.26
Activiti_AstFunction_invoke_rdh
/** * Invoke method. * * @param bindings * @param context * @param base * @param method * @return method result * @throws InvocationTargetException * @throws IllegalAccessException */ protected Object invoke(Bindings bindings, ELContext context, Object base, Method method) throws InvocationTargetException, IllegalAccessException { Class<?>[] types = method.getParameterTypes(); Object[] params = null;if (types.length > 0) { params = new Object[types.length]; if (varargs && method.isVarArgs()) { for (int i = 0; i < (params.length - 1); i++) { Object v3 = getParam(i).eval(bindings, context); if ((v3 != null) || types[i].isPrimitive()) { params[i] = bindings.convert(v3, types[i]); } } int varargIndex = types.length - 1; Class<?> varargType = types[varargIndex].getComponentType(); int length = m0() - varargIndex; Object array = null; if (length == 1) { // special: eventually use argument as is Object param = getParam(varargIndex).eval(bindings, context); if ((param != null) && param.getClass().isArray()) { if (types[varargIndex].isInstance(param)) { array = param; } else { // coerce array elements length = Array.getLength(param); array = Array.newInstance(varargType, length); for (int i = 0; i < length; i++) { Object elem = Array.get(param, i); if ((elem != null) || varargType.isPrimitive()) { Array.set(array, i, bindings.convert(elem, varargType)); } } } } else { // single element array array = Array.newInstance(varargType, 1); if ((param != null) || varargType.isPrimitive()) { Array.set(array, 0, bindings.convert(param, varargType)); } } } else { array = Array.newInstance(varargType, length); for (int i = 0; i < length; i++) { Object param = getParam(varargIndex + i).eval(bindings, context); if ((param != null) || varargType.isPrimitive()) { Array.set(array, i, bindings.convert(param, varargType)); } } } params[varargIndex] = array; } else { for (int i = 0; i < params.length; i++) { Object param = getParam(i).eval(bindings, context); if ((param != null) || types[i].isPrimitive()) { params[i] = bindings.convert(param, types[i]); } } } } return method.invoke(base, params);}
3.26
Activiti_StandaloneMybatisTransactionContextFactory_openTransactionContext_rdh
/** */ public class StandaloneMybatisTransactionContextFactory implements TransactionContextFactory {public TransactionContext openTransactionContext(CommandContext commandContext) { return new StandaloneMybatisTransactionContext(commandContext); } }
3.26
Activiti_ComposedTransformer_primTransform_rdh
/** * {@inheritDoc } */ @Override protected Object primTransform(Object anObject) throws Exception { Object current = anObject; for (Transformer transformer : this.transformers) { current = transformer.transform(current); } return current; }
3.26
Activiti_Identity_primTransform_rdh
/** * {@inheritDoc } */ @Override protected Object primTransform(Object anObject) throws Exception { return anObject; }
3.26
Activiti_NeedsActiveExecutionCmd_getSuspendedExceptionMessage_rdh
/** * Subclasses can override this to provide a more detailed exception message that will be thrown when the execution is suspended. */ protected String getSuspendedExceptionMessage() { return ("Cannot execution operation because execution '" + executionId) + "' is suspended"; }
3.26
Activiti_JobEntityImpl_setExecution_rdh
// getters and setters //////////////////////////////////////////////////////// public void setExecution(ExecutionEntity execution) { super.setExecution(execution); execution.getJobs().add(this); }
3.26
Activiti_CachingAndArtifactsManager_updateCachingAndArtifacts_rdh
/** * Ensures that the process definition is cached in the appropriate places, including the * deployment's collection of deployed artifacts and the deployment manager's cache, as well * as caching any ProcessDefinitionInfos. */ public void updateCachingAndArtifacts(ParsedDeployment parsedDeployment) { CommandContext commandContext = Context.getCommandContext(); final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); DeploymentCache<ProcessDefinitionCacheEntry> processDefinitionCache = processEngineConfiguration.getDeploymentManager().getProcessDefinitionCache(); DeploymentEntity deployment = parsedDeployment.getDeployment(); for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) { BpmnModel bpmnModel = parsedDeployment.getBpmnModelForProcessDefinition(processDefinition); Process process = parsedDeployment.getProcessModelForProcessDefinition(processDefinition); ProcessDefinitionCacheEntry cacheEntry = new ProcessDefinitionCacheEntry(processDefinition, bpmnModel, process); processDefinitionCache.add(processDefinition.getId(), cacheEntry); addDefinitionInfoToCache(processDefinition, processEngineConfiguration, commandContext); // Add to deployment for further usage deployment.addDeployedArtifact(processDefinition); } }
3.26
Activiti_StartEventValidator_executeValidation_rdh
/** */public class StartEventValidator extends ProcessLevelValidator { @Override protected void executeValidation(BpmnModel bpmnModel, Process process, List<ValidationError> errors) { List<StartEvent> startEvents = process.findFlowElementsOfType(StartEvent.class, false); validateEventDefinitionTypes(startEvents, process, errors); validateMultipleStartEvents(startEvents, process, errors); }
3.26
Activiti_IntegerToLong_primTransform_rdh
/** * {@inheritDoc } */ @Override protected Object primTransform(Object anObject) throws Exception { return Long.valueOf(((Integer) (anObject))); }
3.26
Activiti_ProcessEngines_unregister_rdh
/** * Unregisters the given process engine. */public static void unregister(ProcessEngine processEngine) { processEngines.remove(processEngine.getName()); }
3.26
Activiti_ProcessEngines_getProcessEngine_rdh
/** * obtain a process engine by name. * * @param processEngineName * is the name of the process engine or null for the default process engine. */ public static ProcessEngine getProcessEngine(String processEngineName) { if (!isInitialized()) { init(); } return processEngines.get(processEngineName); }
3.26
Activiti_ProcessEngines_init_rdh
/** * Initializes all process engines that can be found on the classpath for resources <code>activiti.cfg.xml</code> (plain Activiti style configuration) and for resources * <code>activiti-context.xml</code> (Spring style configuration). */ public static synchronized void init() { if (!isInitialized()) { if (processEngines == null) { // Create new map to store process-engines if current map is // null processEngines = new HashMap<String, ProcessEngine>(); } ClassLoader classLoader = ReflectUtil.getClassLoader(); Enumeration<URL> resources = null; try { resources = classLoader.getResources("activiti.cfg.xml"); } catch (IOException e) { throw new ActivitiIllegalArgumentException("problem retrieving activiti.cfg.xml resources on the classpath: " + System.getProperty("java.class.path"), e); }// Remove duplicated configuration URL's using set. Some // classloaders may return identical URL's twice, causing duplicate // startups Set<URL> configUrls = new HashSet<URL>(); while (resources.hasMoreElements()) { configUrls.add(resources.nextElement()); } for (Iterator<URL> iterator = configUrls.iterator(); iterator.hasNext();) { URL resource = iterator.next(); log.info("Initializing process engine using configuration '{}'", resource.toString()); initProcessEngineFromResource(resource);} try { resources = classLoader.getResources("activiti-context.xml"); } catch (IOException e) { throw new ActivitiIllegalArgumentException("problem retrieving activiti-context.xml resources on the classpath: " + System.getProperty("java.class.path"), e); } while (resources.hasMoreElements()) { URL resource = resources.nextElement(); log.info("Initializing process engine using Spring configuration '{}'", resource.toString()); initProcessEngineFromSpringResource(resource); } setInitialized(true); } else { log.info("Process engines already initialized"); } }
3.26
Activiti_ProcessEngines_getProcessEngineInfos_rdh
/** * Get initialization results. */ public static List<ProcessEngineInfo> getProcessEngineInfos() { return processEngineInfos; }
3.26
Activiti_ProcessEngines_retry_rdh
/** * retries to initialize a process engine that previously failed. */ public static ProcessEngineInfo retry(String resourceUrl) { log.debug("retying initializing of resource {}", resourceUrl); try {return initProcessEngineFromResource(new URL(resourceUrl)); } catch (MalformedURLException e) {throw new ActivitiIllegalArgumentException("invalid url: " + resourceUrl, e);} }
3.26
Activiti_ProcessEngines_getProcessEngines_rdh
/** * provides access to process engine to application clients in a managed server environment. */ public static Map<String, ProcessEngine> getProcessEngines() { return processEngines; }
3.26
Activiti_ProcessEngines_registerProcessEngine_rdh
/** * Registers the given process engine. No {@link ProcessEngineInfo} will be available for this process engine. An engine that is registered will be closed when the {@link ProcessEngines#destroy()} * is called. */ public static void registerProcessEngine(ProcessEngine processEngine) { processEngines.put(processEngine.getName(), processEngine); }
3.26
Activiti_ProcessEngines_destroy_rdh
/** * closes all process engines. This method should be called when the server shuts down. */ public static synchronized void destroy() { if (isInitialized()) { Map<String, ProcessEngine> engines = new HashMap<String, ProcessEngine>(processEngines); processEngines = new HashMap<String, ProcessEngine>(); for (String processEngineName : engines.keySet()) { ProcessEngine processEngine = engines.get(processEngineName); try { processEngine.close(); } catch (Exception e) { log.error("exception while closing {}", processEngineName == null ? "the default process engine" : "process engine " + processEngineName, e); } } f0.clear(); processEngineInfosByResourceUrl.clear(); processEngineInfos.clear(); setInitialized(false); }}
3.26