-
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(Pool): add operator endpoints for searching and updating Cx memb…
…ership of legal entities - add GET and PUT endpoints for new Cx membership REST resource - adapt golden record task processing logic to ignore isCatenaXMemberData flag if it is null - return isCatenaXMemberData for legal entities as in Pool database for golden record tasks - adapt tests - adapt documentation
- Loading branch information
Showing
36 changed files
with
3,469 additions
and
401 deletions.
There are no files selected for viewing
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
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
30 changes: 30 additions & 0 deletions
30
...rc/main/kotlin/org/eclipse/tractusx/bpdm/common/exception/BpdmValidationErrorException.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,30 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021,2024 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.eclipse.tractusx.bpdm.common.mapping.ValidationError | ||
import org.springframework.http.HttpStatus | ||
import org.springframework.web.bind.annotation.ResponseStatus | ||
|
||
|
||
@ResponseStatus(HttpStatus.BAD_REQUEST) | ||
class BpdmValidationErrorException( | ||
val validationErrors: List<ValidationError> | ||
): RuntimeException(validationErrors.joinToString()) |
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
22 changes: 22 additions & 0 deletions
22
...rc/main/kotlin/org/eclipse/tractusx/bpdm/common/mapping/BpdmValidateAndMapStringMapper.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,22 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021,2024 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.mapping | ||
|
||
interface BpdmValidateAndMapStringMapper<TO_TYPE>: BpdmStringMapper<TO_TYPE>, BpdmValidateAndMapMapper<String, TO_TYPE> |
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
58 changes: 58 additions & 0 deletions
58
bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/mapping/BpnValidation.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,58 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021,2024 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.mapping | ||
|
||
class BpnValidation( | ||
private val bpnTypeDescriptor: String, | ||
private val errorCode: String, | ||
private val errorDetails: String, | ||
private val bpnPrefix: String = "BPN", | ||
private val codeLength: Int = 10, | ||
private val checksumLength: Int = 2, | ||
private val allowedAlphabet: String = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", | ||
|
||
): BpdmValidation<String> { | ||
|
||
companion object{ | ||
val bpnLValidation = BpnValidation( | ||
"L", | ||
CommonValidationErrorCodes.BpnL.name, | ||
CommonValidationErrorCodes.BpnL.description | ||
) | ||
} | ||
|
||
|
||
private val correctTypePrefix = bpnPrefix + bpnTypeDescriptor | ||
private val correctPrefixLength = correctTypePrefix.length | ||
private val correctLength = correctPrefixLength + codeLength + checksumLength | ||
private val allowedAlphabetSet = allowedAlphabet.toSet() | ||
|
||
override fun validate(value: String, context: ValidationContext): ValidationError? { | ||
val wrongLength = value.length != correctLength | ||
val wrongTypePrefix = !value.startsWith(correctTypePrefix) | ||
val wrongAlphabet = value.any { it !in allowedAlphabetSet } | ||
// We could also check the checksum here but won't do for now to be compatible to legacy checksums | ||
|
||
return if(wrongLength || wrongTypePrefix || wrongAlphabet) | ||
ValidationError(errorCode, errorDetails, value, context) | ||
else null | ||
|
||
} | ||
} |
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
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
35 changes: 35 additions & 0 deletions
35
bpdm-common/src/main/kotlin/org/eclipse/tractusx/bpdm/common/mapping/types/BpnLString.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,35 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2021,2024 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.mapping.types | ||
|
||
import org.eclipse.tractusx.bpdm.common.mapping.BpdmValidateAndMapStringMapper | ||
import org.eclipse.tractusx.bpdm.common.mapping.BpnValidation | ||
|
||
@JvmInline | ||
value class BpnLString(val value: String) { | ||
|
||
init { assert(value) } | ||
|
||
companion object: BpdmValidateAndMapStringMapper<BpnLString>{ | ||
override fun transform(value: String) = BpnLString(value) | ||
|
||
override val validations = listOf(BpnValidation.bpnLValidation) | ||
} | ||
} |
Oops, something went wrong.