From 7fa6daead66c81ea55d998c3df95b44123d137d2 Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Wed, 19 Jul 2023 13:18:47 +0200 Subject: [PATCH] fix: compile errors --- .github/workflows/dependency-check.yml | 49 +------------------ ...articipantToParticipantDtoTransformer.java | 25 +++------- 2 files changed, 9 insertions(+), 65 deletions(-) diff --git a/.github/workflows/dependency-check.yml b/.github/workflows/dependency-check.yml index 1d67c04d..721cd10b 100644 --- a/.github/workflows/dependency-check.yml +++ b/.github/workflows/dependency-check.yml @@ -9,50 +9,5 @@ permissions: contents: read jobs: - Check-Allowed-Licenses: - runs-on: ubuntu-latest - continue-on-error: false - if: ${{ github.event_name == 'pull_request' }} - steps: - - name: 'Checkout Repository' - uses: actions/checkout@v3 - - name: 'Dependency Review' - uses: actions/dependency-review-action@v3 - with: - fail-on-severity: critical - # Representation of this list: https://www.eclipse.org/legal/licenses.php# - # Expressed with the help of the following IDs: https://spdx.org/licenses/ - allow-licenses: >- - Adobe-Glyph, Apache-1.0, Apache-1.1, Apache-2.0, Artistic-2.0, BSD-2-Clause, BSD-3-Clause, - BSD-4-Clause, 0BSD, BSL-1.0, CDDL-1.0, CDDL-1.1, CPL-1.0, CC-BY-3.0, CC-BY-4.0, CC-BY-2.5, - CC-BY-SA-3.0, CC-BY-SA-4.0, CC0-1.0, EPL-1.0, EPL-2.0, FTL, GFDL-1.3-only, IPL-1.0, ISC, - MIT, MIT-0, MPL-1.1, MPL-2.0, NTP, OpenSSL, PHP-3.01, PostgreSQL, OFL-1.1, Unlicense, - Unicode-DFS-2015, Unicode-DFS-2016, Unicode-TOU, UPL-1.0, W3C-20150513, W3C-19980720, W3C, - WTFPL, X11, Zlib, ZPL-2.1 - - Dash-Dependency-Check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: ./.github/actions/setup-build - - name: Download latest Eclipse Dash - run: | - curl -L https://repo.eclipse.org/service/local/artifact/maven/redirect\?r\=dash-licenses\&g\=org.eclipse.dash\&a\=org.eclipse.dash.licenses\&v\=LATEST --output dash.jar - - name: Regenerate DEPENDENCIES - run: | - # dash returns a nonzero exit code if there are libs that need review. the "|| true" avoids that - ./gradlew allDependencies | grep -Poh "(?<=\s)[\w.-]+:[\w.-]+:[^:\s\[\]]+" | sort | uniq | java -jar dash.jar - -summary DEPENDENCIES-gen || true - - # log warning if restricted deps are found - grep -E 'restricted' DEPENDENCIES | if test $(wc -l) -gt 0; then - echo "::warning file=DEPENDENCIES,title=Restricted Dependencies found::Some dependencies are marked 'restricted' - please review them" - fi - - # log error and fail job if rejected deps are found - grep -E 'rejected' DEPENDENCIES | if test $(wc -l) -gt 0; then - echo "::error file=DEPENDENCIES,title=Rejected Dependencies found::Some dependencies are marked 'rejected', they cannot be used" - exit 1 - fi - - name: Check for differences - run: | - diff DEPENDENCIES DEPENDENCIES-gen \ No newline at end of file + check: + uses: eclipse-edc/.github/.github/workflows/dependency-check.yml@main \ No newline at end of file diff --git a/extensions/registration-service-api/src/main/java/org/eclipse/edc/registration/transform/ParticipantToParticipantDtoTransformer.java b/extensions/registration-service-api/src/main/java/org/eclipse/edc/registration/transform/ParticipantToParticipantDtoTransformer.java index 78f91cf0..d667d9d4 100644 --- a/extensions/registration-service-api/src/main/java/org/eclipse/edc/registration/transform/ParticipantToParticipantDtoTransformer.java +++ b/extensions/registration-service-api/src/main/java/org/eclipse/edc/registration/transform/ParticipantToParticipantDtoTransformer.java @@ -14,19 +14,16 @@ package org.eclipse.edc.registration.transform; -import org.eclipse.edc.api.transformer.DtoTransformer; import org.eclipse.edc.registration.model.ParticipantDto; import org.eclipse.edc.registration.model.ParticipantStatusDto; import org.eclipse.edc.registration.spi.model.Participant; import org.eclipse.edc.registration.spi.model.ParticipantStatus; -import org.eclipse.edc.spi.EdcException; import org.eclipse.edc.transform.spi.TransformerContext; +import org.eclipse.edc.transform.spi.TypeTransformer; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static java.lang.String.format; - -public class ParticipantToParticipantDtoTransformer implements DtoTransformer { +public class ParticipantToParticipantDtoTransformer implements TypeTransformer { @Override public Class getInputType() { @@ -55,18 +52,10 @@ public Class getOutputType() { * @return {@link ParticipantStatusDto} */ private ParticipantStatusDto mapToDtoStatus(ParticipantStatus status) { - switch (status) { - case ONBOARDING_INITIATED: - case AUTHORIZING: - case AUTHORIZED: - return ParticipantStatusDto.ONBOARDING_IN_PROGRESS; - case ONBOARDED: - return ParticipantStatusDto.ONBOARDED; - case DENIED: - case FAILED: - return ParticipantStatusDto.DENIED; - default: - throw new EdcException(format("Unknown ParticipantStatus value: %s", status)); - } + return switch (status) { + case ONBOARDING_INITIATED, AUTHORIZING, AUTHORIZED -> ParticipantStatusDto.ONBOARDING_IN_PROGRESS; + case ONBOARDED -> ParticipantStatusDto.ONBOARDED; + case DENIED, FAILED -> ParticipantStatusDto.DENIED; + }; } }