@Override public List<? extends ResourceTag> listByResourceTypeAndId(ResourceObjectType resourceType, long resourceId) { return _resourceTagDao.listBy(resourceId, resourceType); } }
@Override public Map<String, Set<ResourceTagResponse>> getUsageResourceTags() { try { return _resourceTagDao.listTags(); } catch(Exception ex) { s_logger.warn("Failed to get resource details for Usage data due to exception : ", ex); } return null; }
@Override public void doInTransactionWithoutResult(TransactionStatus status) { for (ResourceTag tagToRemove : tagsToDelete) { _resourceTagDao.remove(tagToRemove.getId()); s_logger.debug("Removed the tag '" + tagToRemove + "' for resources (" + String.join(", ", resourceIds) + ")"); } } });
@Override public boolean remove(Long id) { TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); _tagsDao.removeByIdAndType(id, ResourceObjectType.UserVm); boolean result = super.remove(id); txn.commit(); return result; }
@Override public void updateResourceId(long srcId, long destId, ResourceObjectType resourceType) { SearchCriteria<ResourceTagVO> sc = AllFieldsSearch.create(); sc.setParameters("resourceId", srcId); sc.setParameters("resourceType", resourceType); for( ResourceTagVO tag : listBy(sc)) { tag.setResourceId(destId); update(tag.getId(), tag); } }
private void copyVpcResourceTagsToNewVpc(long srcVpcId, long dstVpcId){ List<? extends ResourceTag> resourceTags = _resourceTagDao.listBy(srcVpcId, ResourceTag.ResourceObjectType.Vpc); for (ResourceTag resourceTag : resourceTags) { resourceTag.setResourceId(dstVpcId); _resourceTagDao.persist( new ResourceTagVO( resourceTag.getKey(), resourceTag.getValue(), resourceTag.getAccountId(), resourceTag.getDomainId(), dstVpcId, resourceTag.getResourceType(), resourceTag.getCustomer(), resourceTag.getResourceUuid())); } }
@Override public List<? extends ResourceTag> listByResourceUuid(String resourceUuid) { SearchCriteria<ResourceTagVO> sc = AllFieldsSearch.create(); sc.setParameters("resourceUuid", resourceUuid); return listBy(sc); } }
@Override public boolean removeByIdAndType(long resourceId, ResourceTag.ResourceObjectType resourceType) { SearchCriteria<ResourceTagVO> sc = AllFieldsSearch.create(); sc.setParameters("resourceId", resourceId); sc.setParameters("resourceType", resourceType); remove(sc); return true; }
@Override public ResourceTag findByKey(long resourceId, ResourceObjectType resourceType, String key) { SearchCriteria<ResourceTagVO> sc = AllFieldsSearch.create(); sc.setParameters("resourceId", resourceId); sc.setParameters("resourceType", resourceType); sc.setParameters("key", key); return findOneBy(sc); }
public ResourceTagsDaoImpl() { AllFieldsSearch = createSearchBuilder(); AllFieldsSearch.and("resourceId", AllFieldsSearch.entity().getResourceId(), Op.EQ); AllFieldsSearch.and("uuid", AllFieldsSearch.entity().getResourceUuid(), Op.EQ); AllFieldsSearch.and("resourceType", AllFieldsSearch.entity().getResourceType(), Op.EQ); AllFieldsSearch.and("key", AllFieldsSearch.entity().getKey(), Op.EQ); AllFieldsSearch.and("resourceUuid", AllFieldsSearch.entity().getResourceUuid(), Op.EQ); AllFieldsSearch.done(); }
@Override @DB public boolean remove(Long id) { TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); SecurityGroupVO entry = findById(id); if (entry != null) { _tagsDao.removeByIdAndType(id, ResourceObjectType.SecurityGroup); } boolean result = super.remove(id); txn.commit(); return result; }
@Override public List<? extends ResourceTag> listBy(long resourceId, ResourceObjectType resourceType) { SearchCriteria<ResourceTagVO> sc = AllFieldsSearch.create(); sc.setParameters("resourceId", resourceId); sc.setParameters("resourceType", resourceType); return listBy(sc); }
@Override public void removeByResourceIdAndKey(long resourceId, ResourceObjectType resourceType, String key) { SearchCriteria<ResourceTagVO> sc = AllFieldsSearch.create(); sc.setParameters("resourceId", resourceId); sc.setParameters("resourceType", resourceType); sc.setParameters("key", key); remove(sc); }
@Override @DB public boolean remove(final Long id) { final TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); final NetworkVO entry = findById(id); if (entry != null) { _tagsDao.removeByIdAndType(id, ResourceObjectType.Network); } final boolean result = super.remove(id); txn.commit(); return result; }
@Override @DB public boolean remove(Long id) { TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); IPAddressVO entry = findById(id); if (entry != null) { _tagsDao.removeByIdAndType(id, ResourceObjectType.SecurityGroup); } boolean result = super.remove(id); txn.commit(); return result; }
@Override @DB public boolean remove(Long id) { TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); SnapshotVO entry = findById(id); if (entry != null) { _tagsDao.removeByIdAndType(id, ResourceObjectType.Snapshot); } boolean result = super.remove(id); txn.commit(); return result; }
@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; } }
@Override @DB public boolean remove(Long id) { TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); VolumeVO entry = findById(id); if (entry != null) { _tagsDao.removeByIdAndType(id, ResourceObjectType.Volume); } boolean result = super.remove(id); txn.commit(); return result; }
@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; }
@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; } }