+ List<OtnDeviceRenderingResult> renderingResults =
+ otnDeviceRendering(
+ new RollbackProcessor(),
+ // This is A-Z side
+ ModelMappingUtils
+ .rendererCreateOtnServiceInput(
+ serviceName,
+ Action.Delete,
+ service.getServiceAEnd().getServiceFormat().getName(),
+ service.getServiceAEnd().getServiceRate(),
+ pathDescription,
+ true),
+ // This is Z-A side
+ ModelMappingUtils
+ .rendererCreateOtnServiceInput(
+ serviceName,
+ Action.Delete,
+ service.getServiceZEnd().getServiceFormat().getName(),
+ service.getServiceAEnd().getServiceRate(),
+ pathDescription,
+ false),
+ serviceType);
+ sendNotificationsWithPathDescription(
+ ServicePathNotificationTypes.ServiceDelete,
+ serviceName,
+ RpcStatusEx.Successful,
+ OPERATION_SUCCESSFUL,
+ pathDescription,
+ createLinkForNotif(
+ renderingResults.stream()
+ .flatMap(rr -> rr.getOtnLinkTps().stream())
+ .collect(Collectors.toList())),
+ getSupportedLinks(
+ ModelMappingUtils.getLinksFromServicePathDescription(pathDescription),
+ serviceType),
+ serviceType);
+ return true;
+ }
+
+ /**
+ * Send renderer notification.
+ * @param servicePathNotificationTypes ServicePathNotificationTypes
+ * @param serviceName String
+ * @param rpcStatusEx RpcStatusEx
+ * @param message String
+ */
+ private void sendNotifications(
+ ServicePathNotificationTypes servicePathNotificationTypes,
+ String serviceName,
+ RpcStatusEx rpcStatusEx,
+ String message) {
+ send(
+ buildNotification(servicePathNotificationTypes, serviceName, rpcStatusEx, message,
+ null, null, null, null));
+ }
+
+ /**
+ * Send renderer notification with path description information.
+ * @param servicePathNotificationTypes ServicePathNotificationTypes
+ * @param serviceName String
+ * @param rpcStatusEx RpcStatusEx
+ * @param message String
+ * @param pathDescription PathDescription
+ */
+ private void sendNotificationsWithPathDescription(
+ ServicePathNotificationTypes servicePathNotificationTypes,
+ String serviceName,
+ RpcStatusEx rpcStatusEx,
+ String message,
+ PathDescription pathDescription,
+ Link notifLink,
+ Set<String> supportedLinks,
+ String serviceType) {
+ send(
+ buildNotification(servicePathNotificationTypes, serviceName, rpcStatusEx, message,
+ pathDescription, notifLink, supportedLinks, serviceType));
+ }
+
+ /**
+ * Build notification containing path description information.
+ * @param servicePathNotificationTypes ServicePathNotificationTypes
+ * @param serviceName String
+ * @param rpcStatusEx RpcStatusEx
+ * @param message String
+ * @param pathDescription PathDescription
+ * @return notification with RendererRpcResultSp type.
+ */
+ private RendererRpcResultSp buildNotification(
+ ServicePathNotificationTypes servicePathNotificationTypes,
+ String serviceName,
+ RpcStatusEx rpcStatusEx,
+ String message,
+ PathDescription pathDescription,
+ Link notifLink,
+ Set<String> supportedLinks,
+ String serviceType) {
+ RendererRpcResultSpBuilder builder =
+ new RendererRpcResultSpBuilder()
+ .setNotificationType(servicePathNotificationTypes).setServiceName(serviceName).setStatus(rpcStatusEx)
+ .setStatusMessage(message)
+ .setServiceType(serviceType);
+ if (pathDescription != null) {
+ builder
+ .setAToZDirection(pathDescription.getAToZDirection())
+ .setZToADirection(pathDescription.getZToADirection());