public interface AggregatedMovementRepository extends org.springframework.data.repository.PagingAndSortingRepository<AggregatedMovement,java.util.UUID>
Modifier and Type | Method and Description |
---|---|
java.util.Optional<AggregatedMovement> |
findByAreaIdAndPositionXAndPositionYAndSpeedBetweenAndTime(java.util.UUID areaId,
java.lang.Integer positionX,
java.lang.Integer positionY,
java.lang.Double minSpeed,
java.lang.Double maxSpeed,
java.time.Instant time) |
long |
getFilteredMovementCount(java.util.UUID monitoredAreaID,
boolean filterBySince,
java.time.Instant since,
boolean filterByUntil,
java.time.Instant until,
@Min(value=0L) double minVelocity,
@Min(value=-1L) double maxVelocity)
Returns the number of movements that would be returned by a call to
getFilteredMovements(UUID, boolean, Instant, boolean, Instant, double, double) getFilteredMovements}
with the same arguments
The filterBySince and filterByUntil parameters are needed due to known bugs in the
Hibernate adapter for PostgreSQL |
java.lang.Iterable<MovementView> |
getFilteredMovements(java.util.UUID monitoredAreaID,
boolean filterBySince,
java.time.Instant since,
boolean filterByUntil,
java.time.Instant until,
@Min(value=0L) double minVelocity,
@Min(value=-1L) double maxVelocity)
Returns movements filtered by the given criteria
The filterBySince and filterByUntil parameters are needed due to known bugs in the
Hibernate adapter for PostgreSQL
|
MinMax |
getVelocityRangeByArea(java.util.UUID monitoredAreaID,
boolean filterBySince,
java.time.Instant since,
boolean filterByUntil,
java.time.Instant until)
Returns the smallest and larges velocity recorded in the given area.
|
java.util.Optional<AggregatedMovement> findByAreaIdAndPositionXAndPositionYAndSpeedBetweenAndTime(java.util.UUID areaId, java.lang.Integer positionX, java.lang.Integer positionY, java.lang.Double minSpeed, java.lang.Double maxSpeed, java.time.Instant time)
@Query(value="select new smartmobility.entity.views.MovementView(am.positionX, am.positionY, sum(am.weight)) from AggregatedMovement am where am.area.id = ?1 and (?2 = false or am.time >= ?3) and (?4 = false or am.time < ?5) and am.speed >= ?6 and (?7 = -1.0 or am.speed <= ?7) group by am.positionX, am.positionY") java.lang.Iterable<MovementView> getFilteredMovements(java.util.UUID monitoredAreaID, boolean filterBySince, java.time.Instant since, boolean filterByUntil, java.time.Instant until, @Min(value=0L) @Min(value=0L) double minVelocity, @Min(value=-1L) @Min(value=-1L) double maxVelocity)
monitoredAreaID
- the ID of the monitored are who movements should be returnedfilterBySince
- true if since is null, false otherwisesince
- the time since when movements should be returnedfilterByUntil
- true if after is null, false otherwiseuntil
- the time until when movements should be returnedminVelocity
- minimum speed in pixels per second, points at which the speed was
lower will not be returnedmaxVelocity
- maximum speed in pixels per second (-1 for unlimited), points at
which the speed was higher will not be returned@Query(value="select count(amm) from AggregatedMovement amm where cast(amm.id as string) in (select max(cast(am.id as string)) from AggregatedMovement am where am.area.id = ?1 and (?2 = false or am.time >= ?3) and (?4 = false or am.time < ?5) and am.speed >= ?6 and (?7 = -1.0 or am.speed <= ?7) group by am.positionX, am.positionY)") long getFilteredMovementCount(java.util.UUID monitoredAreaID, boolean filterBySince, java.time.Instant since, boolean filterByUntil, java.time.Instant until, @Min(value=0L) @Min(value=0L) double minVelocity, @Min(value=-1L) @Min(value=-1L) double maxVelocity)
getFilteredMovements(UUID, boolean, Instant, boolean, Instant, double, double)
getFilteredMovements}
with the same arguments
The filterBySince and filterByUntil parameters are needed due to known bugs in the
Hibernate adapter for PostgreSQLmonitoredAreaID
- the ID of the monitored are who movements should be returnedfilterBySince
- true if since is null, false otherwisesince
- the time since when movements should be returnedfilterByUntil
- true if after is null, false otherwiseuntil
- the time until when movements should be returnedminVelocity
- minimum speed in pixels per second, points at which the speed was
lower will not be returnedmaxVelocity
- maximum speed in pixels per second (-1 for unlimited), points at
which the speed was higher will not be returned@Query(value="select new smartmobility.util.MinMax(min(am.speed), max(am.speed)) from AggregatedMovement am where am.area.id = ?1 and (?2 = false or am.time >= ?3) and (?4 = false or am.time < ?5)") MinMax getVelocityRangeByArea(java.util.UUID monitoredAreaID, boolean filterBySince, java.time.Instant since, boolean filterByUntil, java.time.Instant until)
monitoredAreaID
- the id of the monitored areafilterBySince
- true if since is null, false otherwisesince
- the time since when movements should be returnedfilterByUntil
- true if after is null, false otherwiseuntil
- the time until when movements should be returned