@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 cleanupVip(String uuid) { SQL.New(VirtualRouterVipVO.class).eq(VirtualRouterVipVO_.uuid, uuid).delete(); } }
@Override public void run() { Long finalExtendPeriod = CaptchaGlobalConfig.CAPTCHA_VALID_PERIOD.value(Long.class); Timestamp expiredDate = new Timestamp(getCurrentSqlDate().getTime() - TimeUnit.SECONDS.toMillis(finalExtendPeriod)); SQL.New(CaptchaVO.class).lt(CaptchaVO_.createDate, expiredDate).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 afterRemoveDhcpServerIP(String L3NetworkUuid, String dhcpSererIp) { SQL.New(L3NetworkHostRouteVO.class).eq(L3NetworkHostRouteVO_.l3NetworkUuid, L3NetworkUuid) .eq(L3NetworkHostRouteVO_.prefix, NetworkServiceConstants.METADATA_HOST_PREFIX).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(); } });
@Override protected void scripts() { if(Q.New(CephPrimaryStorageVO.class).eq(CephPrimaryStorageVO_.fsid, fsid).find() == null){ SQL.New(CephCapacityVO.class).eq(CephCapacityVO_.fsid, fsid).delete(); } } }.execute();
@Override protected void scripts() { if (!q(VolumeSnapshotVO.class).eq(VolumeSnapshotVO_.volumeUuid, volumeUuid).isExists()) { return; } List<String> treeUuids = q(VolumeSnapshotVO.class).select(VolumeSnapshotVO_.treeUuid).eq(VolumeSnapshotVO_.volumeUuid, volumeUuid).listValues(); sql(VolumeSnapshotTreeVO.class).in(VolumeSnapshotTreeVO_.uuid, treeUuids).delete(); sql(VolumeSnapshotVO.class).eq(VolumeSnapshotVO_.volumeUuid, volumeUuid).delete(); } }.execute();
private void handle(APIDeleteNotificationsMsg msg) { APIDeleteNotificationsEvent evt = new APIDeleteNotificationsEvent(msg.getId()); SQL.New(NotificationVO.class).in(NotificationVO_.uuid, msg.getUuids()).delete(); bus.publish(evt); }
@Override public void handle(Map data) { casf.asyncCascadeFull(CascadeConstant.DELETION_CLEANUP_CODE, issuer, ctx, new NopeCompletion()); SQL.New(SharedResourceVO.class).eq(SharedResourceVO_.resourceUuid, msg.getL2NetworkUuid()).delete(); bus.publish(evt); } }).error(new FlowErrorHandler(msg) {
SQL.New(CertificateVO.class).eq(CertificateVO_.uuid, msg.getUuid()).delete();
@Override public void deleteHook() { List<String> poolNameLists = list( getDefaultRootVolumePoolName(), getDefaultDataVolumePoolName(), getDefaultImageCachePoolName() ); SQL.New(CephPrimaryStoragePoolVO.class) .in(CephPrimaryStoragePoolVO_.poolName, poolNameLists).delete(); if (CephGlobalConfig.PRIMARY_STORAGE_DELETE_POOL.value(Boolean.class)) { DeletePoolCmd cmd = new DeletePoolCmd(); cmd.poolNames = poolNameLists; FutureReturnValueCompletion completion = new FutureReturnValueCompletion(null); httpCall(DELETE_POOL_PATH, cmd, DeletePoolRsp.class, completion); completion.await(TimeUnit.MINUTES.toMillis(30)); if (!completion.isSuccess()) { throw new OperationFailureException(completion.getErrorCode()); } } String fsid = getSelf().getFsid(); new SQLBatch(){ @Override protected void scripts() { if(Q.New(CephBackupStorageVO.class).eq(CephBackupStorageVO_.fsid, fsid).find() == null){ SQL.New(CephCapacityVO.class).eq(CephCapacityVO_.fsid, fsid).delete(); } } }.execute(); dbf.removeCollection(getSelf().getMons(), CephPrimaryStorageMonVO.class); }