// Path: src/main/java/org/echocat/adam/profile/element/ElementModel.java
// public interface ElementModel extends Localized {
// 
//     @Nonnull
//     public static final String PERSONAL_INFORMATION_ELEMENT_ID = "personalInformation";
//     @Nonnull
//     public static final String FULL_NAME_ELEMENT_ID = "fullName";
//     @Nonnull
//     public static final String USER_NAME_ELEMENT_ID = "username";
//     @Nonnull
//     public static final String EMAIL_ELEMENT_ID = "email";
//     @Nonnull
//     public static final String WEBSITE_ELEMENT_ID = "website";
//     @Nonnull
//     public static final String PHONE_ELEMENT_ID = "phone";
// 
//     public boolean isStandard();
// 
//     public boolean isDefaultForReports();
// 
//     @Nullable
//     public List<String> getContextAttributeKeys();
// 
//     public boolean isSearchable();
// 
//     public boolean isVisibleIfEmpty();
// 
//     @Nonnull
//     public ViewEditAccess getAccess();
// 
//     @Nonnull
//     public Type getType();
// 
//     @Nullable
//     public Template getTemplate();
// 
//     public static enum Type {
//         singleLineText,
//         multiLineText,
//         emailAddress,
//         url,
//         phoneNumber,
//         wikiMarkup,
//         html
//     }
// 
// }
// 
// Path: src/main/java/org/echocat/adam/profile/ProfileModelProvider.java
// @Nonnull
// public static ProfileModelProvider profileModelProvider() {
//     final ProfileModelProvider result = c_instance;
//     if (result == null) {
//         throw new IllegalStateException("There is currently no instance registered.");
//     }
//     return result;
// }
// 
// Path: src/main/java/org/echocat/adam/profile/ProfileProvider.java
// @Nonnull
// public static ProfileProvider profileProvider() {
//     final ProfileProvider result = c_instance;
//     if (result == null) {
//         throw new IllegalStateException("There is currently no instance registered.");
//     }
//     return result;
// }
// 
// Path: src/main/java/org/echocat/adam/profile/element/ElementModel.java
// public interface ElementModel extends Localized {
// 
//     @Nonnull
//     public static final String PERSONAL_INFORMATION_ELEMENT_ID = "personalInformation";
//     @Nonnull
//     public static final String FULL_NAME_ELEMENT_ID = "fullName";
//     @Nonnull
//     public static final String USER_NAME_ELEMENT_ID = "username";
//     @Nonnull
//     public static final String EMAIL_ELEMENT_ID = "email";
//     @Nonnull
//     public static final String WEBSITE_ELEMENT_ID = "website";
//     @Nonnull
//     public static final String PHONE_ELEMENT_ID = "phone";
// 
//     public boolean isStandard();
// 
//     public boolean isDefaultForReports();
// 
//     @Nullable
//     public List<String> getContextAttributeKeys();
// 
//     public boolean isSearchable();
// 
//     public boolean isVisibleIfEmpty();
// 
//     @Nonnull
//     public ViewEditAccess getAccess();
// 
//     @Nonnull
//     public Type getType();
// 
//     @Nullable
//     public Template getTemplate();
// 
//     public static enum Type {
//         singleLineText,
//         multiLineText,
//         emailAddress,
//         url,
//         phoneNumber,
//         wikiMarkup,
//         html
//     }
// 
// }


import static org.echocat.adam.profile.ProfileModelProvider.profileModelProvider;
import static org.echocat.adam.profile.ProfileProvider.profileProvider;
import static org.echocat.adam.profile.element.ElementModel.*;
import com.atlassian.confluence.user.AuthenticatedUserThreadLocal;
import com.atlassian.confluence.user.ConfluenceUser;
import com.atlassian.confluence.user.actions.EditUserAction;
import org.echocat.adam.profile.element.ElementModel;
import javax.annotation.Nonnull;
import java.util.Map;
import static org.apache.commons.lang3.StringUtils.join;
/*****************************************************************************************
 * *** BEGIN LICENSE BLOCK *****
 *
 * echocat Adam, Copyright (c) 2014-2016 echocat
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3.0 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.
 *
 * *** END LICENSE BLOCK *****
 ****************************************************************************************/

package org.echocat.adam.profile;




public class ExtendedEditUserAction extends EditUserAction {

    private Map<String, String[]> _parameters;

    @Override
    public String doEdit() throws Exception {
        final String result = super.doEdit();
        final ConfluenceUser user = getUser();
        final Profile profile = user != null ? profileProvider().provideFor(user) : null;
// Path: src/main/java/org/echocat/adam/profile/element/ElementModel.java
// public interface ElementModel extends Localized {
// 
//     @Nonnull
//     public static final String PERSONAL_INFORMATION_ELEMENT_ID = "personalInformation";
//     @Nonnull
//     public static final String FULL_NAME_ELEMENT_ID = "fullName";
//     @Nonnull
//     public static final String USER_NAME_ELEMENT_ID = "username";
//     @Nonnull
//     public static final String EMAIL_ELEMENT_ID = "email";
//     @Nonnull
//     public static final String WEBSITE_ELEMENT_ID = "website";
//     @Nonnull
//     public static final String PHONE_ELEMENT_ID = "phone";
// 
//     public boolean isStandard();
// 
//     public boolean isDefaultForReports();
// 
//     @Nullable
//     public List<String> getContextAttributeKeys();
// 
//     public boolean isSearchable();
// 
//     public boolean isVisibleIfEmpty();
// 
//     @Nonnull
//     public ViewEditAccess getAccess();
// 
//     @Nonnull
//     public Type getType();
// 
//     @Nullable
//     public Template getTemplate();
// 
//     public static enum Type {
//         singleLineText,
//         multiLineText,
//         emailAddress,
//         url,
//         phoneNumber,
//         wikiMarkup,
//         html
//     }
// 
// }
// 
// Path: src/main/java/org/echocat/adam/profile/ProfileModelProvider.java
// @Nonnull
// public static ProfileModelProvider profileModelProvider() {
//     final ProfileModelProvider result = c_instance;
//     if (result == null) {
//         throw new IllegalStateException("There is currently no instance registered.");
//     }
//     return result;
// }
// 
// Path: src/main/java/org/echocat/adam/profile/ProfileProvider.java
// @Nonnull
// public static ProfileProvider profileProvider() {
//     final ProfileProvider result = c_instance;
//     if (result == null) {
//         throw new IllegalStateException("There is currently no instance registered.");
//     }
//     return result;
// }
// 
// Path: src/main/java/org/echocat/adam/profile/element/ElementModel.java
// public interface ElementModel extends Localized {
// 
//     @Nonnull
//     public static final String PERSONAL_INFORMATION_ELEMENT_ID = "personalInformation";
//     @Nonnull
//     public static final String FULL_NAME_ELEMENT_ID = "fullName";
//     @Nonnull
//     public static final String USER_NAME_ELEMENT_ID = "username";
//     @Nonnull
//     public static final String EMAIL_ELEMENT_ID = "email";
//     @Nonnull
//     public static final String WEBSITE_ELEMENT_ID = "website";
//     @Nonnull
//     public static final String PHONE_ELEMENT_ID = "phone";
// 
//     public boolean isStandard();
// 
//     public boolean isDefaultForReports();
// 
//     @Nullable
//     public List<String> getContextAttributeKeys();
// 
//     public boolean isSearchable();
// 
//     public boolean isVisibleIfEmpty();
// 
//     @Nonnull
//     public ViewEditAccess getAccess();
// 
//     @Nonnull
//     public Type getType();
// 
//     @Nullable
//     public Template getTemplate();
// 
//     public static enum Type {
//         singleLineText,
//         multiLineText,
//         emailAddress,
//         url,
//         phoneNumber,
//         wikiMarkup,
//         html
//     }
// 
// }


// Path: src/main/java/org/echocat/adam/profile/ExtendedEditUserAction.java
import static org.echocat.adam.profile.ProfileModelProvider.profileModelProvider;
import static org.echocat.adam.profile.ProfileProvider.profileProvider;
import static org.echocat.adam.profile.element.ElementModel.*;
import com.atlassian.confluence.user.AuthenticatedUserThreadLocal;
import com.atlassian.confluence.user.ConfluenceUser;
import com.atlassian.confluence.user.actions.EditUserAction;
import org.echocat.adam.profile.element.ElementModel;
import javax.annotation.Nonnull;
import java.util.Map;
import static org.apache.commons.lang3.StringUtils.join;

/*****************************************************************************************
 * *** BEGIN LICENSE BLOCK *****
 *
 * echocat Adam, Copyright (c) 2014-2016 echocat
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3.0 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.
 *
 * *** END LICENSE BLOCK *****
 ****************************************************************************************/

package org.echocat.adam.profile;




public class ExtendedEditUserAction extends EditUserAction {

    private Map<String, String[]> _parameters;

    @Override
    public String doEdit() throws Exception {
        final String result = super.doEdit();
        final ConfluenceUser user = getUser();
        final Profile profile = user != null ? profileProvider().provideFor(user) : null;
        if (profile != null && "success".equals(result)) {