public static UpdateQuery New(Class entityClass) { return UpdateQuery.New(entityClass); }
@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(); }
private void eliminateErrors() { String time = ElaborateGlobalConfig.ELIMILATE_TIME.value(); long count = Q.New(ElaborationVO.class).eq(ElaborationVO_.matched, false).lt(ElaborationVO_.lastOpDate, new Timestamp(new Date().getTime() - TimeUtils.parseTimeInMillis(time))).count(); if (count > 0) { logger.debug(String.format("clean [%s] records which are not matched error code in db", count)); UpdateQuery.New(ElaborationVO.class).eq(ElaborationVO_.matched, false).lt(ElaborationVO_.lastOpDate, new Timestamp(new Date().getTime() - TimeUtils.parseTimeInMillis(time))).delete(); } }
@Override public void removeFromDb(Long trashId) { DebugUtils.Assert(trashId != null, "trashId is not allowed null here"); UpdateQuery.New(JsonLabelVO.class).eq(JsonLabelVO_.id, trashId).delete(); }
@Override public void removeFromDb(String trashKey, String storageUuid) { UpdateQuery.New(JsonLabelVO.class).eq(JsonLabelVO_.labelKey, trashKey).eq(JsonLabelVO_.resourceUuid, storageUuid).delete(); }
@Override public void success() { UpdateQuery.New(LoadBalancerListenerVmNicRefVO.class) .condAnd(LoadBalancerListenerVmNicRefVO_.vmNicUuid, Op.IN, vmNicUuids) .condAnd(LoadBalancerListenerVmNicRefVO_.listenerUuid, Op.IN, listenerUuids) .delete(); completion.success(); }
@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(); } });
if (inv.getType().equals(VolumeType.Root.toString())) { spec.setDestRootVolume(inv); UpdateQuery.New(VmInstanceVO.class) .isNull(VmInstanceVO_.rootVolumeUuid) .set(VmInstanceVO_.rootVolumeUuid, inv.getUuid())
@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(); } }
UpdateQuery.New(VmNicVO.class) .eq(VmNicVO_.uuid, nic.getUuid()) .set(VmNicVO_.vmInstanceUuid, null)