Source:
<code>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); } <START> String resourceType = (stack.getType() == null || stack.getType().equals(StackType.WORKLOAD)) ? CloudbreakEventService.DATAHUB_RESOURCE_TYPE : "sdx"; <END> 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); }</code><technical_language>"sdx" "datalake" (I assume is a crn service name, sdx is deprecated now) refactored a constant</technical_language>

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); }