Search in sources :

Example 16 with ExternalException

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);
}
Also used : JobManager(com.baidu.hugegraph.entity.load.JobManager) ExternalException(com.baidu.hugegraph.exception.ExternalException) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping)

Example 17 with ExternalException

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);
    }
}
Also used : GraphConnection(com.baidu.hugegraph.entity.GraphConnection) JobManager(com.baidu.hugegraph.entity.load.JobManager) ExternalException(com.baidu.hugegraph.exception.ExternalException) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 18 with ExternalException

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;
}
Also used : ExternalException(com.baidu.hugegraph.exception.ExternalException) GremlinCollection(com.baidu.hugegraph.entity.query.GremlinCollection) PutMapping(org.springframework.web.bind.annotation.PutMapping)

Example 19 with ExternalException

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;
}
Also used : ExternalException(com.baidu.hugegraph.exception.ExternalException) GremlinCollection(com.baidu.hugegraph.entity.query.GremlinCollection) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping)

Example 20 with ExternalException

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;
}
Also used : ExecuteHistory(com.baidu.hugegraph.entity.query.ExecuteHistory) ExternalException(com.baidu.hugegraph.exception.ExternalException) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping)

Aggregations

ExternalException (com.baidu.hugegraph.exception.ExternalException)42 HugeClient (com.baidu.hugegraph.driver.HugeClient)14 FileMapping (com.baidu.hugegraph.entity.load.FileMapping)11 ServerException (com.baidu.hugegraph.exception.ServerException)11 GraphConnection (com.baidu.hugegraph.entity.GraphConnection)9 JobManager (com.baidu.hugegraph.entity.load.JobManager)9 DeleteMapping (org.springframework.web.bind.annotation.DeleteMapping)9 IndexLabel (com.baidu.hugegraph.structure.schema.IndexLabel)8 PostMapping (org.springframework.web.bind.annotation.PostMapping)8 LoadTask (com.baidu.hugegraph.entity.load.LoadTask)5 VertexLabel (com.baidu.hugegraph.structure.schema.VertexLabel)5 PutMapping (org.springframework.web.bind.annotation.PutMapping)5 EdgeLabel (com.baidu.hugegraph.structure.schema.EdgeLabel)4 PropertyKey (com.baidu.hugegraph.structure.schema.PropertyKey)4 InternalException (com.baidu.hugegraph.exception.InternalException)3 GetMapping (org.springframework.web.bind.annotation.GetMapping)3 EdgeMapping (com.baidu.hugegraph.entity.load.EdgeMapping)2 VertexMapping (com.baidu.hugegraph.entity.load.VertexMapping)2 GremlinCollection (com.baidu.hugegraph.entity.query.GremlinCollection)2 ClientException (com.baidu.hugegraph.rest.ClientException)2