Skip to content

Commit

Permalink
formatting and license
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoika committed Jan 6, 2020
1 parent 7ba14bd commit ec844db
Show file tree
Hide file tree
Showing 107 changed files with 20,045 additions and 20,081 deletions.
591 changes: 288 additions & 303 deletions imixs-code-style-v14.xml

Large diffs are not rendered by default.

591 changes: 288 additions & 303 deletions imixs-code-style.xml

Large diffs are not rendered by default.

31 changes: 14 additions & 17 deletions imixs-workflow-core/src/main/java/org/imixs/workflow/Adapter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* <pre>
* Imixs Workflow
/*
* Imixs-Workflow
*
* Copyright (C) 2001-2020 Imixs Software Solutions GmbH,
* http://www.imixs.com
*
Expand All @@ -22,18 +22,17 @@
* https://github.com/imixs/imixs-workflow
*
* Contributors:
* Imixs Software Solutions GmbH - initial API and implementation
* Imixs Software Solutions GmbH - Project Management
* Ralph Soika - Software Developer
* </pre>
*******************************************************************************/
*/

package org.imixs.workflow;

import org.imixs.workflow.exceptions.AdapterException;

/**
* An Adapter defines an adapter pattern used by the WorkflowKernel to call adapter implementations
* defined by the BPMN model.
* An Adapter defines an adapter pattern used by the WorkflowKernel to call
* adapter implementations defined by the BPMN model.
* <p>
*
*
Expand All @@ -44,14 +43,12 @@

public abstract interface Adapter {


/**
* @param document the workitem to be processed
* @param event the workflow event containing the processing instructions
* @return updated workitem for further processing
* @throws AdapterException
*/
public ItemCollection execute(ItemCollection document, ItemCollection event)
throws AdapterException;
/**
* @param document the workitem to be processed
* @param event the workflow event containing the processing instructions
* @return updated workitem for further processing
* @throws AdapterException
*/
public ItemCollection execute(ItemCollection document, ItemCollection event) throws AdapterException;

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* <pre>
* Imixs Workflow
/*
* Imixs-Workflow
*
* Copyright (C) 2001-2020 Imixs Software Solutions GmbH,
* http://www.imixs.com
*
Expand All @@ -22,19 +22,18 @@
* https://github.com/imixs/imixs-workflow
*
* Contributors:
* Imixs Software Solutions GmbH - initial API and implementation
* Imixs Software Solutions GmbH - Project Management
* Ralph Soika - Software Developer
* </pre>
*******************************************************************************/
*/

package org.imixs.workflow;

import org.imixs.workflow.exceptions.ModelException;
import org.imixs.workflow.exceptions.PluginException;

/**
* The BPMN Rule Engine can be used to evaluate a business Rule based on a BPMN model with
* conditional events.
* The BPMN Rule Engine can be used to evaluate a business Rule based on a BPMN
* model with conditional events.
* <p>
* The rules are evaluated as a chain of conditional events
*
Expand All @@ -43,73 +42,74 @@
*/
public class BPMNRuleEngine {

private Model model = null;

public BPMNRuleEngine(Model model) {
super();
this.model = model;
}

/**
* Evaluates a BPMN Business Rule based on the data provided by a workitem.
*
* @param workitem
* @return evaluated task id
* @throws ModelException
*/
public int eval(ItemCollection workitem) throws ModelException {
// setup the workflow rule context
RuleContext ruleContext = new RuleContext();
WorkflowKernel workflowKernel = new WorkflowKernel(ruleContext);
ruleContext.getModelManager().addModel(model);
int result;
try {
result = workflowKernel.eval(workitem);
} catch (PluginException e) {
throw new ModelException(e.getErrorCode(), e.getMessage(), e);
}

return result;
}

/**
* Helper Class to mock a workflow kernel
*
* @author rsoika
*
*/
class RuleContext implements WorkflowContext, ModelManager {

private Model model = null;

@Override
public Object getSessionContext() {
return null;
public BPMNRuleEngine(Model model) {
super();
this.model = model;
}

@Override
public ModelManager getModelManager() {
return this;
/**
* Evaluates a BPMN Business Rule based on the data provided by a workitem.
*
* @param workitem
* @return evaluated task id
* @throws ModelException
*/
public int eval(ItemCollection workitem) throws ModelException {
// setup the workflow rule context
RuleContext ruleContext = new RuleContext();
WorkflowKernel workflowKernel = new WorkflowKernel(ruleContext);
ruleContext.getModelManager().addModel(model);
int result;
try {
result = workflowKernel.eval(workitem);
} catch (PluginException e) {
throw new ModelException(e.getErrorCode(), e.getMessage(), e);
}

return result;
}

@Override
public Model getModel(String version) throws ModelException {
return model;
}
/**
* Helper Class to mock a workflow kernel
*
* @author rsoika
*
*/
class RuleContext implements WorkflowContext, ModelManager {

private Model model = null;

@Override
public Object getSessionContext() {
return null;
}

@Override
public ModelManager getModelManager() {
return this;
}

@Override
public Model getModel(String version) throws ModelException {
return model;
}

@Override
public void addModel(Model model) throws ModelException {
this.model = model;
}

@Override
public void removeModel(String version) {
}

@Override
public Model getModelByWorkitem(ItemCollection workitem) throws ModelException {
return model;
}

@Override
public void addModel(Model model) throws ModelException {
this.model = model;
}

@Override
public void removeModel(String version) {}

@Override
public Model getModelByWorkitem(ItemCollection workitem) throws ModelException {
return model;
}

}

}
Loading

0 comments on commit ec844db

Please sign in to comment.