Browse Source

add verify queue_name

pull/1/MERGE
ligang 6 years ago
parent
commit
30a63a05aa
  1. 3
      escheduler-api/src/main/java/cn/escheduler/api/enums/Status.java
  2. 24
      escheduler-api/src/main/java/cn/escheduler/api/service/QueueService.java

3
escheduler-api/src/main/java/cn/escheduler/api/enums/Status.java

@ -152,7 +152,8 @@ public enum Status {
CREATE_QUEUE_ERROR(10127, "create queue error"),
QUEUE_NOT_EXIST(10128, "queue {0} not exists"),
QUEUE_EXIST(10129, "queue already exists"),
UPDATE_QUEUE_ERROR(10130, "update queue error"),
QUEUE_NAME_EXIST(10130, "queue name already exists"),
UPDATE_QUEUE_ERROR(10131, "update queue error"),
UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found"),

24
escheduler-api/src/main/java/cn/escheduler/api/service/QueueService.java

@ -62,6 +62,7 @@ public class QueueService extends BaseService{
/**
* query queue list paging
*
* @param loginUser
* @param searchVal
* @param pageNo
@ -88,6 +89,14 @@ public class QueueService extends BaseService{
return result;
}
/**
* create queue
*
* @param loginUser
* @param queue
* @param queueName
* @return
*/
public Map<String, Object> createQueue(User loginUser, String queue, String queueName) {
Map<String, Object> result = new HashMap<>(5);
if (checkAdmin(loginUser, result)) {
@ -99,6 +108,11 @@ public class QueueService extends BaseService{
return result;
}
if (checkQueueExists(queueName)) {
putMsg(result, Status.QUEUE_NAME_EXIST, queueName);
return result;
}
Queue queueObj = new Queue();
Date now = new Date();
@ -113,6 +127,15 @@ public class QueueService extends BaseService{
return result;
}
/**
* update queue
*
* @param loginUser
* @param id
* @param queue
* @param queueName
* @return
*/
public Map<String, Object> updateQueue(User loginUser, int id, String queue, String queueName) {
Map<String, Object> result = new HashMap<>(5);
if (checkAdmin(loginUser, result)) {
@ -120,7 +143,6 @@ public class QueueService extends BaseService{
}
Queue queueObj = queueMapper.queryById(id);
if (queueObj == null) {
putMsg(result, Status.QUEUE_NOT_EXIST, id);

Loading…
Cancel
Save