-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CCMSPUI-379 Implemented filters for NotificationSearchRepository
Signed-off-by: Jamie Briggs <jamie.briggs@digital.justice.gov.uk>
- Loading branch information
Jamie Briggs
committed
Feb 13, 2025
1 parent
404ece3
commit fab2af1
Showing
8 changed files
with
348 additions
and
51 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
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
28 changes: 28 additions & 0 deletions
28
data-service/src/main/java/uk/gov/laa/ccms/data/repository/BaseEntityManagerRepository.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,28 @@ | ||
package uk.gov.laa.ccms.data.repository; | ||
|
||
import jakarta.persistence.EntityManager; | ||
import java.util.StringJoiner; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
@RequiredArgsConstructor | ||
public abstract class BaseEntityManagerRepository { | ||
|
||
protected final EntityManager entityManager; | ||
|
||
protected static boolean stringNotEmpty(String value) { | ||
return value != null && !value.isEmpty(); | ||
} | ||
|
||
protected static String getSortSql(Pageable pageable) { | ||
if (pageable.getSort().isEmpty()) { | ||
return " "; | ||
} | ||
|
||
StringJoiner sortJoiner = new StringJoiner(", ", " ORDER BY ", " "); | ||
pageable.getSort().forEach(order -> | ||
sortJoiner.add(order.getProperty() + " " + order.getDirection().name())); | ||
return sortJoiner.toString(); | ||
} | ||
|
||
} |
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
Oops, something went wrong.