Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public class ConfluenceMigrationJobStatus extends DefaultJobStatus<ConfluenceMig

private Collection<String> spaces = Collections.emptyList();

private Map<String, String> spaceTargets = Map.of();

/**
* @param request the request provided when started the job
* @param parentJobStatus the status of the parent job
Expand Down Expand Up @@ -105,6 +107,27 @@ public Collection<String> getSpaces()
return spaces;
}

/**
* Set the map of spaces that were renamed during the Migration.
* @param spaceTargets the map of spaces that were renamed
* @since 1.36.0
*/
public void setSpaceTargets(Map<String, String> spaceTargets)
{
this.spaceTargets = spaceTargets;
}

/**
* Get the map of spaces that were renamed during the Migration.
*
* @return a map where the key is the original space name and the value is the current renamed space name
* @since 1.36.0
*/
public Map<String, String> getSpaceTargets()
{
return spaceTargets;
}

@Override
public void cancel()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public void onEvent(Event event, Object source, Object data)

ConfluenceFilteringEvent ev = (ConfluenceFilteringEvent) event;
Collection<String> spaces = new ArrayList<>(confluencePackage.getSpaceKeys(false));

status.setSpaceTargets(ev.getSpaceTargets());

for (Long spaceId : ev.getDisabledSpaces()) {
try {
spaces.remove(confluencePackage.getSpaceKey(spaceId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ Map<String, Map<String, Integer>> analyseLogs(ConfluenceMigrationJobStatus jobSt

addAttachment("missingUsersGroups.json", getPermissionIssues(root, docs), document);
addAttachment("collisions.json", collisions, document);
addAttachment("spaceTargets.json", jobStatus.getSpaceTargets(), document);
addAttachment("macroPages.json", macroPages, document);
addAttachment("docs.json", docs, document);
object.setLongValue("imported", counts.docCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,15 @@
#set ($space[$docRef.getName()] = $docRef)
#end

#macro (printDocTree $tree)
#macro (displayRenaming $name $spaceTargets)
#set ($nameEscaped = $escapetool.xml($name))
#set ($spaceTarget = $spaceTargets.get($name))
#if(!$name.equals($spaceTarget))
$services.localization.render('confluencepro.migration.raport.renamingSpace', $escapetool.xml($spaceTarget))
#end
#end

#macro (printDocTree $tree $spaceTargets $isRoot)
&lt;ul&gt;
#foreach ($name in $tree.keySet())
#if ($name != "WebHome")
Expand All @@ -305,17 +313,17 @@
#if ("$!child.getName()" != "")
&lt;li class="cfm-doc-tree-leaf"&gt;&lt;a href="$xwiki.getURL($child)"&gt;$nameEscaped&lt;/a&gt;&lt;/li&gt;
#elseif ($child.containsKey("WebHome") &amp;&amp; $child.size() == 1)
&lt;li class="cfm-doc-tree-leaf"&gt;&lt;a href="$xwiki.getURL($child["WebHome"])"&gt;$nameEscaped&lt;/a&gt;&lt;/li&gt;
&lt;li class="cfm-doc-tree-leaf"&gt;&lt;a href="$xwiki.getURL($child["WebHome"])"&gt;$nameEscaped&lt;/a&gt;#if($isRoot)#displayRenaming($name, $spaceTargets)#end&lt;/li&gt;
#else
&lt;li&gt;&lt;details&gt;
&lt;summary&gt;##
#if ($child.containsKey("WebHome"))
&lt;a href="$xwiki.getURL($child["WebHome"])"&gt;$nameEscaped&lt;/a&gt;
#else
$nameEscaped
$nameEscaped#if($isRoot)#displayRenaming($name, $spaceTargets)#end
#end##
&lt;/summary&gt;
#printDocTree($child)
#printDocTree($child $spaceTargets, false)
&lt;/details&gt;&lt;/li&gt;
#end
#end
Expand Down Expand Up @@ -354,6 +362,7 @@
#set ($inputProperties = $jsontool.fromString($obj.getProperty('inputProperties').value))
#computeRootSpace
#set ($docsAttachment = $doc.getAttachment('docs.json'))
#set ($spaceTargetsAttachment = $doc.getAttachment('spaceTargets.json'))
#if ($objecttool.isNull($docsAttachment))
{{html wiki=true clean=false}}
&lt;ul class="imported-spaces"&gt;
Expand Down Expand Up @@ -381,12 +390,17 @@
#else
{{html clean=false}}
#set ($docTree = {})
#set ($spaceTargets = $jsontool.fromString($spaceTargetsAttachment.getContentAsString()))
#set ($invertedSpaceTargets = {})
#foreach ($entry in $spaceTargets.entrySet())
#set ($discard = $invertedSpaceTargets.put($entry.getValue(), $entry.getKey()))
#end
#foreach ($docRefStr in $jsontool.fromString($docsAttachment.getContentAsString()))
#set($docRef = $services.model.resolveDocument($docRefStr))
#addDocToDocTree($docTree, $docRef)
#end
&lt;div id="cfm-doc-tree"&gt;
#printDocTree($docTree)
#printDocTree($docTree, $invertedSpaceTargets, true)
&lt;/div&gt;
{{/html}}
#end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ confluencepro.migration.raport.problems.unhandledParameters.title=There are {0}
confluencepro.migration.raport.problems.unhandledParameters.info=Unhandled parameter warnings:
confluencepro.migration.raport.problems.unhandledParameterValues.info=Unhandled parameter values warnings:
confluencepro.migration.raport.problems.unhandledParameters.list=The unhandled parameter (values), per macro
confluencepro.migration.raport.renamingSpace=(original space key: {0})
confluencepro.migration.raport.macroName=Macro
confluencepro.migration.raport.parameterName=Parameter
confluencepro.migration.raport.parameterValues=Value(s)
Expand Down