@Override public int deleteVM(long instanceId) { SearchCriteria<SecurityGroupVMMapVO> sc = ListByVmId.create(); sc.setParameters("instanceId", instanceId); return super.expunge(sc); }
@Override public int deleteLB(long lbId) { SearchCriteria<ElasticLbVmMapVO> sc = AllFieldsSearch.create(); sc.setParameters("lbId", lbId); return super.expunge(sc); }
@Override public int deleteVM(long instanceId) { SearchCriteria<AffinityGroupVMMapVO> sc = ListByVmId.create(); sc.setParameters("instanceId", instanceId); return super.expunge(sc); }
@Override public int remove(SearchCriteria<T> sc) { if (_removeSql == null) { return expunge(sc); } T vo = createForUpdate(); UpdateBuilder ub = getUpdateBuilder(vo); ub.set(vo, _removed.second(), new Date()); return update(ub, sc, null); }
@Override @DB public boolean expunge(Long id) { TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); SecurityGroupVO entry = findById(id); if (entry != null) { _tagsDao.removeByIdAndType(id, ResourceObjectType.SecurityGroup); } boolean result = super.expunge(id); txn.commit(); return result; } }
@Override public boolean remove(final ID id) { if (_removeSql == null) { return expunge(id); } final TransactionLegacy txn = TransactionLegacy.currentTxn(); PreparedStatement pstmt = null; try { txn.start(); pstmt = txn.prepareAutoCloseStatement(_removeSql.first()); final Attribute[] attrs = _removeSql.second(); prepareAttribute(1, pstmt, attrs[attrs.length - 1], null); for (int i = 0; i < attrs.length - 1; i++) { prepareAttribute(i + 2, pstmt, attrs[i], id); } final int result = pstmt.executeUpdate(); txn.commit(); if (_cache != null) { _cache.remove(id); } return result > 0; } catch (final SQLException e) { throw new CloudRuntimeException("DB Exception on: " + pstmt, e); } }
@Override public int remove(final SearchCriteria<T> sc) { if (_removeSql == null) { return expunge(sc); } final T vo = createForUpdate(); final UpdateBuilder ub = getUpdateBuilder(vo); ub.set(vo, _removed.second(), new Date()); return update(ub, sc, null); }
@Override public boolean remove(final ID id) { if (_removeSql == null) { return expunge(id); } final TransactionLegacy txn = TransactionLegacy.currentTxn(); PreparedStatement pstmt = null; try { txn.start(); pstmt = txn.prepareAutoCloseStatement(_removeSql.first()); final Attribute[] attrs = _removeSql.second(); prepareAttribute(1, pstmt, attrs[attrs.length - 1], null); for (int i = 0; i < attrs.length - 1; i++) { prepareAttribute(i + 2, pstmt, attrs[i], id); } final int result = pstmt.executeUpdate(); txn.commit(); if (_cache != null) { _cache.remove(id); } return result > 0; } catch (final SQLException e) { throw new CloudRuntimeException("DB Exception on: " + pstmt, e); } }