@Override
    public void execute(@Nonnull SessionData sessionData, Element command) {
        final Locale preferredLocale = SessionManager.getInstance().getLocaleForSession(sessionData.getOwner());

        Element note = command.addElement("note");

        Map<String, List<String>> data = sessionData.getData();

        // Get the username
        String username;
        try {
            username = get(data, "username", 0);
        }
        catch (NullPointerException npe) {
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.event.usermodified.note.username-required", preferredLocale));
            return;
        }

        // Get the modification type
        String type;
        try {
            type = get(data, "changeType", 0);
        }
        catch (NullPointerException npe) {
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.event.usermodified.note.changetype-required", preferredLocale));
            return;
        }

        // Identifies the value variable
        String valueVariable = null;
        String valueVariableName = null;

        if ("nameModified".equals(type) || "emailModified".equals(type) ||
                "creationDateModified".equals(type) || "modificationDateModified".equals(type)) {

            valueVariable = "originalValue";
            valueVariableName = LocaleUtils.getLocalizedString("commands.event.usermodified.form.field.originalvalue.label", preferredLocale);

        } else if ("propertyModified".equals(type) || "propertyAdded".equals(type) ||
                "propertyDeleted".equals(type)) {

            valueVariable = "propertyKey";
            valueVariableName = LocaleUtils.getLocalizedString("commands.event.usermodified.form.field.propertykey.label", preferredLocale);

        }

        // Creates event params.
        Map<String, Object> params = new HashMap<>();

        // Gets the value of the change if it exists
        String value;
        if (valueVariable != null) {
            try {
                // Gets the value
                value = get(data, valueVariable, 0);
                // Adds it to the event params
                params.put(valueVariable, value);

            } catch (NullPointerException npe) {
                note.addAttribute("type", "error");
                note.setText(LocaleUtils.getLocalizedString("commands.event.usermodified.note.wildcard-required", List.of(valueVariableName), preferredLocale)
                );
                return;
            }
        }

        // Adds the type of change
        params.put("type", type);

        // Sends the event
        User user;
        try {
            // Loads the updated user
            user = UserManager.getUserProvider().loadUser(username);

            // Fire event.
            UserEventDispatcher.dispatchEvent(user, UserEventDispatcher.EventType.user_modified,
                    params);

        } catch (UserNotFoundException e) {
            note.addAttribute("type", "error");
            note.setText(LocaleUtils.getLocalizedString("commands.event.usermodified.note.user-does-not-exist", preferredLocale));
            return;
        }

        // Answer that the operation was successful
        note.addAttribute("type", "info");
        note.setText(LocaleUtils.getLocalizedString("commands.global.operation.finished.success", preferredLocale));
    }
Notifies the that a user was modified. It can be used by user providers to notify Openfire of the
modification of a user.

@author Gabriel Guarincerri
xmppserver/src/main/java/org/jivesoftware/openfire/commands/event/UserModified.java