@Override @DB() public T findByIdIncludingRemoved(final ID id) { T result = null; if (_cache != null) { final Element element = _cache.get(id); if (element == null) { result = findById(id, true, null); } else { result = (T)element.getObjectValue(); } } else { result = findById(id, true, null); } return result; }
@Override public NetworkACLItemVO findById(Long id) { NetworkACLItemVO item = super.findById(id); loadCidrs(item); return item; }
@Override @DB() public T lockRow(ID id, Boolean lock) { return findById(id, false, lock); }
@Override public T acquireInLockTable(final ID id, int seconds) { TransactionLegacy txn = TransactionLegacy.currentTxn(); T t = null; boolean locked = false; try { if (!txn.lock(_table + id.toString(), seconds)) { return null; } locked = true; t = findById(id); return t; } finally { if (t == null && locked) { txn.release(_table + id.toString()); } } }
@Override @DB() public T findById(final ID id, boolean fresh) { if (!fresh) { return findById(id); } if (_cache != null) { _cache.remove(id); } return lockRow(id, null); }
@Override public boolean isDynamic(long serviceOfferingId) { ServiceOfferingVO offering = super.findById(serviceOfferingId); return offering.getCpu() == null || offering.getSpeed() == null || offering.getRamSize() == null; }
@Override public ServiceOfferingVO findById(Long vmId, long serviceOfferingId) { ServiceOfferingVO offering = super.findById(serviceOfferingId); if (offering.isDynamic()) { offering.setDynamicFlag(true); if (vmId == null) { throw new CloudRuntimeException("missing argument vmId"); } Map<String, String> dynamicOffering = userVmDetailsDao.listDetailsKeyPairs(vmId); return getcomputeOffering(offering, dynamicOffering); } return offering; }
@Override @DB() public T findByIdIncludingRemoved(final ID id) { T result = null; if (_cache != null) { final Element element = _cache.get(id); if (element == null) { result = findById(id, true, null); } else { result = (T) element.getObjectValue(); } } else { result = findById(id, true, null); } return result; }
@Override @DB() public T lockRow(final ID id, final Boolean lock) { return findById(id, false, lock); }
@Override public T acquireInLockTable(final ID id, final int seconds) { final TransactionLegacy txn = TransactionLegacy.currentTxn(); T t = null; boolean locked = false; try { if (!txn.lock(_table + id.toString(), seconds)) { return null; } locked = true; t = findById(id); return t; } finally { if (t == null && locked) { txn.release(_table + id.toString()); } } }
@Override @DB() public T findById(final ID id, final boolean fresh) { if (!fresh) { return findById(id); } if (_cache != null) { _cache.remove(id); } return lockRow(id, null); }