-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(orchestrator): add api endpoint for requesting cleaning tasks
- add endpoint to orchestrator api - add DTO model for business partner and cleaning task in orchestrator - connect endpoint with orchestrator controller - return static dummy data on endpoint invocation - add tests for validating endpoint invocation and dummy data return
- Loading branch information
Showing
31 changed files
with
1,088 additions
and
52 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...on/src/main/kotlin/org/eclipse/tractusx/bpdm/common/exception/BpdmUpsertLimitException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/******************************************************************************* | ||
* 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.exception | ||
|
||
import org.springframework.http.HttpStatus | ||
import org.springframework.web.bind.annotation.ResponseStatus | ||
|
||
@ResponseStatus(HttpStatus.BAD_REQUEST) | ||
class BpdmUpsertLimitException( | ||
actualSize: Int, | ||
limit: Int | ||
) : RuntimeException("The number of upsertable items ($actualSize) surpasses the upsert limit of $limit") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...orchestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/CleaningTaskApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/******************************************************************************* | ||
* 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.orchestrator.api | ||
|
||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.media.Content | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses | ||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import org.eclipse.tractusx.orchestrator.api.model.TaskCreateRequest | ||
import org.eclipse.tractusx.orchestrator.api.model.TaskCreateResponse | ||
import org.springframework.http.MediaType | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.service.annotation.HttpExchange | ||
import org.springframework.web.service.annotation.PostExchange | ||
|
||
@RequestMapping("/api/cleaning-tasks", produces = [MediaType.APPLICATION_JSON_VALUE]) | ||
@HttpExchange("/api/cleaning-tasks") | ||
interface CleaningTaskApi { | ||
|
||
@Operation( | ||
summary = "Create new cleaning tasks for given business partner data", | ||
description = "Create cleaning tasks for given business partner data in given cleaning mode. " + | ||
"The mode decides through which cleaning steps the given business partner data will go through. " + | ||
"The response contains the states of the created cleaning tasks in the order of given business partner data." + | ||
"If there is an error in the request no cleaning tasks are created (all or nothing). " + | ||
"For a single request, the maximum number of business partners in the request is limited to \${bpdm.api.upsert-limit} entries." | ||
) | ||
@ApiResponses( | ||
value = [ | ||
ApiResponse( | ||
responseCode = "200", | ||
description = "The states of successfully created cleaning tasks including the task identifier for tracking purposes." | ||
), | ||
ApiResponse(responseCode = "400", description = "On malformed task create requests or reaching upsert limit", content = [Content()]), | ||
] | ||
) | ||
@Tag(name = "Requester") | ||
@PostMapping | ||
@PostExchange | ||
fun createCleaningTasks(@RequestBody createRequest: TaskCreateRequest): TaskCreateResponse | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...rc/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/AlternativePostalAddressDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/******************************************************************************* | ||
* 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.orchestrator.api.model | ||
|
||
import com.neovisionaries.i18n.CountryCode | ||
import org.eclipse.tractusx.bpdm.common.dto.GeoCoordinateDto | ||
import org.eclipse.tractusx.bpdm.common.dto.IBaseAlternativePostalAddressDto | ||
import org.eclipse.tractusx.bpdm.common.model.DeliveryServiceType | ||
|
||
data class AlternativePostalAddressDto( | ||
override val geographicCoordinates: GeoCoordinateDto? = null, | ||
override val country: CountryCode? = null, | ||
override val administrativeAreaLevel1: String? = null, | ||
override val postalCode: String? = null, | ||
override val city: String? = null, | ||
override val deliveryServiceType: DeliveryServiceType? = null, | ||
override val deliveryServiceQualifier: String? = null, | ||
override val deliveryServiceNumber: String? = null | ||
|
||
) : IBaseAlternativePostalAddressDto |
39 changes: 39 additions & 0 deletions
39
...tor-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/BusinessPartnerDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/******************************************************************************* | ||
* 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.orchestrator.api.model | ||
|
||
import org.eclipse.tractusx.bpdm.common.dto.* | ||
|
||
|
||
data class BusinessPartnerDto( | ||
override val nameParts: List<String> = emptyList(), | ||
override val shortName: String? = null, | ||
override val identifiers: Collection<BusinessPartnerIdentifierDto> = emptyList(), | ||
override val legalForm: String? = null, | ||
override val states: Collection<BusinessPartnerStateDto> = emptyList(), | ||
override val classifications: Collection<ClassificationDto> = emptyList(), | ||
override val roles: Collection<BusinessPartnerRole> = emptyList(), | ||
override val postalAddress: PostalAddressDto = PostalAddressDto(), | ||
override val isOwner: Boolean = false, | ||
override val bpnL: String? = null, | ||
override val bpnS: String? = null, | ||
override val bpnA: String? = null | ||
|
||
) : IBaseBusinessPartnerDto |
26 changes: 26 additions & 0 deletions
26
...hestrator-api/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/CleaningStep.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/******************************************************************************* | ||
* 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.orchestrator.api.model | ||
|
||
enum class CleaningStep { | ||
GenericCleaning, | ||
BpnProcessing, | ||
GoldenRecordUpdate | ||
} |
42 changes: 42 additions & 0 deletions
42
...i/src/main/kotlin/org/eclipse/tractusx/orchestrator/api/model/PhysicalPostalAddressDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* 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.orchestrator.api.model | ||
|
||
import com.neovisionaries.i18n.CountryCode | ||
import org.eclipse.tractusx.bpdm.common.dto.GeoCoordinateDto | ||
import org.eclipse.tractusx.bpdm.common.dto.IBasePhysicalPostalAddressDto | ||
|
||
data class PhysicalPostalAddressDto( | ||
override val geographicCoordinates: GeoCoordinateDto? = null, | ||
override val country: CountryCode? = null, | ||
override val administrativeAreaLevel1: String? = null, | ||
override val administrativeAreaLevel2: String? = null, | ||
override val administrativeAreaLevel3: String? = null, | ||
override val postalCode: String? = null, | ||
override val city: String? = null, | ||
override val district: String? = null, | ||
override val street: StreetDto? = null, | ||
override val companyPostalCode: String? = null, | ||
override val industrialZone: String? = null, | ||
override val building: String? = null, | ||
override val floor: String? = null, | ||
override val door: String? = null | ||
|
||
) : IBasePhysicalPostalAddressDto |
Oops, something went wrong.