Compare commits

...

2 Commits

Author SHA1 Message Date
Kareem Dabbour
b03dccc63f WIFI-2508 added delete endpoint for systemevents that are older than a given time stamp 2021-05-31 17:23:12 -04:00
norm-traxler
03eccfa448 Merge pull request #109 from Telecominfraproject/WIFI-2434
WIFI 2434: Update SDK master to use image tag 1.2.0-SNAPSHOT
2021-05-26 21:27:38 -04:00
4 changed files with 40 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ public interface SystemEventServiceInterface {
GenericResponse create(SystemEventRecord systemEventRecord);
GenericResponse create(List<SystemEventRecord> systemEventRecords);
GenericResponse delete(int customerId, long equipmentId, long createdBeforeTimestamp);
GenericResponse delete(long createdBeforeTimestamp);
/**
* <br>Retrieves all of the SystemEvent records that are mapped to the provided customerId.

View File

@@ -44,6 +44,12 @@ public class SystemEventServiceLocal implements SystemEventServiceInterface {
LOG.debug("calling systemEventController.delete {} {} {}", customerId, equipmentId, createdBeforeTimestamp);
return systemEventController.delete(customerId, equipmentId, createdBeforeTimestamp);
}
@Override
public GenericResponse delete(long createdBeforeTimestamp) {
LOG.debug("calling systemEventController.delete {}", createdBeforeTimestamp);
return systemEventController.delete(createdBeforeTimestamp);
}
@Override
public PaginationResponse<SystemEventRecord> getForCustomer(long fromTime, long toTime, int customerId,

View File

@@ -150,7 +150,22 @@ public class SystemEventServiceRemote extends BaseRemoteClient implements System
LOG.debug("completed systemEventRecord.delete {} {} {}", customerId, equipmentId, createdBeforeTimestamp);
return ret;
}
}
@Override
public GenericResponse delete(long createdBeforeTimestamp) {
LOG.debug("calling systemEventRecord.delete {}", createdBeforeTimestamp);
ResponseEntity<GenericResponse> responseEntity = restTemplate.exchange(
getBaseUrl()
+"/delete?createdBeforeTimestamp={createdBeforeTimestamp}",
HttpMethod.DELETE, null, GenericResponse.class, createdBeforeTimestamp);
GenericResponse ret = responseEntity.getBody();
LOG.debug("completed systemEventRecords.delete {}", createdBeforeTimestamp);
return ret;
}
public String getBaseUrl() {
if(baseUrl==null) {

View File

@@ -157,4 +157,21 @@ public class SystemEventController {
return new GenericResponse(true, "");
}
/**
* Deletes SystemEventRecord records before a given time stamp
*
*/
@RequestMapping(value="/delete", method=RequestMethod.DELETE)
public GenericResponse delete(@RequestParam long createdBeforeTimestamp) {
LOG.debug("Deleting SystemEventRecords created before {}", createdBeforeTimestamp);
systemEventDatastore.delete(createdBeforeTimestamp);
LOG.debug("Deleted SystemEventRecords created before {}", createdBeforeTimestamp);
return new GenericResponse(true, "");
}
}