protected void executeInternal()

in ddm-bpm-extension/src/main/java/com/epam/digital/data/platform/bpms/extension/delegate/connector/rest/ExternalSystemConnectorDelegate.java [84:112]


  protected void executeInternal(DelegateExecution execution) throws Exception {
    responseVariable.on(execution).set(RegistryConnectorResponse.builder().build());

    var externalSystemName = systemNameVariable.from(execution).getOrThrow();
    var operationName = defineOperationName(execution);

    var externalSystemConfiguration = getExternalSystemConfiguration(externalSystemName);
    var operationConfiguration = getOperationConfiguration(externalSystemName, operationName);
    var auth = externalSystemConfiguration.getAuth();
    checkAuthenticationConfig(auth, externalSystemName);

    var requestParameters =
        toMultiValueMapSeparatedByComma(requestParametersVariable.from(execution).get());
    var requestHeaders = new HttpHeaders(toMultiValueMapSeparatedByComma(
        requestHeadersVariable.from(execution).get()));
    var payload = payloadVariable.from(execution).getOptional().map(Object::toString).orElse(null);

    var externalSystemUrl = externalSystemConfiguration.getUrl();
    authenticate(requestHeaders, auth, externalSystemUrl);

    var uri = buildUri(externalSystemUrl, operationConfiguration.getResourcePath(),
        requestParameters);
    var method = operationConfiguration.getMethod();
    var httpEntity = new HttpEntity<>(payload, requestHeaders);

    var responseValue = sendRequest(uri, method, httpEntity);

    responseVariable.on(execution).set(responseValue);
  }