@Override
  public boolean remove(Long id) {
    VMTemplateVO template = createForUpdate();
    template.setRemoved(new Date());

    return update(id, template);
  }
Esempio n. 2
0
  @Override
  @DB
  public boolean remove(Long id) {
    Transaction txn = Transaction.currentTxn();
    txn.start();
    VMTemplateVO template = createForUpdate();
    template.setRemoved(new Date());

    VMTemplateVO vo = findById(id);
    if (vo != null) {
      if (vo.getFormat() == ImageFormat.ISO) {
        _tagsDao.removeByIdAndType(id, TaggedResourceType.ISO);
      } else {
        _tagsDao.removeByIdAndType(id, TaggedResourceType.Template);
      }
    }

    boolean result = update(id, template);
    txn.commit();
    return result;
  }