Skip to content

Commit

Permalink
[Improve] Improve streampark-console core package module service remo…
Browse files Browse the repository at this point in the history
…ve method name base on [3.1 Naming Style] (#3310)

* [Improve] Improve streampark-console core package module service remove method name base on [3.1 Naming Style]

* [Fix] fix few delete method name
  • Loading branch information
VampireAchao authored Nov 5, 2023
1 parent 4e2e9da commit 3c8bd0b
Show file tree
Hide file tree
Showing 43 changed files with 65 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public RestResponse alertConfigsList() {
@DeleteMapping("/delete")
public RestResponse deleteAlertConfig(
@RequestParam("id") @NotNull(message = "config id must be not null") Long id) {
boolean result = alertConfigService.deleteById(id);
boolean result = alertConfigService.removeById(id);
return RestResponse.success(result);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ public RestResponse optionlog(ApplicationLog applicationLog, RestRequest request
@PermissionAction(id = "#applicationLog.appId", type = PermissionTypeEnum.APP)
@PostMapping("deleteOperationLog")
@RequiresPermissions("app:delete")
public RestResponse deleteOperationLog(ApplicationLog applicationLog) {
Boolean deleted = applicationLogService.delete(applicationLog);
public RestResponse deleteOperationLog(Long id) {
Boolean deleted = applicationLogService.removeById(id);
return RestResponse.success(deleted);
}

Expand All @@ -344,15 +344,15 @@ public RestResponse deleteOperationLog(ApplicationLog applicationLog) {
@PostMapping("delete")
@RequiresPermissions("app:delete")
public RestResponse delete(Application app) throws InternalException {
Boolean deleted = applicationManageService.delete(app);
Boolean deleted = applicationManageService.remove(app);
return RestResponse.success(deleted);
}

@Operation(summary = "Backup application when deleted")
@PermissionAction(id = "#backUp.appId", type = PermissionTypeEnum.APP)
@PostMapping("deletebak")
public RestResponse deleteBak(ApplicationBackUp backUp) throws InternalException {
Boolean deleted = backUpService.delete(backUp.getId());
Boolean deleted = backUpService.removeById(backUp.getId());
return RestResponse.success(deleted);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public RestResponse update(@Valid ExternalLink externalLink) {
@RequiresPermissions("externalLink:delete")
public RestResponse delete(
@NotNull(message = "The link id cannot be null") @RequestParam("id") Long id) {
externalLinkService.delete(id);
externalLinkService.removeById(id);
return RestResponse.success();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public RestResponse shutdown(FlinkCluster cluster) {
@Operation(summary = "Delete flink cluster")
@PostMapping("delete")
public RestResponse delete(FlinkCluster cluster) {
flinkClusterService.delete(cluster);
flinkClusterService.remove(cluster);
return RestResponse.success();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public RestResponse update(FlinkEnv version) throws Exception {
@Operation(summary = "Delete flink environment")
@PostMapping("delete")
public RestResponse delete(Long id) {
flinkEnvService.delete(id);
flinkEnvService.removeById(id);
return RestResponse.success();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public RestResponse branches(Project project) {
@PostMapping("delete")
@RequiresPermissions("project:delete")
public RestResponse delete(Long id) {
Boolean deleted = projectService.delete(id);
Boolean deleted = projectService.removeById(id);
return RestResponse.success().data(deleted);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public RestResponse updateResource(@Valid Resource resource) {
@DeleteMapping("delete")
@RequiresPermissions("resource:delete")
public RestResponse deleteResource(@Valid Resource resource) {
this.resourceService.deleteResource(resource);
this.resourceService.remove(resource);
return RestResponse.success();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public RestResponse history(SavePoint savePoint, RestRequest request) {
public RestResponse delete(Long id) throws InternalException {
SavePoint savePoint = savePointService.getById(id);
Application application = applicationManageService.getById(savePoint.getAppId());
Boolean deleted = savePointService.delete(id, application);
Boolean deleted = savePointService.remove(id, application);
return RestResponse.success(deleted);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public RestResponse showOriginal(@RequestParam Long id) {
@DeleteMapping("delete")
@RequiresPermissions("variable:delete")
public RestResponse deleteVariable(@Valid Variable variable) {
this.variableService.deleteVariable(variable);
this.variableService.remove(variable);
return RestResponse.success();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public RestResponse update(YarnQueue yarnQueue) {
@PostMapping("delete")
@RequiresPermissions("yarnQueue:delete")
public RestResponse delete(YarnQueue yarnQueue) {
yarnQueueService.deleteYarnQueue(yarnQueue);
yarnQueueService.remove(yarnQueue);
return RestResponse.success();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ public interface AppBuildPipeService extends IService<AppBuildPipeline> {
*
* @param appId
*/
void removeApp(Long appId);
void removeByAppId(Long appId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface ApplicationBackUpService extends IService<ApplicationBackUp> {
* @return true if the object was successfully deleted, false otherwise.
* @throws InternalException if an internal error occurs during the deletion process.
*/
Boolean delete(Long id) throws InternalException;
Boolean removeById(Long id) throws InternalException;

/**
* Performs a backup for the given application and Flink SQL parameters.
Expand Down Expand Up @@ -74,7 +74,7 @@ public interface ApplicationBackUpService extends IService<ApplicationBackUp> {
*
* @param appParam the application to be removed
*/
void removeApp(Application appParam);
void remove(Application appParam);

/**
* Rolls back a Flink SQL application to its previous state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,5 @@ public interface ApplicationConfigService extends IService<ApplicationConfig> {
*
* @param appId The id of the app to be removed.
*/
void removeApp(Long appId);
void removeByAppId(Long appId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,5 @@ public interface ApplicationLogService extends IService<ApplicationLog> {

IPage<ApplicationLog> getPage(ApplicationLog applicationLog, RestRequest request);

void removeApp(Long appId);

Boolean delete(ApplicationLog applicationLog);
void removeByAppId(Long appId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@

public interface EffectiveService extends IService<Effective> {

void delete(Long appId, EffectiveTypeEnum config);
void remove(Long appId, EffectiveTypeEnum config);

Effective get(Long appId, EffectiveTypeEnum config);

void saveOrUpdate(Long appId, EffectiveTypeEnum type, Long id);

void removeApp(Long appId);
void removeByAppId(Long appId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public interface ExternalLinkService extends IService<ExternalLink> {

void create(ExternalLink externalLink);

void delete(Long linkId);
void removeById(Long linkId);

void update(ExternalLink externalLink);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public interface FlinkClusterService extends IService<FlinkCluster> {

Boolean create(FlinkCluster flinkCluster);

void delete(FlinkCluster flinkCluster);
void remove(FlinkCluster flinkCluster);

void update(FlinkCluster flinkCluster);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public interface FlinkEnvService extends IService<FlinkEnv> {
*
* @param id the ID of the Flink environment to delete
*/
void delete(Long id);
void removeById(Long id);

/**
* Updates the specified version of Flink environment.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public interface FlinkSqlService extends IService<FlinkSql> {

void cleanCandidate(Long id);

void removeApp(Long appId);
void removeByAppId(Long appId);

void rollback(Application application);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface ProjectService extends IService<Project> {

boolean update(Project projectParam);

boolean delete(Long id);
boolean removeById(Long id);

IPage<Project> getPage(Project project, RestRequest restRequest);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public interface ResourceService extends IService<Resource> {
*
* @param resource
*/
void deleteResource(Resource resource);
void remove(Resource resource);

/**
* Get resource through team id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public interface SavePointService extends IService<SavePoint> {
* @return true if the application is successfully deleted, false otherwise
* @throws InternalException if there is an internal error during the deletion process
*/
Boolean delete(Long id, Application appParam) throws InternalException;
Boolean remove(Long id, Application appParam) throws InternalException;

/**
* Retrieves a page of savepoint objects based on the specified parameters.
Expand All @@ -78,7 +78,7 @@ public interface SavePointService extends IService<SavePoint> {
*
* @param appParam the application to be removed
*/
void removeApp(Application appParam);
void remove(Application appParam);

/**
* Returns the savepoint path for the given application.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public interface VariableService extends IService<Variable> {
*
* @param variable the Variable object to be deleted
*/
void deleteVariable(Variable variable);
void remove(Variable variable);

/**
* Find a Variable by its code and team ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface YarnQueueService extends IService<YarnQueue> {

void updateYarnQueue(YarnQueue yarnQueue);

void deleteYarnQueue(YarnQueue yarnQueue);
void remove(YarnQueue yarnQueue);

void checkQueueLabel(FlinkExecutionMode executionModeEnum, String queueLabel);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ public interface AlertConfigService extends IService<AlertConfig> {

boolean exist(AlertConfig alertConfig);

boolean deleteById(Long id) throws AlertException;
boolean removeById(Long id) throws AlertException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public boolean exist(AlertConfig alertConfig) {
}

@Override
public boolean deleteById(Long id) throws AlertException {
public boolean removeById(Long id) throws AlertException {
long count =
applicationInfoService.count(
new LambdaQueryWrapper<Application>().eq(id != null, Application::getAlertId, id));
Expand All @@ -84,6 +84,6 @@ public boolean deleteById(Long id) throws AlertException {
"AlertId:%d, this is bound by application. Please clear the configuration first",
id));
}
return removeById(id);
return super.removeById(id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public interface ApplicationManageService extends IService<Application> {
* @param appParam The Application to be deleted.
* @return True if the deletion was successful, false otherwise.
*/
Boolean delete(Application appParam);
Boolean remove(Application appParam);

/**
* Retrieves the Application with the specified details from the system.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,31 +175,31 @@ public boolean mapping(Application appParam) {
}

@Override
public Boolean delete(Application appParam) {
public Boolean remove(Application appParam) {

Application application = getById(appParam.getId());

// 1) remove flink sql
flinkSqlService.removeApp(application.getId());
flinkSqlService.removeByAppId(application.getId());

// 2) remove log
applicationLogService.removeApp(application.getId());
applicationLogService.removeByAppId(application.getId());

// 3) remove config
configService.removeApp(application.getId());
configService.removeByAppId(application.getId());

// 4) remove effective
effectiveService.removeApp(application.getId());
effectiveService.removeByAppId(application.getId());

// remove related hdfs
// 5) remove backup
backUpService.removeApp(application);
backUpService.remove(application);

// 6) remove savepoint
savePointService.removeApp(application);
savePointService.remove(application);

// 7) remove BuildPipeline
appBuildPipeService.removeApp(application.getId());
appBuildPipeService.removeByAppId(application.getId());

// 8) remove app
removeApp(application);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public boolean buildApplication(@NotNull Long appId, boolean forceBuild) {
BuildPipeline pipeline = createPipelineInstance(app);

// clear history
removeApp(app.getId());
removeByAppId(app.getId());
// register pipeline progress event watcher.
// save snapshot of pipeline to db when status of pipeline was changed.
pipeline.registerWatcher(
Expand Down Expand Up @@ -593,7 +593,7 @@ public Map<Long, PipelineStatusEnum> listAppIdPipelineStatusMap(List<Long> appId
}

@Override
public void removeApp(Long appId) {
public void removeByAppId(Long appId) {
baseMapper.delete(
new LambdaQueryWrapper<AppBuildPipeline>().eq(AppBuildPipeline::getAppId, appId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ public void revoke(Application appParam) {
ApplicationBackUp backup = backUpPages.getRecords().get(0);
String path = backup.getPath();
appParam.getFsOperator().move(path, appParam.getWorkspace().APP_WORKSPACE());
removeById(backup.getId());
super.removeById(backup.getId());
}
}

@Override
public void removeApp(Application appParam) {
public void remove(Application appParam) {
try {
baseMapper.delete(
new LambdaQueryWrapper<ApplicationBackUp>()
Expand Down Expand Up @@ -178,12 +178,12 @@ public void rollbackFlinkSql(Application appParam, FlinkSql flinkSqlParam) {
}

@Override
public Boolean delete(Long id) throws InternalException {
public Boolean removeById(Long id) throws InternalException {
ApplicationBackUp backUp = getById(id);
try {
Application application = applicationManageService.getById(backUp.getAppId());
application.getFsOperator().delete(backUp.getPath());
removeById(id);
super.removeById(id);
return true;
} catch (Exception e) {
throw new InternalException(e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public synchronized void update(Application appParam, Boolean latest) {
ApplicationConfig effectiveConfig = getEffective(appParam.getId());
if (Utils.isEmpty(appParam.getConfig())) {
if (effectiveConfig != null) {
effectiveService.delete(appParam.getId(), EffectiveTypeEnum.CONFIG);
effectiveService.remove(appParam.getId(), EffectiveTypeEnum.CONFIG);
}
} else {
// there was no configuration before, is a new configuration
Expand Down Expand Up @@ -245,7 +245,7 @@ public synchronized String readTemplate() {
}

@Override
public void removeApp(Long appId) {
public void removeByAppId(Long appId) {
baseMapper.delete(
new LambdaQueryWrapper<ApplicationConfig>().eq(ApplicationConfig::getAppId, appId));
}
Expand Down
Loading

0 comments on commit 3c8bd0b

Please sign in to comment.