From 21360bde9fd99b650d1b2c3c118c715fc83c3605 Mon Sep 17 00:00:00 2001 From: Istvan Zoltan Nagy Date: Wed, 21 Feb 2024 17:04:58 +0100 Subject: [PATCH] Implementation of CRUD API for Access management APIs - Fixes issues which were causing failures when using with PostgreSQL --- .../tractusx/semantics/accesscontrol/sql/model/AccessRule.java | 2 +- .../tractusx/semantics/registry/service/ShellService.java | 1 + backend/src/main/resources/db/changelog/db.changelog-v4.yaml | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/access-control-service-sql-impl/src/main/java/org/eclipse/tractusx/semantics/accesscontrol/sql/model/AccessRule.java b/access-control-service-sql-impl/src/main/java/org/eclipse/tractusx/semantics/accesscontrol/sql/model/AccessRule.java index 6a1fba54..d08bb374 100644 --- a/access-control-service-sql-impl/src/main/java/org/eclipse/tractusx/semantics/accesscontrol/sql/model/AccessRule.java +++ b/access-control-service-sql-impl/src/main/java/org/eclipse/tractusx/semantics/accesscontrol/sql/model/AccessRule.java @@ -56,7 +56,7 @@ public enum PolicyType { @Null( groups = OnCreate.class ) @NotNull( groups = OnUpdate.class ) @Id - @GeneratedValue( strategy = GenerationType.AUTO ) + @GeneratedValue( strategy = GenerationType.SEQUENCE, generator = "ACCESS_RULE_SEQ") @Column( name = "ID", nullable = false, updatable = false ) private Long id; diff --git a/backend/src/main/java/org/eclipse/tractusx/semantics/registry/service/ShellService.java b/backend/src/main/java/org/eclipse/tractusx/semantics/registry/service/ShellService.java index 32f8bccc..b1b0ff8d 100644 --- a/backend/src/main/java/org/eclipse/tractusx/semantics/registry/service/ShellService.java +++ b/backend/src/main/java/org/eclipse/tractusx/semantics/registry/service/ShellService.java @@ -494,6 +494,7 @@ public List saveBatch( List shells ) { } ).collect( Collectors.toList() ); } + @Transactional(readOnly = true) public boolean hasAccessToShellWithVisibleSubmodelEndpoint( String endpointAddress, String externalSubjectId ) { List shells = shellRepository.findAllBySubmodelEndpointAddress( endpointAddress ); List filtered = shellAccessHandler.filterListOfShellProperties( shells, externalSubjectId ); diff --git a/backend/src/main/resources/db/changelog/db.changelog-v4.yaml b/backend/src/main/resources/db/changelog/db.changelog-v4.yaml index 29a7c1cf..a7fc9b0e 100644 --- a/backend/src/main/resources/db/changelog/db.changelog-v4.yaml +++ b/backend/src/main/resources/db/changelog/db.changelog-v4.yaml @@ -43,7 +43,6 @@ databaseChangeLog: nullable: false validateNullable: true autoIncrement: true - generationType: ALWAYS startWith: 1 incrementBy: 50 - column: