per angie, Below sequence doesn't work

1. copy template1 from z1 to z2
2. remove template1 from z2
3. copy tempalte1 from z1 to z2 again,
4. template1 for z2 doesn't show up in MyTemplate

fixed
This commit is contained in:
anthony 2011-07-01 16:17:18 -07:00
parent 494f29702b
commit c0f22970d3
1 changed files with 9 additions and 2 deletions

View File

@ -528,8 +528,15 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
if (tmplt2 == null){
persist(tmplt);
}
VMTemplateZoneVO tmpltZoneVO = new VMTemplateZoneVO(zoneId, tmplt.getId(), new Date());
_templateZoneDao.persist(tmpltZoneVO);
VMTemplateZoneVO tmpltZoneVO = _templateZoneDao.findByZoneTemplate(zoneId, tmplt.getId());
if ( tmpltZoneVO == null ) {
tmpltZoneVO = new VMTemplateZoneVO(zoneId, tmplt.getId(), new Date());
_templateZoneDao.persist(tmpltZoneVO);
} else {
tmpltZoneVO.setRemoved(null);
tmpltZoneVO.setLastUpdated(new Date());
_templateZoneDao.update(tmpltZoneVO.getId(), tmpltZoneVO);
}
txn.commit();
return tmplt.getId();