Problem getting input/output parameters from an activity using Java

Hi everyone,

I’m trying to obtain the input/output values of an activity using this code:

private static boolean checkOutputParameters(Collection<ModelElementInstance> extensionElements) {
    for (ModelElementInstance extensionElement : extensionElements) {
        if (extensionElement instanceof CamundaOutputParameter) {
            return true;
        }
    }
    return false;
}

private static boolean checkInputParameters(Collection<ModelElementInstance> extensionElements) {
    for (ModelElementInstance extensionElement : extensionElements) {
        if (extensionElement instanceof CamundaInputParameter) {
            return true;
        }
    }
    return false;
}

private static JsonArray getOutputDetails(ExtensionElements extensionElements) {
    JsonArray outputDetails = new JsonArray();
    Collection<CamundaOutputParameter> outputParameters = extensionElements.getElementsQuery()
            .filterByType(CamundaOutputParameter.class).list();

    for (CamundaOutputParameter outputParameter : outputParameters) {
        JsonObject outputDetail = new JsonObject();
        outputDetail.addProperty("Name", outputParameter.getCamundaName());
        outputDetail.addProperty("Value", outputParameter.getTextContent());
        outputDetails.add(outputDetail);
    }

    return outputDetails;
}

The first thing I use is a method to validate whether or not there are values in the input or output, but there I get that they do not, even though there are values in the bpmn model.

Does anyone know how to obtain these elements to print in the console?

What I need is that at the end of the execution of a program, a json is generated with the information of each activity including the input and output values

Your help would be very valuable to me. :raised_hands:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.