Package it.univr.passportease.dto.input
Class AvailabilityFilters
java.lang.Object
it.univr.passportease.dto.input.AvailabilityFilters
- All Implemented Interfaces:
Serializable
,org.springframework.data.jpa.domain.Specification<Availability>
public class AvailabilityFilters
extends Object
implements org.springframework.data.jpa.domain.Specification<Availability>
Filters to apply to the
Availability
query.
Used in UserWorkerQueryService.getAvailabilities(AvailabilityFilters, Integer, Integer)
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate Date
The end date to filter the query by.private LocalTime
The end time to filter the query by.The offices name to filter the query by.The request types to filter the query by.private Date
The start date to filter the query by.private LocalTime
The start time to filter the query by.Fields inherited from interface org.springframework.data.jpa.domain.Specification
serialVersionUID
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
Checks if the start date and end date are valid.private boolean
Checks if the start date, end date, start time and end time are valid.private boolean
Checks if the start date and end date are valid.private boolean
Checks if the start date, end date, start time and end time are valid.jakarta.persistence.criteria.Predicate
toPredicate
(@NotNull jakarta.persistence.criteria.Root<Availability> root, @NotNull jakarta.persistence.criteria.CriteriaQuery<?> query, @NotNull jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) Creates aPredicate
from theAvailabilityFilters
object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.jpa.domain.Specification
and, or
-
Field Details
-
officesName
The offices name to filter the query by. -
requestTypes
The request types to filter the query by. -
startDate
The start date to filter the query by. -
endDate
The end date to filter the query by. -
startTime
The start time to filter the query by. -
endTime
The end time to filter the query by.
-
-
Constructor Details
-
AvailabilityFilters
public AvailabilityFilters()
-
-
Method Details
-
toPredicate
public jakarta.persistence.criteria.Predicate toPredicate(@NotNull @NotNull jakarta.persistence.criteria.Root<Availability> root, @NotNull @NotNull jakarta.persistence.criteria.CriteriaQuery<?> query, @NotNull @NotNull jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder) Creates aPredicate
from theAvailabilityFilters
object. ThePredicate
is used to filter theAvailability
query.- Specified by:
toPredicate
in interfaceorg.springframework.data.jpa.domain.Specification<Availability>
- Parameters:
root
- must not be null. The root entity, i.e.Availability
query
- must not be null. The query to modify. Not used in this implementationcriteriaBuilder
- must not be null. Builder used to construct thePredicate
- Returns:
Predicate
to apply to the query.
-
isEndTimeValid
private boolean isEndTimeValid()Checks if the start date, end date, start time and end time are valid.- Returns:
- True if the end time is valid, that is if the start time is before the end time or the end time is null.
-
isStartTimeValid
private boolean isStartTimeValid()Checks if the start date, end date, start time and end time are valid.- Returns:
- True if the start time is valid, that is if the end time is after the start time or the start time is null.
-
isEndDateValid
private boolean isEndDateValid()Checks if the start date and end date are valid.- Returns:
- True if the end date is valid, that is if the start date is before the end date or the end date is null.
-
isStartDateValid
private boolean isStartDateValid()Checks if the start date and end date are valid.- Returns:
- True if the start date is valid, that is if the end date is after the start date or the start date is null.
-