use of com.baidu.hugegraph.exception.ExternalException in project incubator-hugegraph-toolchain by apache.
the class JobManagerController method delete.
@DeleteMapping("{id}")
public void delete(@PathVariable("id") int id) {
JobManager task = this.service.get(id);
if (task == null) {
throw new ExternalException("job.manager.not-exist.id", id);
}
this.service.remove(id);
}
use of com.baidu.hugegraph.exception.ExternalException in project incubator-hugegraph-toolchain by apache.
the class LoadTaskController method stop.
@PostMapping("stop")
public LoadTask stop(@PathVariable("connId") int connId, @PathVariable("jobId") int jobId, @RequestParam("task_id") int taskId) {
GraphConnection connection = this.connService.get(connId);
if (connection == null) {
throw new ExternalException("graph-connection.not-exist.id", connId);
}
JobManager jobEntity = this.jobService.get(jobId);
Ex.check(jobEntity != null, "job-manager.not-exist.id", jobId);
Ex.check(jobEntity.getJobStatus() == JobStatus.LOADING, "load.task.pause.no-permission");
try {
return this.service.stop(taskId);
} finally {
jobEntity.setJobStatus(JobStatus.LOADING);
jobEntity.setUpdateTime(HubbleUtil.nowDate());
this.jobService.update(jobEntity);
}
}
use of com.baidu.hugegraph.exception.ExternalException in project incubator-hugegraph-toolchain by apache.
the class GremlinCollectionController method update.
@PutMapping("{id}")
public GremlinCollection update(@PathVariable("id") int id, @RequestBody GremlinCollection newEntity) {
this.checkIdSameAsBody(id, newEntity);
this.checkParamsValid(newEntity, false);
GremlinCollection oldEntity = this.service.get(id);
if (oldEntity == null) {
throw new ExternalException("gremlin-collection.not-exist.id", id);
}
GremlinCollection entity = this.mergeEntity(oldEntity, newEntity);
this.checkEntityUnique(entity, false);
this.service.update(entity);
return entity;
}
use of com.baidu.hugegraph.exception.ExternalException in project incubator-hugegraph-toolchain by apache.
the class GremlinCollectionController method delete.
@DeleteMapping("{id}")
public GremlinCollection delete(@PathVariable("id") int id) {
GremlinCollection oldEntity = this.service.get(id);
if (oldEntity == null) {
throw new ExternalException("gremlin-collection.not-exist.id", id);
}
this.service.remove(id);
return oldEntity;
}
use of com.baidu.hugegraph.exception.ExternalException in project incubator-hugegraph-toolchain by apache.
the class ExecuteHistoryController method delete.
@DeleteMapping("{id}")
public ExecuteHistory delete(@PathVariable("connId") int connId, @PathVariable("id") int id) {
ExecuteHistory oldEntity = this.service.get(connId, id);
if (oldEntity == null) {
throw new ExternalException("execute-history.not-exist.id", id);
}
this.service.remove(connId, id);
return oldEntity;
}
Aggregations