diff --git a/pom.xml b/pom.xml index f97319c..57be10f 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ 4.0.0 org.echocat adam - 0.1.10 + 0.1.11 echocat Adam atlassian-plugin @@ -36,13 +36,13 @@ 1.5.0 - 3.18.1-GA - 1.7.5 - 2.5.1 - 5.9.5 - 5.9.5 - 6.2.2 - 1.1.1 + 3.20.0-GA + 1.7.21 + 2.6.4 + 5.10.7 + 5.10.7 + 6.2.8 + 1.2.3 UTF-8 UTF-8 diff --git a/src/main/java/org/echocat/adam/configuration/ConfigurationMarshaller.java b/src/main/java/org/echocat/adam/configuration/ConfigurationMarshaller.java index 8c244c4..19b52f8 100644 --- a/src/main/java/org/echocat/adam/configuration/ConfigurationMarshaller.java +++ b/src/main/java/org/echocat/adam/configuration/ConfigurationMarshaller.java @@ -1,7 +1,7 @@ /***************************************************************************************** * *** BEGIN LICENSE BLOCK ***** * - * echocat Adam, Copyright (c) 2014 echocat + * 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 @@ -52,7 +52,7 @@ import static org.eclipse.persistence.jaxb.MarshallerProperties.INDENT_STRING; import static org.eclipse.persistence.jaxb.MarshallerProperties.NAMESPACE_PREFIX_MAPPER; -public class ConfigurationMarshaller { +public final class ConfigurationMarshaller { private static final JAXBContext JAXB_CONTEXT; private static final ConfigurationNamespacePrefixMapper NAMESPACE_PREFIX_MAPPER_INSTANCE = new ConfigurationNamespacePrefixMapper(); @@ -87,7 +87,7 @@ public class ConfigurationMarshaller { } } - @Nonnull + @Nullable public static Configuration unmarshall(@Nonnull Reader content) { return unmarshall(content, null); } @@ -137,13 +137,13 @@ public static Configuration unmarshall(@Nullable String content, @Nullable Strin } @Nonnull - protected static Unmarshaller unmarshallerFor(@Nonnull Object element, @Nullable String systemId) { + private static Unmarshaller unmarshallerFor(@Nonnull Object element, @Nullable String systemId) { final Unmarshaller unmarshaller; try { unmarshaller = JAXB_CONTEXT.createUnmarshaller(); unmarshaller.setSchema(SCHEMA); } catch (final JAXBException e) { - throw new ConfigurationException("Could not create unmarshaller to unmarshall " + systemId != null ? systemId : element.toString() + ".", e); + throw new ConfigurationException("Could not create unmarshaller to unmarshall " + (systemId != null ? systemId : element.toString()) + ".", e); } return unmarshaller; } diff --git a/src/main/java/org/echocat/adam/configuration/template/Template.java b/src/main/java/org/echocat/adam/configuration/template/Template.java index bd5e99c..71c5241 100644 --- a/src/main/java/org/echocat/adam/configuration/template/Template.java +++ b/src/main/java/org/echocat/adam/configuration/template/Template.java @@ -1,7 +1,7 @@ /***************************************************************************************** * *** BEGIN LICENSE BLOCK ***** * - * echocat Adam, Copyright (c) 2014 echocat + * 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 @@ -23,6 +23,7 @@ import org.echocat.adam.template.TemplateFormat; import org.echocat.adam.template.TemplateSupport; +import org.eclipse.persistence.oxm.annotations.XmlValueExtension; import javax.annotation.Nonnull; import javax.xml.bind.annotation.XmlAttribute; @@ -47,6 +48,7 @@ public String getSource() { } @XmlValue + @XmlValueExtension public void setSource(@Nonnull String source) { _source = source; } diff --git a/src/main/java/org/echocat/adam/profile/Profile.java b/src/main/java/org/echocat/adam/profile/Profile.java index bd50be8..905f8e6 100644 --- a/src/main/java/org/echocat/adam/profile/Profile.java +++ b/src/main/java/org/echocat/adam/profile/Profile.java @@ -1,7 +1,7 @@ /***************************************************************************************** * *** BEGIN LICENSE BLOCK ***** * - * echocat Adam, Copyright (c) 2014 echocat + * 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 @@ -29,6 +29,8 @@ import com.atlassian.confluence.user.UserDetailsManager; import com.atlassian.user.User; import org.echocat.adam.profile.element.ElementModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -39,6 +41,8 @@ public class Profile implements User { + private static final Logger LOG = LoggerFactory.getLogger(Profile.class); + @Nonnull private final UserAccessor _userAccessor; @Nonnull @@ -77,17 +81,25 @@ public void reIndex() { } public void setValue(@Nonnull ElementModel of, @Nullable String to) { - final String id = of.getId(); - if (ElementModel.FULL_NAME_ELEMENT_ID.equals(id)) { - _fullName = to; - _userAccessor.saveUser(this); - } else if (ElementModel.EMAIL_ELEMENT_ID.equals(id)) { - _email = to; - _userAccessor.saveUser(this); - } else if (ElementModel.PERSONAL_INFORMATION_ELEMENT_ID.equals(id)) { - setPersonalInformationBody(to); - } else { - setStandardValue(of, to); + try { + final String id = of.getId(); + if (ElementModel.FULL_NAME_ELEMENT_ID.equals(id)) { + _fullName = to; + _userAccessor.saveUser(this); + } else if (ElementModel.EMAIL_ELEMENT_ID.equals(id)) { + _email = to; + _userAccessor.saveUser(this); + } else if (ElementModel.PERSONAL_INFORMATION_ELEMENT_ID.equals(id)) { + setPersonalInformationBody(to); + } else { + setStandardValue(of, to); + } + } catch (final NullPointerException e) { + if (("Unable to find user mapping for " + getName()).equals(e.getMessage())) { + LOG.warn("Could not modify " + getName() + ". If this is caused by a rename of a user you can safely ignore this message."); + } else { + throw e; + } } } @@ -125,7 +137,7 @@ protected void setPersonalInformationBody(@Nullable String to) { protected String getPersonalInformationBody() { // noinspection deprecation final PersonalInformation information = _personalInformationManager.getPersonalInformation(this); - final String body = information != null ? information.getBodyAsString() : null; + final String body = information.getBodyAsString(); return body == null || isEmpty(body.trim()) ? null : body; } diff --git a/src/main/resources/org/echocat/adam/convoyed/editmyprofile.vm b/src/main/resources/org/echocat/adam/convoyed/editmyprofile.vm index 2a93a3f..4bb22ef 100644 --- a/src/main/resources/org/echocat/adam/convoyed/editmyprofile.vm +++ b/src/main/resources/org/echocat/adam/convoyed/editmyprofile.vm @@ -1,9 +1,9 @@ - + $generalUtil.htmlEncode($pageTitle) #requireResource("confluence.web.resources:aui-forms") #requireResource("confluence.userstatus:userstatus-resources") - + #applyDecorator("root") #decoratorParam("context" "profile") @@ -41,4 +41,4 @@ #end ## applyDecorator root - \ No newline at end of file + diff --git a/src/main/resources/org/echocat/adam/profile/EditUserProfileWebPanel.vm b/src/main/resources/org/echocat/adam/profile/EditUserProfileWebPanel.vm index cd19a59..c4ba866 100644 --- a/src/main/resources/org/echocat/adam/profile/EditUserProfileWebPanel.vm +++ b/src/main/resources/org/echocat/adam/profile/EditUserProfileWebPanel.vm @@ -1,5 +1,11 @@ +#* @vtlvariable name="currentUser" type="com.atlassian.user.User" *# +#* @vtlvariable name="user" type="com.atlassian.user.User" *# +#* @vtlvariable name="profile" type="org.echocat.adam.profile.Profile" *# #* @vtlvariable name="groups" type="java.util.List" *# +#* @vtlvariable name="elementRenderer" type="org.echocat.adam.profile.element.ElementRenderer" *# #* @vtlvariable name="groupRenderer" type="org.echocat.adam.profile.GroupRenderer" *# +#* @vtlvariable name="localizationHelper" type="org.echocat.adam.localization.LocalizationHelper" *# +#* @vtlvariable name="locale" type="java.util.Locale" *# #requireResource("org.echocat.adam:userProfileResources")
@@ -15,13 +21,13 @@ #set($title = $!localizationHelper.getTitleFor($elementModel, $locale)) #set($helpText = $!localizationHelper.findHelpTextFor($elementModel, $locale)) #set($nodeId = $!elementRenderer.nodeIdFor($elementModel, $profile)) - #if($elementModel.id == "email" and $elementRenderer.isRenderOfEidAllowedFor($elementModel, $currentUser, $profile)) + #if($elementModel.id == "email" and $elementRenderer.isRenderOfEditAllowedFor($elementModel, $currentUser, $profile)) #end