List compareVs = new ArrayList();
getVersions(compareBaseline.getBaselineCollection(), compareVs);
VersionResource[] rArr = (VersionResource[]) requestVs.toArray(new VersionResource[requestVs.size()]);
for (int i = 0; i < rArr.length; i++) {
VersionResource requestV = rArr[i];
if (!compareVs.remove(requestV)) {
// check if another version of the same vh is present (change)
VersionResource changedV = findChangedVersion(requestV, compareVs);
if (changedV != null) {
// found a 'changed-version' entry
Element cv = DomUtil.addChildElement(el, XML_CHANGED_VERSION, DeltaVConstants.NAMESPACE);
cv.appendChild(DomUtil.hrefToXml(requestV.getHref(), document));
cv.appendChild(DomUtil.hrefToXml(changedV.getHref(), document));
} else {
// no corresponding version => 'deleted-version'
Element cv = DomUtil.addChildElement(el, XML_DELETED_VERSION, DeltaVConstants.NAMESPACE);
cv.appendChild(DomUtil.hrefToXml(requestV.getHref(), document));
}
} // else: both baseline contain a vc-resource with the same checked-in version
}
// all remaining versions from the 'compare-baseline' can be considered
// to be added-versions.
Iterator it = compareVs.iterator();
while (it.hasNext()) {
VersionResource addedV = (VersionResource) it.next();
Element cv = DomUtil.addChildElement(el, XML_ADDED_VERSION, DeltaVConstants.NAMESPACE);
cv.appendChild(DomUtil.hrefToXml(addedV.getHref(), document));
}
} catch (DavException e) {
log.error("Internal error while building report", e);
}
return el;