Hello,
I want to persist a variable from a YAWL Workflow into my local mysql database. So I started to read the tutorial "Create an externalDBGateway". After I imported the yawl and mysql libraries in my eclipse project and created a class that extends "AbstractExternalDBGateway", I saw that the import “org.jdom.Element;” can’t be imported. So I googled for jdom and I added the libraries “jdom-1.1.3.zip” into my project. Is this the correct version of jdom? Can somebody update the tutorial to make it complete, please?
I took the java file “MyExternalDBGatewayImpl.java” from the tutorial and changed the following lines:
private boolean configure() {
if (! configured) {
configureSession("org.hibernate.dialect.MySQLDialect",
"com.mysql.jdbc.Driver", "jdbc:mysql://localhost:3306/yawl",
"root", "***", null);
configured = true;
}
return configured;
}
Is this ok?

The next problem is that I don’t have the Object “_dbEngine” on Line:
List resultSet = _dbEngine.execSQLQuery("SELECT titel FROM incident");

The error message from eclipse is:
“Multiple markers at this line
- The type org.hibernate.HibernateException cannot be resolved. It is indirectly referenced from
required .class files
- List is a raw type. References to generic type List<E> should be parameterized”

After I exported the Project in Eclipse, I took the compiled Class File “MyExternalDBGatewayImpl” and took it into the folder:
“YAWL4Study-2.3final\engine\apache-tomcat-6.0.18\webapps\yawl\WEB-INF\classes\org\yawlfoundation\yawl\elements\data\external”

Is this also correct?
After I restarted the YAWL Engine and the Editor, the Tab “Data Gateway” is still clear and I don’t see anything.
Can somebody help me and make the tutorial better?

Here is my complete java file:

import java.util.List;
import org.jdom.Element;

import org.yawlfoundation.*;
import org.yawlfoundation.yawl.elements.*;
import org.yawlfoundation.yawl.elements.data.YParameter;
import org.yawlfoundation.yawl.elements.data.YVariable;
import org.yawlfoundation.yawl.elements.data.external.AbstractExternalDBGateway;
import org.yawlfoundation.yawl.engine.YSpecificationID;

public class MyExternalDBGatewayImpl extends AbstractExternalDBGateway{

private boolean configured = false;

private boolean configure() {
if (! configured) {
configureSession("org.hibernate.dialect.MySQLDialect",
"com.mysql.jdbc.Driver", "jdbc:mysql://localhost:3306/yawl",
"root", "***", null);
configured = true;
}
return configured;
}

@Override
public String getDescription() {
return "H-BRS mysql-jdbc";
}

@Override
public Element populateCaseData(YSpecificationID arg0, String arg1,
List<YParameter> arg2, List<YVariable> arg3, Element arg4) {
// TODO Auto-generated method stub
return null;
}

@Override
public Element populateTaskParameter(YTask task, YParameter param,
Element caseData) {

Element result = new Element(param.getName());
if (configure()) {
List resultSet = _dbEngine.execSQLQuery("SELECT titel FROM incident");

for (Object row : resultSet) {
Element content =
(Element) JDOMUtil.stringToElement(StringUtil.wrap(row.toString(), "titel")).clone();
result.addContent(content);
}

}

return result;
}

@Override
public void updateFromCaseData(YSpecificationID arg0, String arg1,
List<YParameter> arg2, Element arg3) {
// TODO Auto-generated method stub

}

@Override
public void updateFromTaskCompletion(String arg0, Element arg1, Element arg2) {
// TODO Auto-generated method stub

}

}

fmannhardt

Wed, 05/16/2012 - 05:56

Hi, the tutorial mentions a YAWL library that has to be added. Which JAR file did you add? Should be yawl-lib-2.2.jar i guess.
 

Which YAWL Version do you use?

mRoskosch

Wed, 05/16/2012 - 14:28

Hi,

mgiesl2s and I sat together and fixed the problem for the most part. We switched back to 2.2.0.1, because the tutorial was written for that YAWL version.

We have now added the whole libs folder of the YAWL installation as libraries to the project. After manually adding the import for the jdom library to the class and cleaning the project in eclipse no further errors occured.

Furthermore we have changed the third parameter of the configureSession method from "jdbc:mysql://localhost:3306/yawl" to "jdbc:mysql:///yawl". Now external dabase gateway connects to the server and sends the results back to the engine.

The only thing left is to define a correct data type in the workflow, that handles the results of the sql query.