javajbossdroolsjbpmkie-workbench

Unable to add Java imports in KIE workbench (jBPM)


I am brand new to jBPM. I am using the jBPM KIE workbench. As you can see in the 2nd picture, I added in the necessary imports in the KIE external data objects section. Why am I getting the errors? Do I need to do something else with the imports?

I am getting a thrown error of:

[KBase: defaultKieBase]: Process Compilation error URL cannot be resolved to a type
URL cannot be resolved to a type
HttpURLConnection cannot be resolved to a type
HttpURLConnection cannot be resolved to a type
BufferedReader cannot be resolved to a type
BufferedReader cannot be resolved to a type
InputStreamReader cannot be resolved to a type

Java Code:

    try {
        URL url = new URL("http://localhost:8080/users");
        HttpURLConnection con = (HttpURLConnection) url.openConnection();
        con.setRequestMethod("GET");
        con.setRequestProperty("Content-Type", "application/json");

        BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer content = new StringBuffer();

        while ((inputLine = in.readLine()) != null) {
            content.append(inputLine);
        }

        in.close();

        System.out.println(content);
    }

    catch(Exception e){
        throw new RuntimeException(e);
    }

Kie workbench

External data model


Solution

  • The built in REST workitem should be a good starting point.

    Create a project and add a BusinessProcess:

    New Business Process

    Then Add the built in Rest Workitem

    Add Built in Rest Workitem

    Then Open the Rest Workitem Properties and select the data assignments

    Select Rest workitem Data Assignments

    And enter values for the Rest Call

    And enter values for the Rest Call