@AsyncThread private void delete(Collection ids) { // the resourceUuid must be in type of String if (!(ids.iterator().next() instanceof String)) { return; } UpdateQuery q = UpdateQuery.New(JsonLabelVO.class); q.condAnd(JsonLabelVO_.resourceUuid, Op.IN, ids); q.delete(); }
public void delete(String key) { UpdateQuery q = UpdateQuery.New(JsonLabelVO.class); q.condAnd(JsonLabelVO_.labelKey, Op.EQ, key); q.delete(); }
@Override public void run(List<MessageReply> replies) { if (!action.isActionCode(CascadeConstant.DELETION_FORCE_DELETE_CODE)) { for (MessageReply r : replies) { if (!r.isSuccess()) { completion.fail(r.getError()); return; } } } if (action.getParentIssuer().equals(PrimaryStorageVO.class.getSimpleName())) { // when deleting the primary storage, the foreign key of VolumeVO to PrimaryStorageVO // will cause VolumeVO to be deleted but left AccountResourceRefVO of the volume left List<String> volUuids = volumes.stream().map(s -> s.getInventory().getUuid()).collect(Collectors.toList()); UpdateQuery q = UpdateQuery.New(AccountResourceRefVO.class); q.condAnd(AccountResourceRefVO_.resourceUuid, Op.IN, volUuids); q.condAnd(AccountResourceRefVO_.resourceType, Op.EQ, VolumeVO.class.getSimpleName()); q.delete(); } completion.success(); } });
.isNull(VmInstanceVO_.rootVolumeUuid) .set(VmInstanceVO_.rootVolumeUuid, inv.getUuid()) .condAnd(VmInstanceVO_.uuid, Op.EQ, spec.getVmInventory().getUuid()) .update(); } else {
@Override public void success() { List<Tuple> eips = findEipTuplesOnVmNic(nic);; if (eips == null || eips.isEmpty()) { completion.success(); } else { for (Tuple eipTuple : eips) { VirtualRouterEipRefVO ref = Q.New(VirtualRouterEipRefVO.class) .eq(VirtualRouterEipRefVO_.eipUuid, eipTuple.get(5, String.class)) .eq(VirtualRouterEipRefVO_.virtualRouterVmUuid, nic.getVmInstanceUuid()) .find(); if (ref != null) { dbf.remove(ref); UpdateQuery q = UpdateQuery.New(EipVO.class); q.condAnd(EipVO_.uuid, Op.EQ, eipTuple.get(5, String.class)); q.set(EipVO_.vmNicUuid, null); q.set(EipVO_.guestIp, null); q.update(); } } completion.success(); } }