From 4f5e5bf75135a151cba53efef7d178bd56a03d03 Mon Sep 17 00:00:00 2001 From: Friedrich Volz Date: Thu, 22 Aug 2024 15:13:21 +0200 Subject: [PATCH] sonarcloud improve code --- .../registry/jpa/util/ModelTransformationHelper.java | 3 +-- .../faaast/registry/memory/AasRepositoryMemory.java | 12 ++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/persistence/jpa/src/main/java/de/fraunhofer/iosb/ilt/faaast/registry/jpa/util/ModelTransformationHelper.java b/persistence/jpa/src/main/java/de/fraunhofer/iosb/ilt/faaast/registry/jpa/util/ModelTransformationHelper.java index 73e4352..8e46628 100644 --- a/persistence/jpa/src/main/java/de/fraunhofer/iosb/ilt/faaast/registry/jpa/util/ModelTransformationHelper.java +++ b/persistence/jpa/src/main/java/de/fraunhofer/iosb/ilt/faaast/registry/jpa/util/ModelTransformationHelper.java @@ -80,10 +80,9 @@ public static JpaAssetAdministrationShellDescriptor convertAAS(AssetAdministrati if (aas == null) { return null; } - JpaAssetAdministrationShellDescriptor retval = new JpaAssetAdministrationShellDescriptor.Builder() + return new JpaAssetAdministrationShellDescriptor.Builder() .from(aas) .build(); - return retval; } diff --git a/persistence/memory/src/main/java/de/fraunhofer/iosb/ilt/faaast/registry/memory/AasRepositoryMemory.java b/persistence/memory/src/main/java/de/fraunhofer/iosb/ilt/faaast/registry/memory/AasRepositoryMemory.java index d7676d7..cd22695 100644 --- a/persistence/memory/src/main/java/de/fraunhofer/iosb/ilt/faaast/registry/memory/AasRepositoryMemory.java +++ b/persistence/memory/src/main/java/de/fraunhofer/iosb/ilt/faaast/registry/memory/AasRepositoryMemory.java @@ -188,25 +188,21 @@ private AssetAdministrationShellDescriptor fetchAAS(String aasId) { private static boolean filterAssetType(AssetAdministrationShellDescriptor aas, String assetType) { - boolean retval; if (assetType == null) { - retval = true; + return true; } else { - retval = aas.getAssetType().equals(assetType); + return aas.getAssetType().equals(assetType); } - return retval; } private static boolean filterAssetKind(AssetAdministrationShellDescriptor aas, AssetKind assetKind) { - boolean retval; if (assetKind == null) { - retval = true; + return true; } else { - retval = aas.getAssetKind() == assetKind; + return aas.getAssetKind() == assetKind; } - return retval; } }