Source:
public StructuredNotificationEvent createStructuredNotificationEvent(Stack stack, String notificationType, String message, String instanceGroupName) { Long stackId = stack.getId(); NotificationDetails notificationDetails = new NotificationDetails(); notificationDetails.setNotificationType(notificationType); notificationDetails.setNotification(message); notificationDetails.setStackId(stackId); String stackName = stack.getName(); String userName = stack.getCreator().getUserName(); String userId = stack.getCreator().getUserId(); try { notificationDetails.setCloud(stack.cloudPlatform()); notificationDetails.setRegion(stack.getRegion()); notificationDetails.setAvailabiltyZone(stack.getAvailabilityZone()); notificationDetails.setStackName(stack.getDisplayName()); notificationDetails.setStackStatus(stack.getStatus().name()); notificationDetails.setNodeCount(stack.getNotDeletedInstanceMetaDataSet().size()); Cluster cluster = stack.getCluster(); notificationDetails.setInstanceGroup(instanceGroupName); if (cluster != null) { notificationDetails.setClusterId(cluster.getId()); notificationDetails.setClusterName(cluster.getName()); notificationDetails.setClusterStatus(cluster.getStatus().name()); Blueprint blueprint = cluster.getBlueprint(); if (blueprint != null) { notificationDetails.setBlueprintId(blueprint.getId()); notificationDetails.setBlueprintName(blueprint.getStackName()); } } } catch (AccessDeniedException e) { LOGGER.info("Access denied in structured notification event creation, user: {}, stack: {}", userName, stackId, e); } String resourceType = (stack.getType() == null || stack.getType().equals(StackType.WORKLOAD)) ? CloudbreakEventService.DATAHUB_RESOURCE_TYPE : "sdx"; OperationDetails operationDetails = new OperationDetails(clock.getCurrentTimeMillis(), NOTIFICATION, resourceType, stackId, stackName, nodeConfig.getInstanceUUID(), cbVersion, stack.getWorkspace().getId(), userId, userName, stack.getTenant().getName(), stack.getResourceCrn(), stack.getCreator().getUserCrn(), stack.getEnvironmentCrn(), null); return new StructuredNotificationEvent(operationDetails, notificationDetails); }

Target:
public StructuredNotificationEvent createStructuredNotificationEvent(Stack stack, String notificationType, String message, String instanceGroupName) { Long stackId = stack.getId(); NotificationDetails notificationDetails = new NotificationDetails(); notificationDetails.setNotificationType(notificationType); notificationDetails.setNotification(message); notificationDetails.setStackId(stackId); String stackName = stack.getName(); String userName = stack.getCreator().getUserName(); String userId = stack.getCreator().getUserId(); try { notificationDetails.setCloud(stack.cloudPlatform()); notificationDetails.setRegion(stack.getRegion()); notificationDetails.setAvailabiltyZone(stack.getAvailabilityZone()); notificationDetails.setStackName(stack.getDisplayName()); notificationDetails.setStackStatus(stack.getStatus().name()); notificationDetails.setNodeCount(stack.getNotDeletedInstanceMetaDataSet().size()); Cluster cluster = stack.getCluster(); notificationDetails.setInstanceGroup(instanceGroupName); if (cluster != null) { notificationDetails.setClusterId(cluster.getId()); notificationDetails.setClusterName(cluster.getName()); notificationDetails.setClusterStatus(cluster.getStatus().name()); Blueprint blueprint = cluster.getBlueprint(); if (blueprint != null) { notificationDetails.setBlueprintId(blueprint.getId()); notificationDetails.setBlueprintName(blueprint.getStackName()); } } } catch (AccessDeniedException e) { LOGGER.info("Access denied in structured notification event creation, user: {}, stack: {}", userName, stackId, e); } String resourceType = (stack.getType() == null || stack.getType().equals(StackType.WORKLOAD)) ? CloudbreakEventService.DATAHUB_RESOURCE_TYPE : CloudbreakEventService.DATALAKE_RESOURCE_TYPE; OperationDetails operationDetails = new OperationDetails(clock.getCurrentTimeMillis(), NOTIFICATION, resourceType, stackId, stackName, nodeConfig.getInstanceUUID(), cbVersion, stack.getWorkspace().getId(), userId, userName, stack.getTenant().getName(), stack.getResourceCrn(), stack.getCreator().getUserCrn(), stack.getEnvironmentCrn(), null); return new StructuredNotificationEvent(operationDetails, notificationDetails); }