-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Remove custom exists queries and use jpql to have spring do queries based on the drivers which handle all details * Run spotless:apply * Update to recitfy exists statement that had a not clause in it. * Use a converter to ensure that the data is converted correctly from the db to the app and vice versa --------- Signed-off-by: Aindriu Lavelle <[email protected]>
- Loading branch information
1 parent
693fd74
commit 487f684
Showing
13 changed files
with
89 additions
and
102 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
32 changes: 32 additions & 0 deletions
32
core/src/main/java/io/aiven/klaw/helpers/AclIPPrincipleTypeConverter.java
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,32 @@ | ||
package io.aiven.klaw.helpers; | ||
|
||
import io.aiven.klaw.model.enums.AclIPPrincipleType; | ||
import jakarta.persistence.AttributeConverter; | ||
import jakarta.persistence.Converter; | ||
|
||
@Converter | ||
public class AclIPPrincipleTypeConverter | ||
implements AttributeConverter<AclIPPrincipleType, Integer> { | ||
|
||
@Override | ||
public Integer convertToDatabaseColumn(AclIPPrincipleType aclIPPrincipleType) { | ||
if (aclIPPrincipleType == null) { | ||
return null; | ||
} | ||
|
||
return aclIPPrincipleType.ordinal(); | ||
} | ||
|
||
@Override | ||
public AclIPPrincipleType convertToEntityAttribute(Integer ordinalAclIpPrincipalType) { | ||
if (ordinalAclIpPrincipalType == null) { | ||
return null; | ||
} | ||
return switch (ordinalAclIpPrincipalType) { | ||
case 0 -> AclIPPrincipleType.IP_ADDRESS; | ||
case 1 -> AclIPPrincipleType.PRINCIPAL; | ||
case 2 -> AclIPPrincipleType.USERNAME; | ||
default -> 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
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
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