- public CpsDataUpdatedEvent createCpsDataUpdatedEvent(final String dataspaceName, final String anchorName) {
- final var dataNode = cpsDataService
- .getDataNode(dataspaceName, anchorName, "/", FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS);
- final var anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
- return toCpsDataUpdatedEvent(anchor, dataNode);
+ public CpsDataUpdatedEvent createCpsDataUpdatedEvent(final Anchor anchor,
+ final OffsetDateTime observedTimestamp, final Operation operation) {
+ final var dataNode = (operation == Operation.DELETE) ? null :
+ cpsDataService.getDataNode(anchor.getDataspaceName(), anchor.getName(),
+ "/", FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS);
+ return toCpsDataUpdatedEvent(anchor, dataNode, observedTimestamp, operation);