// archiving the old root resource
createVersionForResource(resourceImpl, isRenewing, keepProperties);
long version = resourceImpl.getVersionNumber();
boolean isCollection = resourceImpl instanceof CollectionImpl;
ResourceIDImpl rootResourceID = resourceImpl.getResourceIDImpl();
ArrayList<Long> versionList = new ArrayList<Long>();
versionList.add(version);
if (isCollection) {
// for collection we have to iterate through children
addDescendants(rootResourceID, versionList, isRenewing, keepProperties);
}
// wrap the array list into stream
InputStream versionsInputStream = new VersionInputStream(versionList);
int pathId = rootResourceID.getPathID();
String resourceName = rootResourceID.getName();
long snapshotID =
resourceVersionDAO.createSnapshot(pathId, resourceName, versionsInputStream);
// Associations can be created only once we have created the snapshot, since we need to know
// the snapshotID.
if (snapshotID != -1) {