class ObjectNameTitleFormatter implements CustomTitleFormatter {

    @Override
    public String format(Notification notification)
    {
        String parentObjectType = notification.getRelatedObjectType() != null ? notification.getRelatedObjectType()
                : notification.getParentType();
        Long parentObjectId = notification.getRelatedObjectId() != null ? notification.getRelatedObjectId() : notification.getParentId();
        String title = notification.getTitle();

        if (title != null)
        {
            String objectTitle = getNotificationUtils().getNotificationParentOrRelatedObjectNumber(parentObjectType,
                    parentObjectId);

            title = replacePlaceholder(objectTitle, title, NotificationConstants.NAME_LABEL);

        }
        return title;
    }

}