* @throws RegistryException if the operation failed.
*/
public void deleteNode(ResourceIDImpl resourceID,
ResourceDO resourceDO,
boolean keepAuthorization) throws RegistryException {
ResourceImpl resourceImpl;
if (resourceID.isCollection()) {
resourceImpl = new CollectionImpl(resourceID.getPath(), resourceDO);
} else {
resourceImpl = new ResourceImpl(resourceID.getPath(), resourceDO);
}
// now do the versioning as delete is considered as a change, where
// non-collections are versioned automatically unless it is configured otherwise
if (!(resourceImpl instanceof CollectionImpl) && this.versionOnChange &&
resourceImpl.isVersionableChange()) {
// we are creating snapshot without renewing old contents..
versionRepository.createSnapshot(resourceImpl, false, true);
// Just delete the associations along with the path.
associationDAO.removeAllAssociations(resourceImpl.getPath());
} else {
// just delete the resource and content
// delete the old entry from the resource table
boolean isResourcePathVersioned = resourceVersionDAO.isResourceHistoryExist(
resourceImpl.getResourceIDImpl());
removeResource(resourceImpl, isResourcePathVersioned);
if (!StaticConfiguration.isVersioningComments() && !isResourcePathVersioned) {
commentsDAO.removeComments(resourceImpl);
}
if (!StaticConfiguration.isVersioningTags() && !isResourcePathVersioned) {
tagsDAO.removeTags(resourceImpl);
}
if (!StaticConfiguration.isVersioningRatings() && !isResourcePathVersioned) {
ratingsDAO.removeRatings(resourceImpl);
}
// Just delete the associations along with the path.
Association[] associations = associationDAO.getAllAssociations(resourceImpl.getPath());
if (associations != null && associations.length > 0) {
associationDAO.removeAllAssociations(resourceImpl.getPath());
}
if (!keepAuthorization && !isResourcePathVersioned) {
// for an empty root, we are not clearing the authorization..