@Override protected void scripts() { // in case 'recover api' called for an incomplete image sql(ImageBackupStorageRefVO.class).eq(ImageBackupStorageRefVO_.imageUuid, self.getUuid()).hardDelete(); sql(ImageVO.class).eq(ImageVO_.uuid, self.getUuid()).hardDelete(); } }.execute();
@Override @RetryCondition(times = 6) protected Void call() { SQL.New(UsedIpVO.class).eq(UsedIpVO_.uuid, msg.getUsedIpUuid()).hardDelete(); return null; } }.run();
@Override protected void scripts() { String psUuid = q(VolumeSnapshotVO.class) .select(VolumeSnapshotVO_.primaryStorageUuid) .eq(VolumeSnapshotVO_.uuid, currentRoot.getUuid()) .findValue(); if (psUuid != null) { ret.value = false; return; } // the snapshot is on neither primary storage, delete it and descendants List<String> uuids = currentLeaf.getDescendants().stream().map(VolumeSnapshotInventory::getUuid).collect(Collectors.toList()); if (!uuids.isEmpty()) { sql(VolumeSnapshotVO.class).in(VolumeSnapshotVO_.uuid, uuids).hardDelete(); } if (!q(VolumeSnapshotVO.class).eq(VolumeSnapshotVO_.treeUuid, currentRoot.getTreeUuid()).isExists()) { logger.debug(String.format("volume snapshot tree[uuid:%s] has no leaf, delete it", currentRoot.getTreeUuid())); sql(VolumeSnapshotTreeVO.class).eq(VolumeSnapshotTreeVO_.uuid, currentRoot.getTreeUuid()).hardDelete(); } ret.value = true; } }.execute();
@Override protected void scripts() { SessionInventory s = sessions.remove(uuid); if (s == null) { SessionVO vo = findByUuid(uuid, SessionVO.class); s = vo == null ? null : SessionInventory.valueOf(vo); } if (s == null) { return; } SessionInventory finalS = s; Platform.getComponentLoader().getComponent(PluginRegistry.class) .getExtensionList(SessionLogoutExtensionPoint.class) .forEach(ext -> ext.sessionLogout(finalS)); sql(SessionVO.class).eq(SessionVO_.uuid, uuid).hardDelete(); } }.execute();
private void handle(APIDeleteWebhookMsg msg) { APIDeleteWebhookEvent evt = new APIDeleteWebhookEvent(msg.getId()); SQL.New(WebhookVO.class).eq(WebhookVO_.uuid, msg.getUuid()).hardDelete(); bus.publish(evt); }
private void handle(APIDeleteRoleMsg msg) { SQL.New(RoleVO.class).eq(RoleVO_.uuid, msg.getUuid()).hardDelete(); bus.publish(new APIDeleteRoleEvent(msg.getId())); } }
private void handle(APIRemovePolicyStatementsFromRoleMsg msg) { SQL.New(RolePolicyStatementVO.class).eq(RolePolicyStatementVO_.roleUuid, self.getUuid()) .in(RolePolicyStatementVO_.uuid, msg.getPolicyStatementUuids()).hardDelete(); bus.publish(new APIRemovePolicyStatementsFromRoleEvent(msg.getId())); }
private void handle(APIDetachRoleFromAccountMsg msg) { SQL.New(RoleAccountRefVO.class).eq(RoleAccountRefVO_.accountUuid, msg.getAccountUuid()) .eq(RoleAccountRefVO_.roleUuid, msg.getRoleUuid()).hardDelete(); APIDetachRoleFromAccountEvent evt = new APIDetachRoleFromAccountEvent(msg.getId()); bus.publish(evt); }
@Override protected void scripts() { List<String> huuids = Q.New(HostVO.class).select(HostVO_.uuid) .eq(HostVO_.clusterUuid, clusterUuid) .listValues(); SQL.New(PrimaryStorageHostRefVO.class) .eq(PrimaryStorageHostRefVO_.primaryStorageUuid, inventory.getUuid()) .in(PrimaryStorageHostRefVO_.hostUuid, huuids) .hardDelete(); } }.execute();
private void handle(APIDetachPolicyFromRoleMsg msg) { SQL.New(RolePolicyRefVO.class).eq(RolePolicyRefVO_.policyUuid, msg.getPolicyUuid()) .eq(RolePolicyRefVO_.roleUuid, msg.getRoleUuid()).hardDelete(); bus.publish(new APIDetachPolicyFromRoleEvent(msg.getId())); }
@Override public void rollback(FlowRollback chain, Map data) { String vipUuid = (String) data.get(VirtualRouterConstant.Param.PUB_VIP_UUID.toString()); if (vipUuid == null) { chain.rollback(); return; } SQL.New(VirtualRouterVipVO.class).eq(VirtualRouterVipVO_.uuid, vipUuid).hardDelete(); ModifyVipAttributesStruct struct = new ModifyVipAttributesStruct(); struct.setUseFor(NetworkServiceType.SNAT.toString()); Vip vip = new Vip(vipUuid); vip.setStruct(struct); vip.release(new Completion(chain) { @Override public void success() { chain.rollback(); } @Override public void fail(ErrorCode errorCode) { chain.rollback(); } }); } }
sql(VolumeSnapshotTreeVO.class).eq(VolumeSnapshotTreeVO_.uuid, snapshotTreeUuid).hardDelete();