class UserNamespaceAuthorizationChangeMessageBuilder extends AbstractNotificationMessageBuilder implements NotificationMessageBuilder {

    @Override
    @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST", justification =
        "The NotificationEvent is cast to a UserNamespaceAuthorizationChangeNotificationEvent which is always the case since" +
            " we manage the event type to a builder in a map defined in NotificationMessageManager")
    public Map<String, Object> getNotificationMessageVelocityContextMap(NotificationEvent notificationEvent)
    {
        UserNamespaceAuthorizationChangeNotificationEvent event = (UserNamespaceAuthorizationChangeNotificationEvent) notificationEvent;

        Map<String, Object> velocityContextMap = new HashMap<>();

        addObjectPropertyToContext(velocityContextMap, "userNamespaceAuthorizationKey", event.getUserNamespaceAuthorizationKey(),
            new UserNamespaceAuthorizationKey(escapeJson(event.getUserNamespaceAuthorizationKey().getUserId()),
                escapeJson(event.getUserNamespaceAuthorizationKey().getNamespace())),
            new UserNamespaceAuthorizationKey(escapeXml(event.getUserNamespaceAuthorizationKey().getUserId()),
                escapeXml(event.getUserNamespaceAuthorizationKey().getNamespace())));

        // Add the namespace Velocity property for the header.
        addStringPropertyToContext(velocityContextMap, "namespace", event.getUserNamespaceAuthorizationKey().getNamespace());

        return velocityContextMap;
    }

}