我曾尝试实现org.jbpm.formModeler.core.config.SelectValuesProvider并编译我的代码并创建了一个jar,在" / src / main / resources / META-INF&#中还包含一个空白bean.xml 34;
在JBPM类路径中添加了jar,但我无法看到jbpm数据提供程序组合框中列出的任何内容。
我的代码如下:
import org.jbpm.formModeler.api.client.FormRenderContext;
import org.jbpm.formModeler.api.model.Field;
import org.jbpm.formModeler.api.model.RangeProvider;
import org.jbpm.formModeler.core.config.SelectValuesProvider;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
public class ProductRangeProvider implements SelectValuesProvider {
@Override
public String getIdentifier() {
String identiferName = "deparmnet";
return identiferName;
}
@Override
public Map<String, String> getSelectOptions(Field field, String currentValue,
FormRenderContext formDetails, Locale locale) {
Map<String, String> maps = new HashMap<String, String>();
String employee = "";
String department = "";
String DbIp = "jdbc:mysql://*********:*****/****";
String userName = "***";
String password = "****";
Connection con=null;
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(DbIp,userName,password);
PreparedStatement stmt=con.prepareStatement("Select role from role_master");
ResultSet rs=stmt.executeQuery();
while(rs.next()){
maps.put(rs.getString(1), rs.getString(1));
}
con.close();
}
catch(Exception E){
System.out.println(E);
}
finally {
try {
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return maps;
}
}
JBPM是否需要任何配置来识别我的类,就像workitemHandler定义一样。?
答案 0 :(得分:0)
尝试在类路径中添加jar文件。这将解决问题。