diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/client/ParameterObjectArgumentResolver.kt b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/ParameterObjectArgumentResolver.kt similarity index 54% rename from bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/client/ParameterObjectArgumentResolver.kt rename to bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/ParameterObjectArgumentResolver.kt index 12424cce8..a5ce7feb9 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/client/ParameterObjectArgumentResolver.kt +++ b/bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/service/ParameterObjectArgumentResolver.kt @@ -17,7 +17,45 @@ * SPDX-License-Identifier: Apache-2.0 ******************************************************************************/ -package org.eclipse.tractusx.bpdm.pool.api.client +/******************************************************************************* + * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ******************************************************************************/ + +/******************************************************************************* + * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ******************************************************************************/ + +package org.eclipse.tractusx.bpdm.common.service import org.springdoc.core.annotations.ParameterObject import org.springframework.core.MethodParameter diff --git a/bpdm-gate-api/pom.xml b/bpdm-gate-api/pom.xml index 5448412f0..c0eb2982e 100644 --- a/bpdm-gate-api/pom.xml +++ b/bpdm-gate-api/pom.xml @@ -56,7 +56,6 @@ src/main/kotlin - org.jetbrains.kotlin @@ -64,5 +63,12 @@ + + + github + GitHub CatenaX-NG Apache Maven Packages + https://maven.pkg.github.com/catenax-ng/bpdm-gate-api + + \ No newline at end of file diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/client/GateClientImpl.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/client/GateClientImpl.kt index 1a063f037..2ac33cd0d 100644 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/client/GateClientImpl.kt +++ b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/client/GateClientImpl.kt @@ -19,6 +19,7 @@ package org.eclipse.tractusx.bpdm.gate.api.client +import org.eclipse.tractusx.bpdm.common.service.ParameterObjectArgumentResolver import org.eclipse.tractusx.bpdm.gate.api.GateAddressApi import org.eclipse.tractusx.bpdm.gate.api.GateBusinessPartnerApi import org.eclipse.tractusx.bpdm.gate.api.GateLegalEntityApi diff --git a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/client/ParameterObjectArgumentResolver.kt b/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/client/ParameterObjectArgumentResolver.kt deleted file mode 100644 index 599d8f631..000000000 --- a/bpdm-gate-api/src/main/kotlin/org/eclipse/tractusx/bpdm/gate/api/client/ParameterObjectArgumentResolver.kt +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ******************************************************************************/ - -package org.eclipse.tractusx.bpdm.gate.api.client - -import org.springdoc.core.annotations.ParameterObject -import org.springframework.core.MethodParameter -import org.springframework.format.support.DefaultFormattingConversionService -import org.springframework.web.service.invoker.HttpRequestValues -import org.springframework.web.service.invoker.HttpServiceArgumentResolver -import kotlin.reflect.full.memberProperties - -class ParameterObjectArgumentResolver : HttpServiceArgumentResolver { - - private val conversionService = DefaultFormattingConversionService() - override fun resolve(argument: Any?, parameter: MethodParameter, requestValues: HttpRequestValues.Builder): Boolean { - val annot = parameter.getParameterAnnotation(ParameterObject::class.java) - if (annot != null && argument != null) { - for (memberProperty in argument.javaClass.kotlin.memberProperties) { - val propName = memberProperty.name - val propValueString = when (val propValue = memberProperty.get(argument)) { - is String -> propValue - else -> conversionService.convert(propValue, String::class.java) - } - requestValues.addRequestParameter(propName, propValueString) - } - return true - } - return false - } -} \ No newline at end of file diff --git a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/client/PoolClientImpl.kt b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/client/PoolClientImpl.kt index 352367919..e0ba1839c 100644 --- a/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/client/PoolClientImpl.kt +++ b/bpdm-pool-api/src/main/kotlin/org/eclipse/tractusx/bpdm/pool/api/client/PoolClientImpl.kt @@ -19,6 +19,7 @@ package org.eclipse.tractusx.bpdm.pool.api.client +import org.eclipse.tractusx.bpdm.common.service.ParameterObjectArgumentResolver import org.eclipse.tractusx.bpdm.pool.api.* import org.springframework.web.reactive.function.client.WebClient import org.springframework.web.reactive.function.client.support.WebClientAdapter