improve BPM engine Interface Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
diff --git a/org.eclipse.osbp.bpm.api.feature/feature.xml b/org.eclipse.osbp.bpm.api.feature/feature.xml index f79af98..09807e8 100644 --- a/org.eclipse.osbp.bpm.api.feature/feature.xml +++ b/org.eclipse.osbp.bpm.api.feature/feature.xml
@@ -17,7 +17,7 @@ label="%featureName" version="0.9.0.qualifier" provider-name="%providerName" - plugin="org.eclipse.osbp.bpm.api"> + plugin="org.eclipse.osbp.license"> <description> %description
diff --git a/org.eclipse.osbp.bpm.api/src/org/eclipse/osbp/bpm/api/IBPMEngine.java b/org.eclipse.osbp.bpm.api/src/org/eclipse/osbp/bpm/api/IBPMEngine.java index 400d97f..969f40d 100644 --- a/org.eclipse.osbp.bpm.api/src/org/eclipse/osbp/bpm/api/IBPMEngine.java +++ b/org.eclipse.osbp.bpm.api/src/org/eclipse/osbp/bpm/api/IBPMEngine.java
@@ -14,16 +14,84 @@ */ package org.eclipse.osbp.bpm.api; +import java.util.List; import java.util.Map; import java.util.Set; -import org.eclipse.osbp.ui.api.useraccess.IBlipProcessPermissions; - public interface IBPMEngine { - void clearErrors(); - String getErrors(); - boolean registerProcess(IBlipBPMStartInfo startInfo, String resourceBundlePath, Class<?> bundleClass, IBlipProcessPermissions blipProcessPermissions); - void startProcess(IBlipBPMStartInfo bpm, Map <String, Object> parameters); + static final String BPM_HUMANTASK_LOCALE = "en-US"; + + enum BPMResultSeverity { + ERROR, WARNING, INFO; + } + class BPMError { + private String resource; + private BPMResultSeverity severity; + private String message; + private int[] lines; + + public BPMError(String resource, int [] lines, int severity, String message) { + this.resource = resource; + this.lines = lines; + this.severity = BPMResultSeverity.values()[severity]; + this.message = message; + } + + public BPMResultSeverity getSeverity() { + return severity; + } + + public String getMessage() { + return message; + } + + public int[] getLines() { + return lines; + } + + public String getResource() { + return resource; + } + + @Override + public boolean equals(Object obj) { + if(this == obj) { + return true; + } + BPMError bpme = (BPMError)obj; + if(this.message.equals(bpme.getMessage()) && + this.resource.equals(bpme.getResource()) && + this.severity.equals(bpme.getSeverity()) && + this.lines.length == bpme.getLines().length) { + return true; + } + return false; + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(severity.toString()); + sb.append(" in "); + sb.append(resource); + sb.append("\n"); + if(lines.length > 0 && (lines.length != 1 || lines[0] != -1)) { + sb.append("in line "); + for(int i=0; i<lines.length; i++) { + sb.append(String.format("%d ", lines[i])); + } + sb.append("\n"); + } + sb.append("\n"); + sb.append(message); + return sb.toString(); + } + } + void registerProcess(String processId); + boolean processHasErrors(); + List<BPMError> getKnowledgeBuilderErrors(); + void startProcess(String processId); + void signalEvent(String type, Object event); + void signalEvent(String type, Object event, long processInstanceId); String getResourceName(String processId); void initBPMUsers(); Set<String> getGroups(); @@ -65,13 +133,15 @@ * @param value new values of the variable */ void setProcessVariable(Object processInstanceObject, String variable, Object value); - void disposeKsession(Object ksession); + + void setProcessMetadata(Object processInstanceObject, String variable, Object value); + + Object getProcessMetadata(Object processInstanceObject, String variable); + Object reCreateKnowledgeSession(Object taskInformationObject); void beginTransaction(); void commitTransaction(); void rollbackTransaction(); Object getVariable(Object kcontext, String variable, Object defaultValue); void setVariable(Object kcontext, String variable, Object value); - void registerBlipFunctionProvider(IBlipBPMFunctionProvider blipFunctionProvider); - void unregisterBlipFunctionProvider(IBlipBPMFunctionProvider blipFunctionProvider); }
diff --git a/org.eclipse.osbp.bpm.api/src/org/eclipse/osbp/bpm/api/IBPMTaskClient.java b/org.eclipse.osbp.bpm.api/src/org/eclipse/osbp/bpm/api/IBPMTaskClient.java index 1ae65c6..f7f7582 100644 --- a/org.eclipse.osbp.bpm.api/src/org/eclipse/osbp/bpm/api/IBPMTaskClient.java +++ b/org.eclipse.osbp.bpm.api/src/org/eclipse/osbp/bpm/api/IBPMTaskClient.java
@@ -33,6 +33,7 @@ void unsubscribeTaskEventNotification(BPMTaskEventType type, IBPMTaskEventNotification notification); IDto getWorkloadDto(Object taskInformationObject); String getWorkloadDtoFqn(Object taskInformationObject); + void setWorkloadDtoFqn(Object taskInformationObject, String workloadDtoFqn); void setWorkloadDto(Object taskInformationObject, IDto workloadDto); String getProcessId(BPMTaskSummary taskSummary); void registerPerspectiveListener(BPMTaskClientPerspectiveListener listener);
diff --git a/org.eclipse.osbp.bpm.api/src/org/eclipse/osbp/bpm/api/IBlipBPMFunctionProvider.java b/org.eclipse.osbp.bpm.api/src/org/eclipse/osbp/bpm/api/IBlipBPMFunctionProvider.java index 919f30c..a5441b5 100644 --- a/org.eclipse.osbp.bpm.api/src/org/eclipse/osbp/bpm/api/IBlipBPMFunctionProvider.java +++ b/org.eclipse.osbp.bpm.api/src/org/eclipse/osbp/bpm/api/IBlipBPMFunctionProvider.java
@@ -19,7 +19,5 @@ public interface IBlipBPMFunctionProvider extends IBlipBPMConstants { Map<String, IBlipBPMStartInfo> getBpmns(); - void startProcess(String processName); - void startProcess(String processName, Map<String, Object> map); public IBlipBPMStartInfo getStartInfo(BPMTaskSummary taskSummary); }