Resource tags: CS-15591 - delete tags for template/iso when corresponding vo object is removed

This commit is contained in:
Alena Prokharchyk 2012-07-16 14:36:13 -07:00
parent 8a3a788d72
commit 097c260690
1 changed files with 4 additions and 2 deletions

View File

@ -860,8 +860,10 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
txn.start();
VMTemplateVO template = createForUpdate();
template.setRemoved(new Date());
if (template != null) {
if (template.getFormat() == ImageFormat.ISO) {
VMTemplateVO vo = findById(id);
if (vo != null) {
if (vo.getFormat() == ImageFormat.ISO) {
_tagsDao.removeByIdAndType(id, TaggedResourceType.ISO);
} else {
_tagsDao.removeByIdAndType(id, TaggedResourceType.Template);