code: public static AlertDto transformToDto(Alert alert) {
          if (alert == null) {
              throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
          }
  
          AlertDto result = createDtoObject(AlertDto.class, alert);
  
          result.setOwnerName(alert.getOwner().getUserName());
          for (Trigger trigger : alert.getTriggers()) {
              result.addTriggersIds(trigger);
          }
          for (Notification notification : alert.getNotifications()) {
              result.addNotificationsIds(notification);
          }
          return result;
      }
docs: Converts alert entity to alertDto.
  
  @param   alert  The alert object. Cannot be null.
  
  @return  AlertDto object.
  
  @throws  WebApplicationException  If an error occurs.