use of com.cloud.utils.db.TransactionLegacy in project cloudstack by apache.
the class NetworkDaoImpl method update.
@Override
@DB
public boolean update(final Long networkId, final NetworkVO network, final Map<String, String> serviceProviderMap) {
final TransactionLegacy txn = TransactionLegacy.currentTxn();
txn.start();
super.update(networkId, network);
if (serviceProviderMap != null) {
_ntwkSvcMap.deleteByNetworkId(networkId);
persistNetworkServiceProviders(networkId, serviceProviderMap);
}
txn.commit();
return true;
}
use of com.cloud.utils.db.TransactionLegacy in project cloudstack by apache.
the class NetworkACLItemDaoImpl method persist.
@Override
@DB
public NetworkACLItemVO persist(NetworkACLItemVO networkAclItem) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
txn.start();
NetworkACLItemVO dbNetworkACLItem = super.persist(networkAclItem);
saveCidrs(networkAclItem, networkAclItem.getSourceCidrList());
loadCidrs(dbNetworkACLItem);
txn.commit();
return dbNetworkACLItem;
}
use of com.cloud.utils.db.TransactionLegacy in project cloudstack by apache.
the class PrivateIpDaoImpl method allocateIpAddress.
@Override
public PrivateIpVO allocateIpAddress(long dcId, long networkId, String requestedIp) {
SearchCriteria<PrivateIpVO> sc = AllFieldsSearch.create();
sc.setParameters("networkId", networkId);
sc.setParameters("taken", (Date) null);
if (requestedIp != null) {
sc.setParameters("ipAddress", requestedIp);
}
TransactionLegacy txn = TransactionLegacy.currentTxn();
txn.start();
PrivateIpVO vo = lockOneRandomRow(sc, true);
if (vo == null) {
txn.rollback();
return null;
}
vo.setTakenAt(new Date());
update(vo.getId(), vo);
txn.commit();
return vo;
}
use of com.cloud.utils.db.TransactionLegacy in project cloudstack by apache.
the class StaticRouteDaoImpl method remove.
@Override
@DB
public boolean remove(Long id) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
txn.start();
StaticRouteVO entry = findById(id);
if (entry != null) {
_tagsDao.removeByIdAndType(id, ResourceObjectType.StaticRoute);
}
boolean result = super.remove(id);
txn.commit();
return result;
}
use of com.cloud.utils.db.TransactionLegacy in project cloudstack by apache.
the class VpcDaoImpl method remove.
@Override
@DB
public boolean remove(Long id) {
TransactionLegacy txn = TransactionLegacy.currentTxn();
txn.start();
VpcVO entry = findById(id);
if (entry != null) {
_tagsDao.removeByIdAndType(id, ResourceObjectType.Vpc);
}
boolean result = super.remove(id);
txn.commit();
return result;
}
Aggregations