%{XML2ATTR,PREFIX=xml,KEY=%(custom.key):%(custom.variable):}
%{SCRIPT:groovy:
def pkg = $attributes.xml.best4Automic.vcs.difference.package
def srcType = $attributes.xml.best4Automic.vcs.difference.source.type
def srcName = $attributes.xml.best4Automic.vcs.difference.source.name
def destType = $attributes.xml.best4Automic.vcs.difference.destination.type
def destName = $attributes.xml.best4Automic.vcs.difference.destination.name
$output.append( """\
<h1>Summary</h1>
<table>
<tr><td>Package</td><td style="colspan:2">$pkg</td></tr>
<tr><td>Source</td><td>$srcType</td><td>$srcName</td></tr>
<tr><td>Destination</td><td>$destType</td><td>$destName</td></tr>
</table>
""" )
def added = $attributes.xml.best4Automic.vcs.difference.status.added.number
def removed = $attributes.xml.best4Automic.vcs.difference.status.removed.number
def changed = $attributes.xml.best4Automic.vcs.difference.status.changed.number
$output.append( """\
<h1>Status</h1>
<table><tr><th>Status</th><th>Count</th></tr>
<tr><td>Added</td><td>$added</td></tr>
<tr><td>Removed</td><td>$removed</td></tr>
<tr><td>Changed</td><td>$changed</td></tr>
</table>
""" )
$output.append( "<h1>Differences</h1>" )
if ( $attributes.xml.best4Automic.vcs.difference.details.added ) {
$output.append( """\
<h2>Added Objects</h2>
<table><tr><th>Object Name</th></tr>
""" )
def items = $attributes.xml.best4Automic.vcs.difference.details.added.item
if ( items instanceof List ) {
for ( item : items ) {
$output.append( "<tr><td>$item.name</td></tr>" )
}
} else {
$output.append( "<tr><td>$items.name</td></tr>" )
}
$output.append( "</table>" )
}
if ( $attributes.xml.best4Automic.vcs.difference.details.removed ) {
$output.append( """\
<h2>Removed Objects</h2>
<table><tr><th>Object Name</th></tr>
""" )
def items = $attributes.xml.best4Automic.vcs.difference.details.removed.item
if ( items instanceof List ) {
for ( item : items ) {
$output.append( "<tr><td>$item.name</td></tr>" )
}
} else {
$output.append( "<tr><td>$items.name</td></tr>" )
}
$output.append( "</table>" )
}
if ( $attributes.xml.best4Automic.vcs.difference.details.changed ) {
$output.append( """\
<h2>Changed Objects</h2>
""" )
def items = $attributes.xml.best4Automic.vcs.difference.details.changed.item
if ( items instanceof List ) {
for ( item : items ) {
$output.append( """\
<h3>$item.name</h3>
<pre>${item.content.replace( "&", "&" ).replace("<", "<").replace( ">", ">" ) }</pre>""" )
}
} else {
$output.append( """\
<h3>$items.name</h3>
<pre>${items.content.replace( "&", "&" ).replace("<", "<").replace( ">", ">" ) }</pre>""" )
}
}
}