allow to pass null for initial pagination context and use the default one in that case

This commit is contained in:
Dmitry Toptygin
2020-06-02 12:49:26 -04:00
parent 7fa02ca1c5
commit 29e4824d09
41 changed files with 241 additions and 23 deletions

View File

@@ -205,6 +205,10 @@ public class AlarmDatastoreInMemory extends BaseInMemoryDatastore implements Ala
public PaginationResponse<Alarm> getForCustomer(int customerId, Set<Long> equipmentIdSet, Set<AlarmCode> alarmCodeSet,
long createdAfterTimestamp, List<ColumnAndSort> sortBy, PaginationContext<Alarm> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<Alarm> ret = new PaginationResponse<>();
ret.setContext(context.clone());

View File

@@ -58,6 +58,11 @@ public class AlarmDatastoreRdbms implements AlarmDatastore {
public PaginationResponse<Alarm> getForCustomer(int customerId, Set<Long> equipmentIdSet,
Set<AlarmCode> alarmCodeSet, long createdAfterTimestamp, List<ColumnAndSort> sortBy,
PaginationContext<Alarm> context) {
if(context == null) {
context = new PaginationContext<>();
}
return alarmDAO.getForCustomer(customerId, equipmentIdSet,
alarmCodeSet, createdAfterTimestamp, sortBy,
context);

View File

@@ -125,7 +125,11 @@ public class AlarmController {
@RequestParam Set<AlarmCode> alarmCodeSet,
@RequestParam long createdAfterTimestamp,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Alarm> paginationContext) {
@RequestParam(required = false) PaginationContext<Alarm> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Alarms for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());

View File

@@ -137,6 +137,10 @@ public class ClientDatastoreInMemory extends BaseInMemoryDatastore implements Cl
public PaginationResponse<Client> getForCustomer(int customerId,
final List<ColumnAndSort> sortBy, PaginationContext<Client> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<Client> ret = new PaginationResponse<>();
ret.setContext(context.clone());
@@ -328,6 +332,10 @@ public class ClientDatastoreInMemory extends BaseInMemoryDatastore implements Cl
Set<Long> equipmentIds,
final List<ColumnAndSort> sortBy, PaginationContext<ClientSession> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<ClientSession> ret = new PaginationResponse<>();
ret.setContext(context.clone());

View File

@@ -53,6 +53,11 @@ public class ClientDatastoreRdbms implements ClientDatastore {
@Override
public PaginationResponse<Client> getForCustomer(int customerId, List<ColumnAndSort> sortBy,
PaginationContext<Client> context) {
if(context == null) {
context = new PaginationContext<>();
}
return clientDAO.getForCustomer( customerId, sortBy, context);
}
@@ -84,6 +89,11 @@ public class ClientDatastoreRdbms implements ClientDatastore {
@Override
public PaginationResponse<ClientSession> getSessionsForCustomer(int customerId, Set<Long> equipmentIds,
List<ColumnAndSort> sortBy, PaginationContext<ClientSession> context) {
if(context == null) {
context = new PaginationContext<>();
}
return clientSessionDAO.getSessionsForCustomer(customerId, equipmentIds, sortBy, context);
}

View File

@@ -124,7 +124,11 @@ public class ClientController {
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
public PaginationResponse<Client> getForCustomer(@RequestParam int customerId,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Client> paginationContext) {
@RequestParam(required = false) PaginationContext<Client> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Clients for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());
@@ -242,7 +246,11 @@ public class ClientController {
public PaginationResponse<ClientSession> getSessionsForCustomer(@RequestParam int customerId,
@RequestParam Set<Long> equipmentIds,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<ClientSession> paginationContext) {
@RequestParam(required = false) PaginationContext<ClientSession> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Client sessions for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());

View File

@@ -166,6 +166,10 @@ public class EquipmentDatastoreInMemory extends BaseInMemoryDatastore implements
public PaginationResponse<Equipment> getForCustomer(int customerId,
final List<ColumnAndSort> sortBy, PaginationContext<Equipment> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<Equipment> ret = new PaginationResponse<>();
ret.setContext(context.clone());
@@ -261,6 +265,10 @@ public class EquipmentDatastoreInMemory extends BaseInMemoryDatastore implements
public PaginationResponse<Equipment> getForCustomer(int customerId, EquipmentType equipmentType,
Set<Long> locationIds, final List<ColumnAndSort> sortBy, PaginationContext<Equipment> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<Equipment> ret = new PaginationResponse<>();
ret.setContext(context.clone());

View File

@@ -56,12 +56,22 @@ public class EquipmentDatastoreRdbms implements EquipmentDatastore {
@Override
public PaginationResponse<Equipment> getForCustomer(int customerId, List<ColumnAndSort> sortBy,
PaginationContext<Equipment> context) {
if(context == null) {
context = new PaginationContext<>();
}
return equipmentDAO.getForCustomer( customerId, sortBy, context);
}
@Override
public PaginationResponse<Equipment> getForCustomer(int customerId, EquipmentType equipmentType,
Set<Long> locationIds, List<ColumnAndSort> sortBy, PaginationContext<Equipment> context) {
if(context == null) {
context = new PaginationContext<>();
}
return equipmentDAO.getForCustomer( customerId, equipmentType, locationIds, sortBy, context);
}

View File

@@ -154,7 +154,11 @@ public class EquipmentController {
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
public PaginationResponse<Equipment> getForCustomer(@RequestParam int customerId,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Equipment> paginationContext) {
@RequestParam(required = false) PaginationContext<Equipment> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Equipments for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());
@@ -185,7 +189,11 @@ public class EquipmentController {
public PaginationResponse<Equipment> getForCustomerWithFilter(@RequestParam int customerId,
@RequestParam EquipmentType equipmentType, @RequestParam Set<Long> locationIds,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Equipment> paginationContext) {
@RequestParam(required = false) PaginationContext<Equipment> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up equipment {} for customer {} locations {} last returned page number {}", equipmentType,
customerId, locationIds, paginationContext.getLastReturnedPageNumber());

View File

@@ -148,6 +148,10 @@ public class FirmwareDatastoreInMemory extends BaseInMemoryDatastore implements
public PaginationResponse<Firmware> getForCustomer(int customerId,
final List<ColumnAndSort> sortBy, PaginationContext<Firmware> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<Firmware> ret = new PaginationResponse<>();
ret.setContext(context.clone());

View File

@@ -55,6 +55,11 @@ public class FirmwareDatastoreRdbms implements FirmwareDatastore {
@Override
public PaginationResponse<Firmware> getForCustomer(int customerId, List<ColumnAndSort> sortBy,
PaginationContext<Firmware> context) {
if(context == null) {
context = new PaginationContext<>();
}
return firmwareDAO.getForCustomer( customerId, sortBy, context);
}
}

View File

@@ -134,7 +134,11 @@ public class FirmwareController {
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
public PaginationResponse<Firmware> getForCustomer(@RequestParam int customerId,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Firmware> paginationContext) {
@RequestParam(required = false) PaginationContext<Firmware> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Firmwares for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());

View File

@@ -182,6 +182,10 @@ public class LocationDatastoreInMemory extends BaseInMemoryDatastore implements
public PaginationResponse<Location> getForCustomer(int customerId,
final List<ColumnAndSort> sortBy, PaginationContext<Location> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<Location> ret = new PaginationResponse<>();
ret.setContext(context.clone());

View File

@@ -66,6 +66,11 @@ public class LocationDatastoreRdbms implements LocationDatastore {
@Override
public PaginationResponse<Location> getForCustomer(int customerId, List<ColumnAndSort> sortBy,
PaginationContext<Location> context) {
if(context == null) {
context = new PaginationContext<>();
}
return locationDAO.getForCustomer( customerId, sortBy, context);
}

View File

@@ -200,7 +200,11 @@ public class LocationServiceController {
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
public PaginationResponse<Location> getForCustomer(@RequestParam int customerId,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Location> paginationContext) {
@RequestParam(required = false) PaginationContext<Location> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Locations for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());

View File

@@ -148,6 +148,10 @@ public class ManufacturerDatastoreInMemory extends BaseInMemoryDatastore impleme
public PaginationResponse<Manufacturer> getForCustomer(int customerId,
final List<ColumnAndSort> sortBy, PaginationContext<Manufacturer> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<Manufacturer> ret = new PaginationResponse<>();
ret.setContext(context.clone());

View File

@@ -55,6 +55,11 @@ public class ManufacturerDatastoreRdbms implements ManufacturerDatastore {
@Override
public PaginationResponse<Manufacturer> getForCustomer(int customerId, List<ColumnAndSort> sortBy,
PaginationContext<Manufacturer> context) {
if(context == null) {
context = new PaginationContext<>();
}
return manufacturerDAO.getForCustomer( customerId, sortBy, context);
}
}

View File

@@ -134,7 +134,11 @@ public class ManufacturerController {
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
public PaginationResponse<Manufacturer> getForCustomer(@RequestParam int customerId,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Manufacturer> paginationContext) {
@RequestParam(required = false) PaginationContext<Manufacturer> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Manufacturers for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());

View File

@@ -62,7 +62,11 @@ public class AlarmPortalController {
@RequestParam(required = false) Set<AlarmCode> alarmCodes,
@RequestParam(required = false, defaultValue = "-1") long createdAfterTimestamp,
@RequestParam(required = false) List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Alarm> paginationContext) {
@RequestParam(required = false) PaginationContext<Alarm> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Alarms for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());

View File

@@ -115,7 +115,11 @@ public class ClientPortalController {
public PaginationResponse<ClientSession> getClientSessionsForCustomer(@RequestParam int customerId,
@RequestParam(required = false) Set<Long> equipmentIds,
@RequestParam(required = false) List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<ClientSession> paginationContext) {
@RequestParam(required = false) PaginationContext<ClientSession> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Client Sessions for customer {} equipment {} with last returned page number {}",
customerId, equipmentIds, paginationContext.getLastReturnedPageNumber());

View File

@@ -99,7 +99,11 @@ public class EquipmentPortalController {
@RequestMapping(value = "/equipment/forCustomer", method = RequestMethod.GET)
public PaginationResponse<Equipment> getForCustomer(@RequestParam int customerId,
@RequestParam(required = false) List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Equipment> paginationContext) {
@RequestParam(required = false) PaginationContext<Equipment> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Equipments for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());
@@ -131,7 +135,11 @@ public class EquipmentPortalController {
@RequestParam(required = false) EquipmentType equipmentType,
@RequestParam(required = false) Set<Long> locationIds,
@RequestParam(required = false) List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Equipment> paginationContext) {
@RequestParam(required = false) PaginationContext<Equipment> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up equipment {} for customer {} locations {} last returned page number {}", equipmentType,
customerId, locationIds, paginationContext.getLastReturnedPageNumber());

View File

@@ -121,7 +121,11 @@ public class LocationPortalController {
@RequestMapping(value = "/location/forCustomer", method = RequestMethod.GET)
public PaginationResponse<Location> getForCustomer(@RequestParam int customerId,
@RequestParam(required = false) List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Location> paginationContext) {
@RequestParam(required = false) PaginationContext<Location> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Locations for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());

View File

@@ -123,7 +123,11 @@ public class PortalUserPortalController {
@RequestMapping(value = "/portalUser/forCustomer", method = RequestMethod.GET)
public PaginationResponse<PortalUser> getForCustomer(@RequestParam int customerId,
@RequestParam(required = false) List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<PortalUser> paginationContext) {
@RequestParam(required = false) PaginationContext<PortalUser> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up PortalUsers for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());

View File

@@ -95,7 +95,11 @@ public class ProfilePortalController {
@RequestMapping(value = "/profile/forCustomer", method = RequestMethod.GET)
public PaginationResponse<Profile> getForCustomer(@RequestParam int customerId,
@RequestParam(required = false) List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Profile> paginationContext) {
@RequestParam(required = false) PaginationContext<Profile> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Profiles for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());

View File

@@ -52,6 +52,10 @@ public class ServiceMetricPortalController {
@RequestParam(required = false) List<ColumnAndSort> sortBy,
@RequestParam(required = false) PaginationContext<ServiceMetric> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up ServiceMetrics for customer {} equipment {} from {} to {} with last returned page number {}",
customerId, equipmentIds, fromTime, toTime, paginationContext.getLastReturnedPageNumber());

View File

@@ -55,7 +55,11 @@ public class StatusPortalController {
@RequestMapping(value = "/status/forCustomer", method = RequestMethod.GET)
public PaginationResponse<Status> getForCustomer(@RequestParam int customerId,
@RequestParam(required = false) List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Status> paginationContext) {
@RequestParam(required = false) PaginationContext<Status> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Statuses for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());
@@ -87,7 +91,11 @@ public class StatusPortalController {
@RequestParam(required = false) Set<Long> equipmentIds,
@RequestParam(required = false) Set<StatusDataType> statusDataTypes,
@RequestParam(required = false) List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Status> paginationContext) {
@RequestParam(required = false) PaginationContext<Status> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up status for customer {} equipment {} type {} last returned page number {}",
customerId, equipmentIds, statusDataTypes, paginationContext.getLastReturnedPageNumber());

View File

@@ -160,6 +160,10 @@ public class PortalUserDatastoreInMemory extends BaseInMemoryDatastore implement
public PaginationResponse<PortalUser> getForCustomer(int customerId,
final List<ColumnAndSort> sortBy, PaginationContext<PortalUser> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<PortalUser> ret = new PaginationResponse<>();
ret.setContext(context.clone());

View File

@@ -60,6 +60,11 @@ public class PortalUserDatastoreRdbms implements PortalUserDatastore {
@Override
public PaginationResponse<PortalUser> getForCustomer(int customerId, List<ColumnAndSort> sortBy,
PaginationContext<PortalUser> context) {
if(context == null) {
context = new PaginationContext<>();
}
return portalUserDAO.getForCustomer( customerId, sortBy, context);
}
}

View File

@@ -152,7 +152,11 @@ public class PortalUserController {
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
public PaginationResponse<PortalUser> getForCustomer(@RequestParam int customerId,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<PortalUser> paginationContext) {
@RequestParam(required = false) PaginationContext<PortalUser> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up PortalUsers for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());

View File

@@ -152,6 +152,10 @@ public class ProfileDatastoreInMemory extends BaseInMemoryDatastore implements P
public PaginationResponse<Profile> getForCustomer(int customerId,
final List<ColumnAndSort> sortBy, PaginationContext<Profile> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<Profile> ret = new PaginationResponse<>();
ret.setContext(context.clone());

View File

@@ -55,6 +55,11 @@ public class ProfileDatastoreRdbms implements ProfileDatastore {
@Override
public PaginationResponse<Profile> getForCustomer(int customerId, List<ColumnAndSort> sortBy,
PaginationContext<Profile> context) {
if(context == null) {
context = new PaginationContext<>();
}
return profileDAO.getForCustomer( customerId, sortBy, context);
}

View File

@@ -134,7 +134,11 @@ public class ProfileController {
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
public PaginationResponse<Profile> getForCustomer(@RequestParam int customerId,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Profile> paginationContext) {
@RequestParam(required = false) PaginationContext<Profile> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Profiles for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());

View File

@@ -153,6 +153,10 @@ public class RoutingDatastoreInMemory extends BaseInMemoryDatastore implements R
public PaginationResponse<EquipmentRoutingRecord> getForCustomer(int customerId,
final List<ColumnAndSort> sortBy, PaginationContext<EquipmentRoutingRecord> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<EquipmentRoutingRecord> ret = new PaginationResponse<>();
ret.setContext(context.clone());

View File

@@ -57,6 +57,11 @@ public class RoutingDatastoreRdbms implements RoutingDatastore {
@Override
public PaginationResponse<EquipmentRoutingRecord> getForCustomer(int customerId, List<ColumnAndSort> sortBy,
PaginationContext<EquipmentRoutingRecord> context) {
if(context == null) {
context = new PaginationContext<>();
}
return routingDAO.getForCustomer( customerId, sortBy, context);
}

View File

@@ -143,7 +143,11 @@ public class RoutingController {
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
public PaginationResponse<EquipmentRoutingRecord> getForCustomer(@RequestParam int customerId,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<EquipmentRoutingRecord> paginationContext) {
@RequestParam(required = false) PaginationContext<EquipmentRoutingRecord> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Routings for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());

View File

@@ -233,6 +233,10 @@ public class StatusDatastoreInMemory extends BaseInMemoryDatastore implements St
private PaginationResponse<Status> getNextPage(PaginationFilter<Status> filter, List<ColumnAndSort> sortBy, PaginationContext<Status> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<Status> ret = new PaginationResponse<>();
ret.setContext(context.clone());

View File

@@ -51,12 +51,22 @@ public class StatusDatastoreRdbms implements StatusDatastore {
@Override
public PaginationResponse<Status> getForCustomer(int customerId, List<ColumnAndSort> sortBy,
PaginationContext<Status> context) {
if(context == null) {
context = new PaginationContext<>();
}
return statusDAO.getForCustomer( customerId, sortBy, context);
}
@Override
public PaginationResponse<Status> getForCustomer(int customerId, Set<Long> equipmentIds,
Set<StatusDataType> statusDataTypes, List<ColumnAndSort> sortBy, PaginationContext<Status> context) {
if(context == null) {
context = new PaginationContext<>();
}
return statusDAO.getForCustomer( customerId, equipmentIds, statusDataTypes, sortBy, context);
}
}

View File

@@ -81,7 +81,11 @@ public class StatusController {
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
public PaginationResponse<Status> getForCustomer(@RequestParam int customerId,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Status> paginationContext) {
@RequestParam(required = false) PaginationContext<Status> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Statuses for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());
@@ -113,7 +117,11 @@ public class StatusController {
@RequestParam Set<Long> equipmentIds,
@RequestParam Set<StatusDataType> statusDataTypes,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<Status> paginationContext) {
@RequestParam(required = false) PaginationContext<Status> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up Statuses for customer {} equipment {} types {} with last returned page number {}",
customerId, equipmentIds, statusDataTypes, paginationContext.getLastReturnedPageNumber());

View File

@@ -148,6 +148,10 @@ public class SystemEventDatastoreInMemory extends BaseInMemoryDatastore implemen
public PaginationResponse<SystemEventContainer> getForCustomer(int customerId,
final List<ColumnAndSort> sortBy, PaginationContext<SystemEventContainer> context) {
if(context == null) {
context = new PaginationContext<>();
}
PaginationResponse<SystemEventContainer> ret = new PaginationResponse<>();
ret.setContext(context.clone());

View File

@@ -55,6 +55,11 @@ public class SystemEventDatastoreRdbms implements SystemEventDatastore {
@Override
public PaginationResponse<SystemEventContainer> getForCustomer(int customerId, List<ColumnAndSort> sortBy,
PaginationContext<SystemEventContainer> context) {
if(context == null) {
context = new PaginationContext<>();
}
return systemEventDAO.getForCustomer( customerId, sortBy, context);
}
}

View File

@@ -125,7 +125,11 @@ public class SystemEventController {
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
public PaginationResponse<SystemEventContainer> getForCustomer(@RequestParam int customerId,
@RequestParam List<ColumnAndSort> sortBy,
@RequestParam PaginationContext<SystemEventContainer> paginationContext) {
@RequestParam(required = false) PaginationContext<SystemEventContainer> paginationContext) {
if(paginationContext == null) {
paginationContext = new PaginationContext<>();
}
LOG.debug("Looking up SystemEventRecords for customer {} with last returned page number {}",
customerId, paginationContext.getLastReturnedPageNumber());