diff --git a/src/main/java/de/viadee/bpm/camunda/connectors/kubeflow/services/KubeflowConnectorExecutor.java b/src/main/java/de/viadee/bpm/camunda/connectors/kubeflow/services/KubeflowConnectorExecutor.java index c2dc4c1..185e63c 100644 --- a/src/main/java/de/viadee/bpm/camunda/connectors/kubeflow/services/KubeflowConnectorExecutor.java +++ b/src/main/java/de/viadee/bpm/camunda/connectors/kubeflow/services/KubeflowConnectorExecutor.java @@ -191,27 +191,23 @@ private void addFilter(URIBuilder uriBuilder) throws UnsupportedEncodingExceptio protected void addNamespaceFilter(URIBuilder uriBuilder) { if (isMultiUserMode) { var namespace = connectorRequest.getKubeflowapi().namespace(); - if (kubeflowApiOperationsEnum.isNamespaceFilterRequired()) { - if (KubeflowApisEnum.PIPELINES_V1.equals(kubeflowApisEnum)) { - uriBuilder.addParameter(URI_PARAMETER_PAIR_V1_TYPE_NS.getKey(), - URI_PARAMETER_PAIR_V1_TYPE_NS.getValue()); - uriBuilder.addParameter(URI_PARAMETER_V1_ID, namespace); - } else { - uriBuilder.addParameter(URI_PARAMETER_V2_NS, namespace); - } - } else if (KubeflowApiOperationsEnum.GET_PIPELINES.equals(kubeflowApiOperationsEnum) - && namespace != null) { - if (KubeflowApisEnum.PIPELINES_V1.equals(kubeflowApisEnum)) { - uriBuilder.addParameter(URI_PARAMETER_PAIR_V1_TYPE_NS.getKey(), - URI_PARAMETER_PAIR_V1_TYPE_NS.getValue()); - uriBuilder.addParameter(URI_PARAMETER_V1_ID, namespace); - } else { - uriBuilder.addParameter(URI_PARAMETER_V2_NS, namespace); - } + if (kubeflowApiOperationsEnum.isNamespaceFilterRequired() || + (KubeflowApiOperationsEnum.GET_PIPELINES.equals(kubeflowApiOperationsEnum) && namespace != null)) { + setNamespaceParameter(uriBuilder, namespace); } } } + private void setNamespaceParameter(URIBuilder uriBuilder, String namespace) { + if (KubeflowApisEnum.PIPELINES_V1.equals(kubeflowApisEnum)) { + uriBuilder.addParameter(URI_PARAMETER_PAIR_V1_TYPE_NS.getKey(), + URI_PARAMETER_PAIR_V1_TYPE_NS.getValue()); + uriBuilder.addParameter(URI_PARAMETER_V1_ID, namespace); + } else { + uriBuilder.addParameter(URI_PARAMETER_V2_NS, namespace); + } + } + public static HttpRequest.BodyPublisher ofFormData(Map data) { var builder = new StringBuilder(); for (Map.Entry entry : data.entrySet()) {