Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Commit

Permalink
#61 Upgrade API to confluence 5.10.7
Browse files Browse the repository at this point in the history
  • Loading branch information
blaubaer committed Oct 6, 2016
1 parent 26e80b3 commit 1303119
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 32 deletions.
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.echocat</groupId>
<artifactId>adam</artifactId>
<version>0.1.10</version>
<version>0.1.11</version>
<name>echocat Adam</name>
<packaging>atlassian-plugin</packaging>

Expand All @@ -36,13 +36,13 @@

<properties>
<version.org.echocat.jomon>1.5.0</version.org.echocat.jomon>
<version.org.javassist>3.18.1-GA</version.org.javassist>
<version.org.slf4j>1.7.5</version.org.slf4j>
<version.org.eclipse.persistence>2.5.1</version.org.eclipse.persistence>
<version.com.atlassian.confluence>5.9.5</version.com.atlassian.confluence>
<version.com.atlassian.confluence.data>5.9.5</version.com.atlassian.confluence.data>
<version.com.atlassian.maven.plugins.amps>6.2.2</version.com.atlassian.maven.plugins.amps>
<version.com.atlassian.plugins.testrunner>1.1.1</version.com.atlassian.plugins.testrunner>
<version.org.javassist>3.20.0-GA</version.org.javassist>
<version.org.slf4j>1.7.21</version.org.slf4j>
<version.org.eclipse.persistence>2.6.4</version.org.eclipse.persistence>
<version.com.atlassian.confluence>5.10.7</version.com.atlassian.confluence>
<version.com.atlassian.confluence.data>5.10.7</version.com.atlassian.confluence.data>
<version.com.atlassian.maven.plugins.amps>6.2.8</version.com.atlassian.maven.plugins.amps>
<version.com.atlassian.plugins.testrunner>1.2.3</version.com.atlassian.plugins.testrunner>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -87,7 +87,7 @@ public class ConfigurationMarshaller {
}
}

@Nonnull
@Nullable
public static Configuration unmarshall(@Nonnull Reader content) {
return unmarshall(content, null);
}
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -47,6 +48,7 @@ public String getSource() {
}

@XmlValue
@XmlValueExtension
public void setSource(@Nonnull String source) {
_source = source;
}
Expand Down
38 changes: 25 additions & 13 deletions src/main/java/org/echocat/adam/profile/Profile.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -39,6 +41,8 @@

public class Profile implements User {

private static final Logger LOG = LoggerFactory.getLogger(Profile.class);

@Nonnull
private final UserAccessor _userAccessor;
@Nonnull
Expand Down Expand Up @@ -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;
}
}
}

Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/org/echocat/adam/convoyed/editmyprofile.vm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<html>
<head>
<head>
<title>$generalUtil.htmlEncode($pageTitle)</title>
#requireResource("confluence.web.resources:aui-forms")
#requireResource("confluence.userstatus:userstatus-resources")
</head>
</head>

#applyDecorator("root")
#decoratorParam("context" "profile")
Expand Down Expand Up @@ -41,4 +41,4 @@
</div>
</body>
#end ## applyDecorator root
</html>
</html>
Original file line number Diff line number Diff line change
@@ -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<org.echocat.adam.profile.Group>" *#
#* @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")
<div class="adam-profile-body">

Expand All @@ -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))
<input type="hidden" id="originalemail" value="$!{user.email}"/>
<input type="hidden" id="passwordconfirmation" value="" name="passwordconfirmation"/>
#end
<div class="profile-element field-group editMode">
<label id="labelFor-${nodeId}" for="${nodeId}">${elementRenderer.plainToXhtml($elementModel, $title)}
#if(($elementModel.id == "fullName" or $elementModel.id == "email") and $elementRenderer.isRenderOfEidAllowedFor($elementModel, $currentUser, $profile))
#if(($elementModel.id == "fullName" or $elementModel.id == "email") and $elementRenderer.isRenderOfEditAllowedFor($elementModel, $currentUser, $profile))
<span class="aui-icon icon-required"></span>
<span class="content">$i18n.get("required.field")</span>
#end
Expand Down

0 comments on commit 1303119

Please sign in to comment.