Browse Source

添加api文档

pull/2/head
lidongdai 6 years ago
parent
commit
d9bf06d804
  1. 6
      escheduler-api/pom.xml
  2. 12
      escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java
  3. 109
      escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiImplicitParamPlugin.java
  4. 71
      escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiImplicitParamsPlugin.java
  5. 74
      escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiModelPlugin.java
  6. 219
      escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiModelPropertyPlugin.java
  7. 141
      escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiOperationPlugin.java
  8. 115
      escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiParamPlugin.java
  9. 74
      escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiPlugin.java
  10. 22
      escheduler-api/src/main/java/cn/escheduler/api/controller/AccessTokenController.java
  11. 5
      escheduler-api/src/main/java/cn/escheduler/api/controller/AlertGroupController.java
  12. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/DataAnalysisController.java
  13. 100
      escheduler-api/src/main/java/cn/escheduler/api/controller/DataSourceController.java
  14. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/ExecutorController.java
  15. 10
      escheduler-api/src/main/java/cn/escheduler/api/controller/LoggerController.java
  16. 9
      escheduler-api/src/main/java/cn/escheduler/api/controller/LoginController.java
  17. 18
      escheduler-api/src/main/java/cn/escheduler/api/controller/MonitorController.java
  18. 20
      escheduler-api/src/main/java/cn/escheduler/api/controller/ProcessDefinitionController.java
  19. 22
      escheduler-api/src/main/java/cn/escheduler/api/controller/ProcessInstanceController.java
  20. 53
      escheduler-api/src/main/java/cn/escheduler/api/controller/ProjectController.java
  21. 40
      escheduler-api/src/main/java/cn/escheduler/api/controller/QueueController.java
  22. 176
      escheduler-api/src/main/java/cn/escheduler/api/controller/ResourcesController.java
  23. 28
      escheduler-api/src/main/java/cn/escheduler/api/controller/SchedulerController.java
  24. 85
      escheduler-api/src/main/java/cn/escheduler/api/controller/ServerController.java
  25. 6
      escheduler-api/src/main/java/cn/escheduler/api/controller/TaskInstanceController.java
  26. 12
      escheduler-api/src/main/java/cn/escheduler/api/controller/TaskRecordController.java
  27. 51
      escheduler-api/src/main/java/cn/escheduler/api/controller/TenantController.java
  28. 30
      escheduler-api/src/main/java/cn/escheduler/api/controller/UsersController.java
  29. 2
      escheduler-api/src/main/java/cn/escheduler/api/controller/WorkerGroupController.java
  30. 105
      escheduler-api/src/main/resources/messages.properties
  31. 103
      escheduler-api/src/main/resources/messages_en_US.properties
  32. 93
      escheduler-api/src/main/resources/messages_zh_CN.properties

6
escheduler-api/pom.xml

@ -168,12 +168,6 @@
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>1.5.12</version>
</dependency>
</dependencies>
<build>
<plugins>

12
escheduler-api/src/main/java/cn/escheduler/api/configuration/AppConfiguration.java

@ -19,8 +19,8 @@ package cn.escheduler.api.configuration;
import cn.escheduler.api.interceptor.LoginHandlerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.i18n.CookieLocaleResolver;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
@ -49,12 +49,12 @@ public class AppConfiguration implements WebMvcConfigurer {
/**
* Cookie
*/
@Bean
@Bean(name = "localeResolver")
public LocaleResolver localeResolver() {
CookieLocaleResolver localeResolver = new CookieLocaleResolver();
localeResolver.setCookieName(LOCALE_LANGUAGE_COOKIE);
/** set default locale **/
localeResolver.setDefaultLocale(Locale.ENGLISH);
localeResolver.setDefaultLocale(Locale.US);
/** set cookie max age **/
localeResolver.setCookieMaxAge(COOKIE_MAX_AGE);
return localeResolver;
@ -64,7 +64,7 @@ public class AppConfiguration implements WebMvcConfigurer {
public LocaleChangeInterceptor localeChangeInterceptor() {
LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
/** **/
lci.setParamName("lang");
lci.setParamName("language");
return lci;
}
@ -72,14 +72,16 @@ public class AppConfiguration implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(loginInterceptor()).addPathPatterns(LOGIN_INTERCEPTOR_PATH_PATTERN).excludePathPatterns(LOGIN_PATH_PATTERN,"/swagger-resources/**", "/webjars/**", "/v2/**", "/doc.html", "*.html");
//i18n
registry.addInterceptor(localeChangeInterceptor());
registry.addInterceptor(loginInterceptor()).addPathPatterns(LOGIN_INTERCEPTOR_PATH_PATTERN).excludePathPatterns(LOGIN_PATH_PATTERN,"/swagger-resources/**", "/webjars/**", "/v2/**", "/doc.html", "*.html");
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}

109
escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiImplicitParamPlugin.java

@ -1,109 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.escheduler.api.configuration;
import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiImplicitParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.AllowableValues;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.OperationBuilderPlugin;
import springfox.documentation.spi.service.contexts.OperationContext;
import springfox.documentation.spring.web.DescriptionResolver;
import springfox.documentation.swagger.common.SwaggerPluginSupport;
import java.util.List;
import java.util.Locale;
import static com.google.common.base.Strings.emptyToNull;
import static springfox.documentation.schema.Types.isBaseType;
import static springfox.documentation.swagger.common.SwaggerPluginSupport.SWAGGER_PLUGIN_ORDER;
import static springfox.documentation.swagger.readers.parameter.Examples.examples;
import static springfox.documentation.swagger.schema.ApiModelProperties.allowableValueFromString;
@Component
@Order(Ordered.HIGHEST_PRECEDENCE - 10)
public class SwaggerApiImplicitParamPlugin implements OperationBuilderPlugin {
@Autowired
private DescriptionResolver descriptions;
@Autowired
private MessageSource messageSource;
static Parameter implicitParameter(MessageSource messageSource, DescriptionResolver descriptions, ApiImplicitParam param) {
Locale locale = LocaleContextHolder.getLocale();
ModelRef modelRef = maybeGetModelRef(param);
return new ParameterBuilder()
.name(param.name())
.description(descriptions.resolve(messageSource.getMessage(param.value(), null, locale)))
.defaultValue(param.defaultValue())
.required(param.required())
.allowMultiple(param.allowMultiple())
.modelRef(modelRef)
.allowableValues(allowableValueFromString(param.allowableValues()))
.parameterType(emptyToNull(param.paramType()))
.parameterAccess(param.access())
.order(SWAGGER_PLUGIN_ORDER)
.scalarExample(param.example())
.complexExamples(examples(param.examples()))
.build();
}
private static ModelRef maybeGetModelRef(ApiImplicitParam param) {
String dataType = MoreObjects.firstNonNull(emptyToNull(param.dataType()), "string");
AllowableValues allowableValues = null;
if (isBaseType(dataType)) {
allowableValues = allowableValueFromString(param.allowableValues());
}
if (param.allowMultiple()) {
return new ModelRef("", new ModelRef(dataType, allowableValues));
}
return new ModelRef(dataType, allowableValues);
}
@Override
public void apply(OperationContext context) {
context.operationBuilder().parameters(readParameters(context));
}
@Override
public boolean supports(DocumentationType delimiter) {
return SwaggerPluginSupport.pluginDoesApply(delimiter);
}
private List<Parameter> readParameters(OperationContext context) {
Optional<ApiImplicitParam> annotation = context.findAnnotation(ApiImplicitParam.class);
List<Parameter> parameters = Lists.newArrayList();
if (annotation.isPresent()) {
parameters.add(implicitParameter(messageSource, descriptions, annotation.get()));
}
return parameters;
}
}

71
escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiImplicitParamsPlugin.java

@ -1,71 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.escheduler.api.configuration;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.OperationBuilderPlugin;
import springfox.documentation.spi.service.contexts.OperationContext;
import springfox.documentation.spring.web.DescriptionResolver;
import java.util.List;
import static springfox.documentation.swagger.common.SwaggerPluginSupport.pluginDoesApply;
@Component
@Order(Ordered.HIGHEST_PRECEDENCE - 10)
public class SwaggerApiImplicitParamsPlugin implements OperationBuilderPlugin {
@Autowired
private DescriptionResolver descriptions;
@Autowired
private MessageSource messageSource;
@Override
public void apply(OperationContext context) {
context.operationBuilder().parameters(readParameters(context));
}
@Override
public boolean supports(DocumentationType delimiter) {
return pluginDoesApply(delimiter);
}
private List<Parameter> readParameters(OperationContext context) {
Optional<ApiImplicitParams> annotation = context.findAnnotation(ApiImplicitParams.class);
List<Parameter> parameters = Lists.newArrayList();
if (annotation.isPresent()) {
for (ApiImplicitParam param : annotation.get().value()) {
parameters.add(SwaggerApiImplicitParamPlugin.implicitParameter(messageSource, descriptions, param));
}
}
return parameters;
}
}

74
escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiModelPlugin.java

@ -1,74 +0,0 @@
package cn.escheduler.api.configuration;
import com.fasterxml.classmate.TypeResolver;
import io.swagger.annotations.ApiModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import springfox.documentation.schema.ModelReference;
import springfox.documentation.schema.TypeNameExtractor;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.schema.ModelBuilderPlugin;
import springfox.documentation.spi.schema.contexts.ModelContext;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import static springfox.documentation.schema.ResolvedTypes.*;
import static springfox.documentation.swagger.common.SwaggerPluginSupport.*;
/**
* NOTE : not useful
*/
@Component
@Order(Ordered.HIGHEST_PRECEDENCE - 10)
public class SwaggerApiModelPlugin implements ModelBuilderPlugin {
@Autowired
private TypeResolver typeResolver;
@Autowired
private TypeNameExtractor typeNameExtractor;
@Autowired
private MessageSource messageSource;
@Override
public void apply(ModelContext context) {
ApiModel annotation = AnnotationUtils.findAnnotation(forClass(context), ApiModel.class);
if (annotation != null) {
List<ModelReference> modelRefs = new ArrayList<ModelReference>();
for (Class<?> each : annotation.subTypes()) {
modelRefs.add(modelRefFactory(context, typeNameExtractor)
.apply(typeResolver.resolve(each)));
}
Locale locale = LocaleContextHolder.getLocale();
context.getBuilder()
.description(messageSource.getMessage(annotation.description(), null, locale))
.discriminator(annotation.discriminator())
.subTypes(modelRefs);
}
}
private Class<?> forClass(ModelContext context) {
return typeResolver.resolve(context.getType()).getErasedType();
}
// @Override
// public boolean supports(DocumentationType delimiter) {
// return pluginDoesApply(delimiter);
// }
@Override
public boolean supports(DocumentationType delimiter) {
return true;
}
}

219
escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiModelPropertyPlugin.java

@ -1,219 +0,0 @@
package cn.escheduler.api.configuration;
import com.fasterxml.classmate.ResolvedType;
import com.fasterxml.classmate.TypeResolver;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import springfox.documentation.service.AllowableListValues;
import springfox.documentation.service.AllowableRangeValues;
import springfox.documentation.service.AllowableValues;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.schema.ModelPropertyBuilderPlugin;
import springfox.documentation.spi.schema.contexts.ModelPropertyContext;
import springfox.documentation.spring.web.DescriptionResolver;
import springfox.documentation.swagger.common.SwaggerPluginSupport;
import springfox.documentation.swagger.schema.ApiModelProperties;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.google.common.collect.Lists.newArrayList;
import static org.springframework.util.StringUtils.hasText;
import static springfox.documentation.schema.Annotations.*;
import static springfox.documentation.swagger.schema.ApiModelProperties.*;
@Component
@Order(Ordered.HIGHEST_PRECEDENCE - 10)
public class SwaggerApiModelPropertyPlugin implements ModelPropertyBuilderPlugin {
private static final Logger LOGGER = LoggerFactory.getLogger(ApiModelProperties.class);
private static final Pattern RANGE_PATTERN = Pattern.compile("range([\\[(])(.*),(.*)([])])$");
@Autowired
private DescriptionResolver descriptions;
@Autowired
private MessageSource messageSource;
@Override
public void apply(ModelPropertyContext context) {
Optional<ApiModelProperty> annotation = Optional.absent();
if (context.getAnnotatedElement().isPresent()) {
annotation = annotation.or(findApiModePropertyAnnotation(context.getAnnotatedElement().get()));
}
if (context.getBeanPropertyDefinition().isPresent()) {
annotation = annotation.or(findPropertyAnnotation(
context.getBeanPropertyDefinition().get(),
ApiModelProperty.class));
}
if (annotation.isPresent()) {
context.getBuilder()
.allowableValues(annotation.transform(toAllowableValues()).orNull())
.required(annotation.transform(toIsRequired()).or(false))
.readOnly(annotation.transform(toIsReadOnly()).or(false))
.description(annotation.transform(toDescription(descriptions)).orNull())
.isHidden(annotation.transform(toHidden()).or(false))
.type(annotation.transform(toType(context.getResolver())).orNull())
.position(annotation.transform(toPosition()).or(0))
.example(annotation.transform(toExample()).orNull());
}
}
static Function<ApiModelProperty, AllowableValues> toAllowableValues() {
return new Function<ApiModelProperty, AllowableValues>() {
@Override
public AllowableValues apply(ApiModelProperty annotation) {
return allowableValueFromString(annotation.allowableValues());
}
};
}
public static AllowableValues allowableValueFromString(String allowableValueString) {
AllowableValues allowableValues = new AllowableListValues(Lists.<String>newArrayList(), "LIST");
String trimmed = allowableValueString.trim();
Matcher matcher = RANGE_PATTERN.matcher(trimmed.replaceAll(" ", ""));
if (matcher.matches()) {
if (matcher.groupCount() != 4) {
LOGGER.warn("Unable to parse range specified {} correctly", trimmed);
} else {
allowableValues = new AllowableRangeValues(
matcher.group(2).contains("infinity") ? null : matcher.group(2),
matcher.group(1).equals("("),
matcher.group(3).contains("infinity") ? null : matcher.group(3),
matcher.group(4).equals(")"));
}
} else if (trimmed.contains(",")) {
Iterable<String> split = Splitter.on(',').trimResults().omitEmptyStrings().split(trimmed);
allowableValues = new AllowableListValues(newArrayList(split), "LIST");
} else if (hasText(trimmed)) {
List<String> singleVal = Collections.singletonList(trimmed);
allowableValues = new AllowableListValues(singleVal, "LIST");
}
return allowableValues;
}
static Function<ApiModelProperty, Boolean> toIsRequired() {
return new Function<ApiModelProperty, Boolean>() {
@Override
public Boolean apply(ApiModelProperty annotation) {
return annotation.required();
}
};
}
static Function<ApiModelProperty, Integer> toPosition() {
return new Function<ApiModelProperty, Integer>() {
@Override
public Integer apply(ApiModelProperty annotation) {
return annotation.position();
}
};
}
static Function<ApiModelProperty, Boolean> toIsReadOnly() {
return new Function<ApiModelProperty, Boolean>() {
@Override
public Boolean apply(ApiModelProperty annotation) {
return annotation.readOnly();
}
};
}
static Function<ApiModelProperty, Boolean> toAllowEmptyValue() {
return new Function<ApiModelProperty, Boolean>() {
@Override
public Boolean apply(ApiModelProperty annotation) {
return annotation.allowEmptyValue();
}
};
}
Function<ApiModelProperty, String> toDescription(
final DescriptionResolver descriptions) {
Locale locale = LocaleContextHolder.getLocale();
return new Function<ApiModelProperty, String>() {
@Override
public String apply(ApiModelProperty annotation) {
String description = "";
if (!Strings.isNullOrEmpty(annotation.value())) {
description = messageSource.getMessage(annotation.value(), null, "" ,locale);
} else if (!Strings.isNullOrEmpty(annotation.notes())) {
description = messageSource.getMessage(annotation.notes(), null, "" ,locale);
}
return descriptions.resolve(description);
}
};
}
static Function<ApiModelProperty, ResolvedType> toType(final TypeResolver resolver) {
return new Function<ApiModelProperty, ResolvedType>() {
@Override
public ResolvedType apply(ApiModelProperty annotation) {
try {
return resolver.resolve(Class.forName(annotation.dataType()));
} catch (ClassNotFoundException e) {
return resolver.resolve(Object.class);
}
}
};
}
public static Optional<ApiModelProperty> findApiModePropertyAnnotation(AnnotatedElement annotated) {
Optional<ApiModelProperty> annotation = Optional.absent();
if (annotated instanceof Method) {
// If the annotated element is a method we can use this information to check superclasses as well
annotation = Optional.fromNullable(AnnotationUtils.findAnnotation(((Method) annotated), ApiModelProperty.class));
}
return annotation.or(Optional.fromNullable(AnnotationUtils.getAnnotation(annotated, ApiModelProperty.class)));
}
static Function<ApiModelProperty, Boolean> toHidden() {
return new Function<ApiModelProperty, Boolean>() {
@Override
public Boolean apply(ApiModelProperty annotation) {
return annotation.hidden();
}
};
}
static Function<ApiModelProperty, String> toExample() {
return new Function<ApiModelProperty, String>() {
@Override
public String apply(ApiModelProperty annotation) {
String example = "";
if (!Strings.isNullOrEmpty(annotation.example())) {
example = annotation.example();
}
return example;
}
};
}
@Override
public boolean supports(DocumentationType delimiter) {
return SwaggerPluginSupport.pluginDoesApply(delimiter);
}
}

141
escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiOperationPlugin.java

@ -1,141 +0,0 @@
package cn.escheduler.api.configuration;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Splitter;
import com.google.common.collect.Sets;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import io.swagger.annotations.ApiOperation;
import org.springframework.util.StringUtils;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.OperationBuilderPlugin;
import springfox.documentation.spi.service.contexts.OperationContext;
import springfox.documentation.spring.web.DescriptionResolver;
import springfox.documentation.spring.web.readers.operation.DefaultTagsProvider;
import springfox.documentation.swagger.common.SwaggerPluginSupport;
import static com.google.common.base.Strings.nullToEmpty;
import static com.google.common.collect.FluentIterable.from;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Sets.*;
import static springfox.documentation.service.Tags.emptyTags;
@Component
@Order(Ordered.HIGHEST_PRECEDENCE - 10)
public class SwaggerApiOperationPlugin implements OperationBuilderPlugin {
private static final Logger logger = LoggerFactory.getLogger(SwaggerApiOperationPlugin.class);
@Autowired
private DescriptionResolver descriptions;
@Autowired
private DefaultTagsProvider tagsProvider;
@Autowired
private MessageSource messageSource;
@Override
public void apply(OperationContext context) {
Locale locale = LocaleContextHolder.getLocale();
Set<String> defaultTags = tagsProvider.tags(context);
Sets.SetView<String> tags = union(operationTags(context), controllerTags(context));
if (tags.isEmpty()) {
context.operationBuilder().tags(defaultTags);
} else {
context.operationBuilder().tags(tags);
}
Optional<ApiOperation> apiOperationAnnotation = context.findAnnotation(ApiOperation.class);
if (apiOperationAnnotation.isPresent()) {
ApiOperation operation = apiOperationAnnotation.get();
if (StringUtils.hasText(operation.nickname())) {
// Populate the value of nickname annotation into uniqueId
context.operationBuilder().uniqueId(operation.nickname());
context.operationBuilder().codegenMethodNameStem(operation.nickname());
}
if (StringUtils.hasText(apiOperationAnnotation.get().notes())) {
context.operationBuilder().notes(descriptions.resolve(messageSource.getMessage(apiOperationAnnotation.get().notes(), null, "", locale)));
}
if (apiOperationAnnotation.get().position() > 0) {
context.operationBuilder().position(apiOperationAnnotation.get().position());
}
if (StringUtils.hasText(apiOperationAnnotation.get().value())) {
context.operationBuilder().summary(descriptions.resolve(apiOperationAnnotation.get().value()));
}
context.operationBuilder().consumes(asSet(nullToEmpty(apiOperationAnnotation.get().consumes())));
context.operationBuilder().produces(asSet(nullToEmpty(apiOperationAnnotation.get().produces())));
}
}
private Set<String> controllerTags(OperationContext context) {
Optional<Api> controllerAnnotation = context.findControllerAnnotation(Api.class);
return controllerAnnotation.transform(tagsFromController()).or(Sets.<String>newHashSet());
}
private Set<String> operationTags(OperationContext context) {
Optional<ApiOperation> annotation = context.findAnnotation(ApiOperation.class);
return annotation.transform(tagsFromOperation()).or(Sets.<String>newHashSet());
}
private Function<ApiOperation, Set<String>> tagsFromOperation() {
return new Function<ApiOperation, Set<String>>() {
@Override
public Set<String> apply(ApiOperation input) {
Set<String> tags = newTreeSet();
tags.addAll(from(newArrayList(input.tags())).filter(emptyTags()).toSet());
return tags;
}
};
}
private Function<Api, Set<String>> tagsFromController() {
return new Function<Api, Set<String>>() {
@Override
public Set<String> apply(Api input) {
Set<String> tags = newTreeSet();
tags.addAll(from(newArrayList(input.tags())).filter(emptyTags()).toSet());
return tags;
}
};
}
private Set<String> asSet(String mediaTypes) {
return newHashSet(Splitter.on(',')
.trimResults()
.omitEmptyStrings()
.splitToList(mediaTypes));
}
@Override
public boolean supports(DocumentationType delimiter) {
return SwaggerPluginSupport.pluginDoesApply(delimiter);
// return true;
}
}

115
escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiParamPlugin.java

@ -1,115 +0,0 @@
/*
*
* Copyright 2015-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package cn.escheduler.api.configuration;
import com.fasterxml.classmate.ResolvedType;
import com.google.common.base.Function;
import com.google.common.base.Optional;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import springfox.documentation.schema.Collections;
import springfox.documentation.schema.Enums;
import springfox.documentation.schema.Example;
import springfox.documentation.service.AllowableValues;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.schema.EnumTypeDeterminer;
import springfox.documentation.spi.service.ParameterBuilderPlugin;
import springfox.documentation.spi.service.contexts.ParameterContext;
import springfox.documentation.spring.web.DescriptionResolver;
import springfox.documentation.swagger.schema.ApiModelProperties;
import java.util.Locale;
import static com.google.common.base.Strings.emptyToNull;
import static com.google.common.base.Strings.isNullOrEmpty;
import static springfox.documentation.swagger.common.SwaggerPluginSupport.SWAGGER_PLUGIN_ORDER;
import static springfox.documentation.swagger.common.SwaggerPluginSupport.pluginDoesApply;
import static springfox.documentation.swagger.readers.parameter.Examples.examples;
@Component
@Order(Ordered.HIGHEST_PRECEDENCE - 10)
public class SwaggerApiParamPlugin implements ParameterBuilderPlugin {
@Autowired
private DescriptionResolver descriptions;
@Autowired
private EnumTypeDeterminer enumTypeDeterminer;
@Autowired
private MessageSource messageSource;
@Override
public void apply(ParameterContext context) {
Optional<ApiParam> apiParam = context.resolvedMethodParameter().findAnnotation(ApiParam.class);
context.parameterBuilder()
.allowableValues(allowableValues(
context.alternateFor(context.resolvedMethodParameter().getParameterType()),
apiParam.transform(toAllowableValue()).or("")));
if (apiParam.isPresent()) {
Locale locale = LocaleContextHolder.getLocale();
ApiParam annotation = apiParam.get();
context.parameterBuilder().name(emptyToNull(annotation.name()))
.description(emptyToNull(descriptions.resolve(messageSource.getMessage(annotation.value(), null, "",locale))))
.parameterAccess(emptyToNull(annotation.access()))
.defaultValue(emptyToNull(annotation.defaultValue()))
.allowMultiple(annotation.allowMultiple())
.allowEmptyValue(annotation.allowEmptyValue())
.required(annotation.required())
.scalarExample(new Example(annotation.example()))
.complexExamples(examples(annotation.examples()))
.hidden(annotation.hidden())
.collectionFormat(annotation.collectionFormat())
.order(SWAGGER_PLUGIN_ORDER);
}
}
private Function<ApiParam, String> toAllowableValue() {
return new Function<ApiParam, String>() {
@Override
public String apply(ApiParam input) {
return input.allowableValues();
}
};
}
private AllowableValues allowableValues(ResolvedType parameterType, String allowableValueString) {
AllowableValues allowableValues = null;
if (!isNullOrEmpty(allowableValueString)) {
allowableValues = ApiModelProperties.allowableValueFromString(allowableValueString);
} else {
if (enumTypeDeterminer.isEnum(parameterType.getErasedType())) {
allowableValues = Enums.allowableValues(parameterType.getErasedType());
}
if (Collections.isContainerType(parameterType)) {
allowableValues = Enums.allowableValues(Collections.collectionElementType(parameterType).getErasedType());
}
}
return allowableValues;
}
@Override
public boolean supports(DocumentationType delimiter) {
return pluginDoesApply(delimiter);
}
}

74
escheduler-api/src/main/java/cn/escheduler/api/configuration/SwaggerApiPlugin.java

@ -1,74 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.escheduler.api.configuration;
import io.swagger.annotations.Api;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.OperationBuilderPlugin;
import springfox.documentation.spi.service.contexts.OperationContext;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
@Component
@Order(Ordered.HIGHEST_PRECEDENCE - 10)
public class SwaggerApiPlugin implements OperationBuilderPlugin {
private static final Logger logger = LoggerFactory.getLogger(SwaggerApiPlugin.class);
@Autowired
private MessageSource messageSource;
@Override
public void apply(OperationContext context) {
Locale locale = LocaleContextHolder.getLocale();
List<Api> list = context.findAllAnnotations(Api.class);
if (list.size() > 0) {
Api api = list.get(0);
Set<String> tagsSet = new HashSet<>(1);
if(api.tags() != null && api.tags().length > 0){
tagsSet.add(StringUtils.isNotBlank(api.tags()[0]) ? messageSource.getMessage(api.tags()[0], null, locale) : " ");
}
context.operationBuilder().hidden(api.hidden())
.tags(tagsSet).build();
}
}
@Override
public boolean supports(DocumentationType delimiter) {
return true;
}
}

22
escheduler-api/src/main/java/cn/escheduler/api/controller/AccessTokenController.java

@ -23,11 +23,16 @@ import cn.escheduler.api.service.UsersService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.dao.model.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
@ -35,8 +40,9 @@ import static cn.escheduler.api.enums.Status.*;
/**
* user controller
* access token controller
*/
@Api(tags = "ACCESS_TOKEN_TAG", position = 1)
@RestController
@RequestMapping("/access-token")
public class AccessTokenController extends BaseController{
@ -53,9 +59,10 @@ public class AccessTokenController extends BaseController{
* @param loginUser
* @return
*/
@ApiIgnore
@PostMapping(value = "/create")
@ResponseStatus(HttpStatus.CREATED)
public Result createToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result createToken(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "userId") int userId,
@RequestParam(value = "expireTime") String expireTime,
@RequestParam(value = "token") String token){
@ -76,6 +83,7 @@ public class AccessTokenController extends BaseController{
* @param loginUser
* @return
*/
@ApiIgnore
@PostMapping(value = "/generate")
@ResponseStatus(HttpStatus.CREATED)
public Result generateToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ -100,9 +108,15 @@ public class AccessTokenController extends BaseController{
* @param pageSize
* @return
*/
@ApiOperation(value = "queryAccessTokenList", notes= "QUERY_ACCESS_TOKEN_LIST_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType ="String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType ="Int",example = "20")
})
@GetMapping(value="/list-paging")
@ResponseStatus(HttpStatus.OK)
public Result queryAccessTokenList(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryAccessTokenList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("pageNo") Integer pageNo,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageSize") Integer pageSize){
@ -127,6 +141,7 @@ public class AccessTokenController extends BaseController{
* @param id
* @return
*/
@ApiIgnore
@PostMapping(value = "/delete")
@ResponseStatus(HttpStatus.OK)
public Result delAccessTokenById(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ -147,6 +162,7 @@ public class AccessTokenController extends BaseController{
* @param loginUser
* @return
*/
@ApiIgnore
@PostMapping(value = "/update")
@ResponseStatus(HttpStatus.CREATED)
public Result updateToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,

5
escheduler-api/src/main/java/cn/escheduler/api/controller/AlertGroupController.java

@ -26,12 +26,17 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.HashMap;
import java.util.Map;
import static cn.escheduler.api.enums.Status.*;
/**
* alert group controller
*/
@ApiIgnore
@RestController
@RequestMapping("alert-group")
public class AlertGroupController extends BaseController{

2
escheduler-api/src/main/java/cn/escheduler/api/controller/DataAnalysisController.java

@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
@ -34,6 +35,7 @@ import static cn.escheduler.api.enums.Status.*;
/**
* data analysis controller
*/
@ApiIgnore
@RestController
@RequestMapping("projects/analysis")
public class DataAnalysisController extends BaseController{

100
escheduler-api/src/main/java/cn/escheduler/api/controller/DataSourceController.java

@ -22,11 +22,16 @@ import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.enums.DbType;
import cn.escheduler.dao.model.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
@ -36,6 +41,7 @@ import static cn.escheduler.api.enums.Status.*;
/**
* data source controller
*/
@Api(tags = "DATA_SOURCE_TAG", position = 1)
@RestController
@RequestMapping("datasources")
public class DataSourceController extends BaseController {
@ -56,9 +62,21 @@ public class DataSourceController extends BaseController {
* @param other
* @return
*/
@ApiOperation(value = "createDataSource", notes= "CREATE_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "DATA_SOURCE_NAME", required = true, dataType ="String"),
@ApiImplicitParam(name = "note", value = "DATA_SOURCE_NOTE", dataType = "String"),
@ApiImplicitParam(name = "type", value = "DB_TYPE", required = true,dataType ="DbType"),
@ApiImplicitParam(name = "host", value = "DATA_SOURCE_HOST",required = true, dataType ="String"),
@ApiImplicitParam(name = "port", value = "DATA_SOURCE_PORT",required = true, dataType ="String"),
@ApiImplicitParam(name = "database", value = "DATABASE_NAME",required = true, dataType ="String"),
@ApiImplicitParam(name = "userName", value = "USER_NAME",required = true, dataType ="String"),
@ApiImplicitParam(name = "password", value = "PASSWORD", dataType ="String"),
@ApiImplicitParam(name = "other", value = "DATA_SOURCE_OTHER", dataType ="String")
})
@PostMapping(value = "/create")
@ResponseStatus(HttpStatus.CREATED)
public Result createDataSource(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result createDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("name") String name,
@RequestParam(value = "note", required = false) String note,
@RequestParam(value = "type") DbType type,
@ -92,9 +110,22 @@ public class DataSourceController extends BaseController {
* @param other
* @return
*/
@ApiOperation(value = "updateDataSource", notes= "UPDATE_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType ="Int", example = "100"),
@ApiImplicitParam(name = "name", value = "DATA_SOURCE_NAME", required = true, dataType ="String"),
@ApiImplicitParam(name = "note", value = "DATA_SOURCE_NOTE", dataType = "String"),
@ApiImplicitParam(name = "type", value = "DB_TYPE", required = true,dataType ="DbType"),
@ApiImplicitParam(name = "host", value = "DATA_SOURCE_HOST",required = true, dataType ="String"),
@ApiImplicitParam(name = "port", value = "DATA_SOURCE_PORT",required = true, dataType ="String"),
@ApiImplicitParam(name = "database", value = "DATABASE_NAME",required = true, dataType ="String"),
@ApiImplicitParam(name = "userName", value = "USER_NAME",required = true, dataType ="String"),
@ApiImplicitParam(name = "password", value = "PASSWORD", dataType ="String"),
@ApiImplicitParam(name = "other", value = "DATA_SOURCE_OTHER", dataType ="String")
})
@PostMapping(value = "/update")
@ResponseStatus(HttpStatus.OK)
public Result updateDataSource(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result updateDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id,
@RequestParam("name") String name,
@RequestParam(value = "note", required = false) String note,
@ -126,9 +157,14 @@ public class DataSourceController extends BaseController {
* @param id
* @return
*/
@ApiOperation(value = "queryDataSource", notes= "QUERY_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType ="Int", example = "100")
})
@PostMapping(value = "/update-ui")
@ResponseStatus(HttpStatus.OK)
public Result queryDataSource(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id) {
logger.info("login user {}, query datasource: {}",
loginUser.getUserName(), id);
@ -149,9 +185,13 @@ public class DataSourceController extends BaseController {
* @param loginUser
* @return
*/
@ApiOperation(value = "queryDataSourceList", notes= "QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "DB_TYPE", required = true,dataType ="DbType")
})
@GetMapping(value = "/list")
@ResponseStatus(HttpStatus.OK)
public Result queryDataSourceList(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryDataSourceList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("type") DbType type) {
try {
Map<String, Object> result = dataSourceService.queryDataSourceList(loginUser, type.ordinal());
@ -171,9 +211,15 @@ public class DataSourceController extends BaseController {
* @param pageSize
* @return
*/
@ApiOperation(value = "queryDataSourceListPaging", notes= "QUERY_DATA_SOURCE_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType ="String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType ="Int",example = "20")
})
@GetMapping(value = "/list-paging")
@ResponseStatus(HttpStatus.OK)
public Result queryDataSourceListPaging(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryDataSourceListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize) {
@ -200,9 +246,21 @@ public class DataSourceController extends BaseController {
* @param other
* @return
*/
@ApiOperation(value = "connectDataSource", notes= "CONNECT_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "DATA_SOURCE_NAME", required = true, dataType ="String"),
@ApiImplicitParam(name = "note", value = "DATA_SOURCE_NOTE", dataType = "String"),
@ApiImplicitParam(name = "type", value = "DB_TYPE", required = true,dataType ="DbType"),
@ApiImplicitParam(name = "host", value = "DATA_SOURCE_HOST",required = true, dataType ="String"),
@ApiImplicitParam(name = "port", value = "DATA_SOURCE_PORT",required = true, dataType ="String"),
@ApiImplicitParam(name = "database", value = "DATABASE_NAME",required = true, dataType ="String"),
@ApiImplicitParam(name = "userName", value = "USER_NAME",required = true, dataType ="String"),
@ApiImplicitParam(name = "password", value = "PASSWORD", dataType ="String"),
@ApiImplicitParam(name = "other", value = "DATA_SOURCE_OTHER", dataType ="String")
})
@PostMapping(value = "/connect")
@ResponseStatus(HttpStatus.OK)
public Result connectDataSource(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result connectDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("name") String name,
@RequestParam(value = "note", required = false) String note,
@RequestParam(value = "type") DbType type,
@ -237,9 +295,13 @@ public class DataSourceController extends BaseController {
* @param loginUser
* @return
*/
@ApiOperation(value = "connectionTest", notes= "CONNECT_DATA_SOURCE_TEST_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/connect-by-id")
@ResponseStatus(HttpStatus.OK)
public Result connectionTest(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result connectionTest(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id) {
logger.info("connection test, login user:{}, id:{}", loginUser.getUserName(), id);
@ -267,9 +329,13 @@ public class DataSourceController extends BaseController {
* @param id datasource id
* @return
*/
@ApiOperation(value = "delete", notes= "DELETE_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/delete")
@ResponseStatus(HttpStatus.OK)
public Result delete(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result delete(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id) {
try {
logger.info("delete datasource,login user:{}, id:{}", loginUser.getUserName(), id);
@ -287,9 +353,13 @@ public class DataSourceController extends BaseController {
* @param name
* @return
*/
@ApiOperation(value = "verifyDataSourceName", notes= "VERIFY_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "DATA_SOURCE_NAME", required = true, dataType ="String")
})
@GetMapping(value = "/verify-name")
@ResponseStatus(HttpStatus.OK)
public Result verifyDataSourceName(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result verifyDataSourceName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "name") String name
) {
logger.info("login user {}, verfiy datasource name: {}",
@ -312,9 +382,13 @@ public class DataSourceController extends BaseController {
* @param userId
* @return
*/
@ApiOperation(value = "unauthDatasource", notes= "UNAUTHORIZED_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/unauth-datasource")
@ResponseStatus(HttpStatus.OK)
public Result unauthDatasource(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result unauthDatasource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
try {
logger.info("unauthorized datasource, login user:{}, unauthorized userId:{}",
@ -335,9 +409,13 @@ public class DataSourceController extends BaseController {
* @param userId
* @return
*/
@ApiOperation(value = "authedDatasource", notes= "AUTHORIZED_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/authed-datasource")
@ResponseStatus(HttpStatus.OK)
public Result authedDatasource(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result authedDatasource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
try {
logger.info("authorized data source, login user:{}, authorized useId:{}",

2
escheduler-api/src/main/java/cn/escheduler/api/controller/ExecutorController.java

@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
@ -39,6 +40,7 @@ import static cn.escheduler.api.enums.Status.*;
/**
* execute task controller
*/
@ApiIgnore
@RestController
@RequestMapping("projects/{projectName}/executors")
public class ExecutorController extends BaseController {

10
escheduler-api/src/main/java/cn/escheduler/api/controller/LoggerController.java

@ -57,9 +57,9 @@ public class LoggerController extends BaseController {
*/
@ApiOperation(value = "queryLog", notes= "QUERY_TASK_INSTANCE_LOG_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskInstId", value = "TASK_ID",type = "Int"),
@ApiImplicitParam(name = "skipLineNum", value = "SKIP_LINE_NUM", type ="Int"),
@ApiImplicitParam(name = "limit", value = "LIMIT", type ="Int")
@ApiImplicitParam(name = "taskInstId", value = "TASK_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "skipLineNum", value = "SKIP_LINE_NUM", dataType ="Int", example = "100"),
@ApiImplicitParam(name = "limit", value = "LIMIT", dataType ="Int", example = "100")
})
@GetMapping(value = "/detail")
@ResponseStatus(HttpStatus.OK)
@ -87,11 +87,11 @@ public class LoggerController extends BaseController {
*/
@ApiOperation(value = "downloadTaskLog", notes= "DOWNLOAD_TASK_INSTANCE_LOG_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskInstId", value = "TASK_ID",type = "Int")
@ApiImplicitParam(name = "taskInstId", value = "TASK_ID",dataType = "Int", example = "100")
})
@GetMapping(value = "/download-log")
@ResponseBody
public ResponseEntity downloadTaskLog(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public ResponseEntity downloadTaskLog(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "taskInstId") int taskInstanceId) {
try {
byte[] logBytes = loggerService.getLogBytes(taskInstanceId);

9
escheduler-api/src/main/java/cn/escheduler/api/controller/LoginController.java

@ -29,6 +29,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -36,6 +37,8 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Locale;
import static cn.escheduler.api.enums.Status.*;
/**
@ -43,9 +46,9 @@ import static cn.escheduler.api.enums.Status.*;
*
* swagger bootstrap ui docs refer : https://doc.xiaominfo.com/guide/enh-func.html
*/
@Api(tags = "LOGIN_TAG", position = 1)
@RestController
@RequestMapping("")
@Api(tags = "LOGIN_TAG", position = 1)
public class LoginController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(LoginController.class);
@ -69,8 +72,8 @@ public class LoginController extends BaseController {
*/
@ApiOperation(value = "login", notes= "LOGIN_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, type = "String"),
@ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", required = true, type ="String")
@ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", required = true, dataType ="String")
})
@PostMapping(value = "/login")
public Result login(@RequestParam(value = "userName") String userName,

18
escheduler-api/src/main/java/cn/escheduler/api/controller/MonitorController.java

@ -22,11 +22,16 @@ import cn.escheduler.api.service.ServerService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.dao.model.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
@ -36,6 +41,7 @@ import static cn.escheduler.api.enums.Status.*;
/**
* monitor controller
*/
@Api(tags = "MONITOR_TAG", position = 1)
@RestController
@RequestMapping("/monitor")
public class MonitorController extends BaseController{
@ -53,9 +59,10 @@ public class MonitorController extends BaseController{
* @param loginUser
* @return
*/
@ApiOperation(value = "listMaster", notes= "MASTER_LIST_NOTES")
@GetMapping(value = "/master/list")
@ResponseStatus(HttpStatus.OK)
public Result listMaster(@RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
public Result listMaster(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
logger.info("login user: {}, query all master", loginUser.getUserName());
try{
logger.info("list master, user:{}", loginUser.getUserName());
@ -73,9 +80,10 @@ public class MonitorController extends BaseController{
* @param loginUser
* @return
*/
@ApiOperation(value = "listWorker", notes= "WORKER_LIST_NOTES")
@GetMapping(value = "/worker/list")
@ResponseStatus(HttpStatus.OK)
public Result listWorker(@RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
public Result listWorker(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
logger.info("login user: {}, query all workers", loginUser.getUserName());
try{
Map<String, Object> result = serverService.queryWorker(loginUser);
@ -92,9 +100,10 @@ public class MonitorController extends BaseController{
* @param loginUser
* @return
*/
@ApiOperation(value = "queryDatabaseState", notes= "QUERY_DATABASE_STATE_NOTES")
@GetMapping(value = "/database")
@ResponseStatus(HttpStatus.OK)
public Result queryDatabaseState(@RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
public Result queryDatabaseState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
logger.info("login user: {}, query database state", loginUser.getUserName());
try{
@ -112,9 +121,10 @@ public class MonitorController extends BaseController{
* @param loginUser
* @return
*/
@ApiOperation(value = "queryZookeeperState", notes= "QUERY_ZOOKEEPER_STATE_NOTES")
@GetMapping(value = "/zookeeper/list")
@ResponseStatus(HttpStatus.OK)
public Result queryZookeeperState(@RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
public Result queryZookeeperState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
logger.info("login user: {}, query zookeeper state", loginUser.getUserName());
try{
Map<String, Object> result = monitorService.queryZookeeperState(loginUser);

20
escheduler-api/src/main/java/cn/escheduler/api/controller/ProcessDefinitionController.java

@ -130,7 +130,7 @@ public class ProcessDefinitionController extends BaseController{
@ApiOperation(value = "updateProccessDefinition", notes= "UPDATE_PROCCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"),
@ApiImplicitParam(name = "id", value = "PROCESS_DEFINITION_ID", required = true, type = "Int"),
@ApiImplicitParam(name = "id", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "processDefinitionJson", value = "PROCESS_DEFINITION_JSON", required = true, type ="String"),
@ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, type ="String"),
@ApiImplicitParam(name = "connects", value = "PROCESS_DEFINITION_CONNECTS", required = true, type ="String"),
@ -172,8 +172,8 @@ public class ProcessDefinitionController extends BaseController{
@ApiOperation(value = "releaseProccessDefinition", notes= "RELEASE_PROCCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, type = "String"),
@ApiImplicitParam(name = "processId", value = "PROCESS_DEFINITION_ID", required = true, type = "Int"),
@ApiImplicitParam(name = "releaseState", value = "PROCESS_DEFINITION_CONNECTS", required = true, type ="Int"),
@ApiImplicitParam(name = "processId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "releaseState", value = "PROCESS_DEFINITION_CONNECTS", required = true, dataType = "Int", example = "100"),
})
@PostMapping(value = "/release")
@ResponseStatus(HttpStatus.OK)
@ -204,7 +204,7 @@ public class ProcessDefinitionController extends BaseController{
*/
@ApiOperation(value = "queryProccessDefinitionById", notes= "QUERY_PROCCESS_DEFINITION_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processId", value = "PROCESS_DEFINITION_ID", required = true, type = "Int")
@ApiImplicitParam(name = "processId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value="/select-by-id")
@ResponseStatus(HttpStatus.OK)
@ -258,10 +258,10 @@ public class ProcessDefinitionController extends BaseController{
*/
@ApiOperation(value = "queryProcessDefinitionListPaging", notes= "QUERY_PROCCESS_DEFINITION_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, type = "Int"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", required = false, type = "String"),
@ApiImplicitParam(name = "userId", value = "USER_ID", required = false, type = "Int"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, type = "Int")
@ApiImplicitParam(name = "userId", value = "USER_ID", required = false, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100")
})
@GetMapping(value="/list-paging")
@ResponseStatus(HttpStatus.OK)
@ -296,8 +296,8 @@ public class ProcessDefinitionController extends BaseController{
*/
@ApiOperation(value = "viewTree", notes= "VIEW_TREE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processId", value = "PROCESS_DEFINITION_ID", required = true, type = "Int"),
@ApiImplicitParam(name = "limit", value = "LIMIT", required = true, type = "Int")
@ApiImplicitParam(name = "processId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100")
})
@GetMapping(value="/view-tree")
@ResponseStatus(HttpStatus.OK)
@ -327,7 +327,7 @@ public class ProcessDefinitionController extends BaseController{
*/
@ApiOperation(value = "getNodeListByDefinitionId", notes= "GET_NODE_LIST_BY_DEFINITION_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, type = "Int")
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value="gen-task-list")
@ResponseStatus(HttpStatus.OK)

22
escheduler-api/src/main/java/cn/escheduler/api/controller/ProcessInstanceController.java

@ -60,14 +60,14 @@ public class ProcessInstanceController extends BaseController{
*/
@ApiOperation(value = "queryProcessInstanceList", notes= "QUERY_PROCESS_INSTANCE_LIST_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", type = "Int"),
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type ="String"),
@ApiImplicitParam(name = "stateType", value = "EXECUTION_STATUS", type ="ExecutionStatus"),
@ApiImplicitParam(name = "host", value = "HOST", type ="String"),
@ApiImplicitParam(name = "startDate", value = "START_DATE", type ="String"),
@ApiImplicitParam(name = "endDate", value = "END_DATE", type ="String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", type ="Int"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", type ="Int")
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType = "Int", example = "100")
})
@GetMapping(value="list-paging")
@ResponseStatus(HttpStatus.OK)
@ -105,7 +105,7 @@ public class ProcessInstanceController extends BaseController{
*/
@ApiOperation(value = "queryTaskListByProcessId", notes= "QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", type = "Int")
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", dataType = "Int", example = "100")
})
@GetMapping(value="/task-list-by-process-id")
@ResponseStatus(HttpStatus.OK)
@ -139,7 +139,7 @@ public class ProcessInstanceController extends BaseController{
@ApiOperation(value = "updateProcessInstance", notes= "UPDATE_PROCESS_INSTANCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceJson", value = "PROCESS_INSTANCE_JSON", type = "String"),
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", type = "Int"),
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "scheduleTime", value = "SCHEDULE_TIME", type = "String"),
@ApiImplicitParam(name = "syncDefine", value = "SYNC_DEFINE", type = "Boolean"),
@ApiImplicitParam(name = "locations", value = "PROCESS_INSTANCE_LOCATIONS", type = "String"),
@ -182,7 +182,7 @@ public class ProcessInstanceController extends BaseController{
*/
@ApiOperation(value = "queryProcessInstanceById", notes= "QUERY_PROCESS_INSTANCE_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", type = "Int")
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", dataType = "Int", example = "100")
})
@GetMapping(value="/select-by-id")
@ResponseStatus(HttpStatus.OK)
@ -212,7 +212,7 @@ public class ProcessInstanceController extends BaseController{
*/
@ApiOperation(value = "deleteProcessInstanceById", notes= "DELETE_PROCESS_INSTANCE_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", type = "Int")
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", dataType = "Int", example = "100")
})
@GetMapping(value="/delete")
@ResponseStatus(HttpStatus.OK)
@ -241,7 +241,7 @@ public class ProcessInstanceController extends BaseController{
*/
@ApiOperation(value = "querySubProcessInstanceByTaskId", notes= "QUERY_SUBPROCESS_INSTANCE_BY_TASK_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskId", value = "TASK_ID", type = "Int")
@ApiImplicitParam(name = "taskId", value = "TASK_ID", dataType = "Int", example = "100")
})
@GetMapping(value="/select-sub-process")
@ResponseStatus(HttpStatus.OK)
@ -267,7 +267,7 @@ public class ProcessInstanceController extends BaseController{
*/
@ApiOperation(value = "queryParentInstanceBySubId", notes= "QUERY_PARENT_PROCESS_INSTANCE_BY_SUB_PROCESS_INSTANCE_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "subId", value = "SUB_PROCESS_INSTANCE_ID", type = "Int")
@ApiImplicitParam(name = "subId", value = "SUB_PROCESS_INSTANCE_ID", dataType = "Int", example = "100")
})
@GetMapping(value="/select-parent-process")
@ResponseStatus(HttpStatus.OK)
@ -292,7 +292,7 @@ public class ProcessInstanceController extends BaseController{
*/
@ApiOperation(value = "viewVariables", notes= "QUERY_PROCESS_INSTANCE_GLOBAL_VARIABLES_AND_LOCAL_VARIABLES_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", type = "Int")
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", dataType = "Int", example = "100")
})
@GetMapping(value="/view-variables")
@ResponseStatus(HttpStatus.OK)
@ -317,7 +317,7 @@ public class ProcessInstanceController extends BaseController{
*/
@ApiOperation(value = "vieGanttTree", notes= "VIEW_GANTT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", type = "Int")
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", dataType = "Int", example = "100")
})
@GetMapping(value="/view-gantt")
@ResponseStatus(HttpStatus.OK)

53
escheduler-api/src/main/java/cn/escheduler/api/controller/ProjectController.java

@ -22,11 +22,16 @@ import cn.escheduler.api.service.ProjectService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.dao.model.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
@ -35,6 +40,7 @@ import static cn.escheduler.api.enums.Status.*;
/**
* project controller
*/
@Api(tags = "PROJECT_TAG", position = 1)
@RestController
@RequestMapping("projects")
public class ProjectController extends BaseController {
@ -52,9 +58,14 @@ public class ProjectController extends BaseController {
* @param desc
* @return returns an error if it exists
*/
@ApiOperation(value = "createProject", notes= "CREATE_PROJECT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType ="String"),
@ApiImplicitParam(name = "desc", value = "PROJECT_DESC", dataType = "String")
})
@PostMapping(value = "/create")
@ResponseStatus(HttpStatus.CREATED)
public Result createProject(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result createProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectName") String projectName,
@RequestParam(value = "desc", required = false) String desc) {
@ -77,9 +88,15 @@ public class ProjectController extends BaseController {
* @param desc
* @return
*/
@ApiOperation(value = "updateProject", notes= "UPDATE_PROJECT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectId", value = "PROJECT_ID", dataType ="Int", example = "100"),
@ApiImplicitParam(name = "projectName",value = "PROJECT_NAME",dataType = "String"),
@ApiImplicitParam(name = "desc", value = "PROJECT_DESC", dataType = "String")
})
@PostMapping(value = "/update")
@ResponseStatus(HttpStatus.OK)
public Result updateProject(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result updateProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectId") Integer projectId,
@RequestParam("projectName") String projectName,
@RequestParam(value = "desc", required = false) String desc) {
@ -100,9 +117,13 @@ public class ProjectController extends BaseController {
* @param projectId
* @return
*/
@ApiOperation(value = "queryProjectById", notes= "QUERY_PROJECT_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectId", value = "PROJECT_ID", dataType ="Int", example = "100")
})
@GetMapping(value = "/query-by-id")
@ResponseStatus(HttpStatus.OK)
public Result queryProjectById(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryProjectById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectId") Integer projectId) {
logger.info("login user {}, query project by id: {}", loginUser.getUserName(), projectId);
@ -124,9 +145,15 @@ public class ProjectController extends BaseController {
* @param pageNo
* @return
*/
@ApiOperation(value = "queryProjectListPaging", notes= "QUERY_PROJECT_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType ="String"),
@ApiImplicitParam(name = "projectId", value = "PAGE_SIZE", dataType ="Int", example = "20"),
@ApiImplicitParam(name = "projectId", value = "PAGE_NO", dataType ="Int", example = "1")
})
@GetMapping(value = "/list-paging")
@ResponseStatus(HttpStatus.OK)
public Result queryProjectListPaging(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryProjectListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("pageNo") Integer pageNo
@ -149,9 +176,13 @@ public class ProjectController extends BaseController {
* @param projectId
* @return
*/
@ApiOperation(value = "deleteProjectById", notes= "DELETE_PROJECT_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectId", value = "PROJECT_ID", dataType ="Int", example = "100")
})
@GetMapping(value = "/delete")
@ResponseStatus(HttpStatus.OK)
public Result deleteProject(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result deleteProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectId") Integer projectId
) {
@ -172,9 +203,13 @@ public class ProjectController extends BaseController {
* @param userId
* @return
*/
@ApiOperation(value = "queryUnauthorizedProject", notes= "QUERY_UNAUTHORIZED_PROJECT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", dataType ="Int", example = "100")
})
@GetMapping(value = "/unauth-project")
@ResponseStatus(HttpStatus.OK)
public Result queryUnauthorizedProject(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryUnauthorizedProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
try {
logger.info("login user {}, query unauthorized project by user id: {}.", loginUser.getUserName(), userId);
@ -194,9 +229,13 @@ public class ProjectController extends BaseController {
* @param userId
* @return
*/
@ApiOperation(value = "queryAuthorizedProject", notes= "QUERY_AUTHORIZED_PROJECT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", dataType ="Int", example = "100")
})
@GetMapping(value = "/authed-project")
@ResponseStatus(HttpStatus.OK)
public Result queryAuthorizedProject(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryAuthorizedProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
try {
logger.info("login user {}, query authorized project by user id: {}.", loginUser.getUserName(), userId);

40
escheduler-api/src/main/java/cn/escheduler/api/controller/QueueController.java

@ -22,11 +22,16 @@ import cn.escheduler.api.service.QueueService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.dao.model.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
@ -36,6 +41,7 @@ import static cn.escheduler.api.enums.Status.*;
/**
* queue controller
*/
@Api(tags = "QUEUE_TAG", position = 1)
@RestController
@RequestMapping("/queue")
public class QueueController extends BaseController{
@ -51,9 +57,10 @@ public class QueueController extends BaseController{
* @param loginUser
* @return
*/
@ApiOperation(value = "queryList", notes= "QUERY_QUEUE_LIST_NOTES")
@GetMapping(value="/list")
@ResponseStatus(HttpStatus.OK)
public Result queryList(@RequestAttribute(value = Constants.SESSION_USER) User loginUser){
public Result queryList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser){
try{
logger.info("login user {}, query queue list", loginUser.getUserName());
Map<String, Object> result = queueService.queryList(loginUser);
@ -69,9 +76,15 @@ public class QueueController extends BaseController{
* @param loginUser
* @return
*/
@ApiOperation(value = "queryQueueListPaging", notes= "QUERY_QUEUE_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType ="String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType ="Int",example = "20")
})
@GetMapping(value="/list-paging")
@ResponseStatus(HttpStatus.OK)
public Result queryQueueListPaging(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryQueueListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("pageNo") Integer pageNo,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageSize") Integer pageSize){
@ -98,9 +111,14 @@ public class QueueController extends BaseController{
* @param queueName
* @return
*/
@ApiOperation(value = "createQueue", notes= "CREATE_QUEUE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true,dataType ="String"),
@ApiImplicitParam(name = "queueName", value = "QUEUE_NAME",required = true, dataType ="String")
})
@PostMapping(value = "/create")
@ResponseStatus(HttpStatus.CREATED)
public Result createQueue(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result createQueue(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "queue") String queue,
@RequestParam(value = "queueName") String queueName) {
logger.info("login user {}, create queue, queue: {}, queueName: {}",
@ -123,9 +141,15 @@ public class QueueController extends BaseController{
* @param queueName
* @return
*/
@ApiOperation(value = "updateQueue", notes= "UPDATE_QUEUE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "QUEUE_ID", required = true, dataType ="Int", example = "100"),
@ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME",required = true, dataType ="String"),
@ApiImplicitParam(name = "queueName", value = "QUEUE_NAME",required = true, dataType ="String")
})
@PostMapping(value = "/update")
@ResponseStatus(HttpStatus.CREATED)
public Result updateQueue(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result updateQueue(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id,
@RequestParam(value = "queue") String queue,
@RequestParam(value = "queueName") String queueName) {
@ -149,9 +173,15 @@ public class QueueController extends BaseController{
* @param queueName
* @return
*/
@ApiOperation(value = "verifyQueue", notes= "VERIFY_QUEUE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "QUEUE_ID", required = true, dataType ="Int", example = "100"),
@ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME",required = true, dataType ="String"),
@ApiImplicitParam(name = "queueName", value = "QUEUE_NAME",required = true, dataType ="String")
})
@PostMapping(value = "/verify-queue")
@ResponseStatus(HttpStatus.OK)
public Result verifyQueue(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result verifyQueue(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value ="queue") String queue,
@RequestParam(value ="queueName") String queueName
) {

176
escheduler-api/src/main/java/cn/escheduler/api/controller/ResourcesController.java

@ -24,6 +24,10 @@ import cn.escheduler.api.utils.Result;
import cn.escheduler.common.enums.ResourceType;
import cn.escheduler.common.enums.UdfType;
import cn.escheduler.dao.model.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -34,6 +38,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
@ -42,6 +47,7 @@ import static cn.escheduler.api.enums.Status.*;
/**
* resources controller
*/
@Api(tags = "RESOURCES_TAG", position = 1)
@RestController
@RequestMapping("resources")
public class ResourcesController extends BaseController{
@ -62,8 +68,15 @@ public class ResourcesController extends BaseController{
* @param desc
* @param file
*/
@ApiOperation(value = "createResource", notes= "CREATE_RESOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType ="ResourceType"),
@ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType ="String"),
@ApiImplicitParam(name = "des", value = "RESOURCE_DESC", dataType ="String"),
@ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile")
})
@PostMapping(value = "/create")
public Result createResource(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result createResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "type") ResourceType type,
@RequestParam(value ="name")String alias,
@RequestParam(value = "desc", required = false) String desc,
@ -85,8 +98,16 @@ public class ResourcesController extends BaseController{
* @param alias
* @param desc
*/
@ApiOperation(value = "createResource", notes= "CREATE_RESOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType ="Int", example = "100"),
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType ="ResourceType"),
@ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType ="String"),
@ApiImplicitParam(name = "des", value = "RESOURCE_DESC", dataType ="String"),
@ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true,dataType = "MultipartFile")
})
@PostMapping(value = "/update")
public Result updateResource(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result updateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value ="id") int resourceId,
@RequestParam(value = "type") ResourceType type,
@RequestParam(value ="name")String alias,
@ -107,10 +128,14 @@ public class ResourcesController extends BaseController{
* @param loginUser
* @return
*/
@ApiOperation(value = "querytResourceList", notes= "QUERY_RESOURCE_LIST_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType ="ResourceType")
})
@GetMapping(value="/list")
@ResponseStatus(HttpStatus.OK)
public Result querytResourceList(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value ="type")ResourceType type
public Result querytResourceList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value ="type") ResourceType type
){
try{
logger.info("query resource list, login user:{}, resource type:{}", loginUser.getUserName(), type.toString());
@ -130,10 +155,17 @@ public class ResourcesController extends BaseController{
* @param pageSize
* @return
*/
@ApiOperation(value = "querytResourceListPaging", notes= "QUERY_RESOURCE_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType ="ResourceType"),
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType ="String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType ="Int",example = "20")
})
@GetMapping(value="/list-paging")
@ResponseStatus(HttpStatus.OK)
public Result querytResourceListPaging(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value ="type")ResourceType type,
public Result querytResourceListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value ="type") ResourceType type,
@RequestParam("pageNo") Integer pageNo,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageSize") Integer pageSize
@ -161,9 +193,13 @@ public class ResourcesController extends BaseController{
* @param loginUser
* @param resourceId
*/
@ApiOperation(value = "deleteResource", notes= "DELETE_RESOURCE_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/delete")
@ResponseStatus(HttpStatus.OK)
public Result deleteResource(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result deleteResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value ="id") int resourceId
) {
try{
@ -185,11 +221,16 @@ public class ResourcesController extends BaseController{
* @param type
* @return
*/
@ApiOperation(value = "verifyResourceName", notes= "VERIFY_RESOURCE_NAME_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType ="ResourceType"),
@ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType ="String")
})
@GetMapping(value = "/verify-name")
@ResponseStatus(HttpStatus.OK)
public Result verifyResourceName(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result verifyResourceName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value ="name") String alias,
@RequestParam(value ="type")ResourceType type
@RequestParam(value ="type") ResourceType type
) {
try {
logger.info("login user {}, verfiy resource alias: {},resource type: {}",
@ -208,8 +249,14 @@ public class ResourcesController extends BaseController{
* @param loginUser
* @param resourceId
*/
@ApiOperation(value = "viewResource", notes= "VIEW_RESOURCE_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType ="Int", example = "100"),
@ApiImplicitParam(name = "skipLineNum", value = "SKIP_LINE_NUM", required = true, dataType ="Int", example = "100"),
@ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/view")
public Result viewResource(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result viewResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId,
@RequestParam(value = "skipLineNum") int skipLineNum,
@RequestParam(value = "limit") int limit
@ -236,8 +283,16 @@ public class ResourcesController extends BaseController{
* @param content
* @return
*/
@ApiOperation(value = "onlineCreateResource", notes= "ONLINE_CREATE_RESOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType ="ResourceType"),
@ApiImplicitParam(name = "fileName", value = "RESOURCE_NAME",required = true, dataType ="String"),
@ApiImplicitParam(name = "suffix", value = "SUFFIX", required = true, dataType ="String"),
@ApiImplicitParam(name = "des", value = "RESOURCE_DESC", dataType ="String"),
@ApiImplicitParam(name = "content", value = "CONTENT",required = true, dataType ="String")
})
@PostMapping(value = "/online-create")
public Result onlineCreateResource(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result onlineCreateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "type") ResourceType type,
@RequestParam(value ="fileName")String fileName,
@RequestParam(value ="suffix")String fileSuffix,
@ -264,8 +319,13 @@ public class ResourcesController extends BaseController{
* @param loginUser
* @param resourceId
*/
@ApiOperation(value = "updateResourceContent", notes= "UPDATE_RESOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType ="Int", example = "100"),
@ApiImplicitParam(name = "content", value = "CONTENT",required = true, dataType ="String")
})
@PostMapping(value = "/update-content")
public Result updateResourceContent(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result updateResourceContent(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId,
@RequestParam(value = "content") String content
) {
@ -289,9 +349,13 @@ public class ResourcesController extends BaseController{
* @param loginUser
* @param resourceId
*/
@ApiOperation(value = "downloadResource", notes= "DOWNLOAD_RESOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/download")
@ResponseBody
public ResponseEntity downloadResource(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public ResponseEntity downloadResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId) {
try{
logger.info("login user {}, download resource : {}",
@ -322,9 +386,20 @@ public class ResourcesController extends BaseController{
* @param resourceId
* @return
*/
@ApiOperation(value = "createUdfFunc", notes= "CREATE_UDF_FUNCTION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "UDF_TYPE", required = true, dataType ="UdfType"),
@ApiImplicitParam(name = "funcName", value = "FUNC_NAME",required = true, dataType ="String"),
@ApiImplicitParam(name = "suffix", value = "CLASS_NAME", required = true, dataType ="String"),
@ApiImplicitParam(name = "argTypes", value = "ARG_TYPES", dataType ="String"),
@ApiImplicitParam(name = "database", value = "DATABASE_NAME", dataType ="String"),
@ApiImplicitParam(name = "desc", value = "UDF_DESC", dataType ="String"),
@ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType ="Int", example = "100")
})
@PostMapping(value = "/udf-func/create")
@ResponseStatus(HttpStatus.CREATED)
public Result createUdfFunc(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result createUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "type") UdfType type,
@RequestParam(value ="funcName")String funcName,
@RequestParam(value ="className")String className,
@ -351,9 +426,14 @@ public class ResourcesController extends BaseController{
* @param id
* @return
*/
@ApiOperation(value = "viewUIUdfFunction", notes= "VIEW_UDF_FUNCTION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/udf-func/update-ui")
@ResponseStatus(HttpStatus.OK)
public Result updateUIUdfFunction(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result viewUIUdfFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id)
{
Result result = new Result();
@ -380,8 +460,19 @@ public class ResourcesController extends BaseController{
* @param resourceId
* @return
*/
@ApiOperation(value = "updateUdfFunc", notes= "UPDATE_UDF_FUNCTION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "UDF_TYPE", required = true, dataType ="UdfType"),
@ApiImplicitParam(name = "funcName", value = "FUNC_NAME",required = true, dataType ="String"),
@ApiImplicitParam(name = "suffix", value = "CLASS_NAME", required = true, dataType ="String"),
@ApiImplicitParam(name = "argTypes", value = "ARG_TYPES", dataType ="String"),
@ApiImplicitParam(name = "database", value = "DATABASE_NAME", dataType ="String"),
@ApiImplicitParam(name = "desc", value = "UDF_DESC", dataType ="String"),
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType ="Int", example = "100")
})
@PostMapping(value = "/udf-func/update")
public Result updateUdfFunc(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result updateUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int udfFuncId,
@RequestParam(value = "type") UdfType type,
@RequestParam(value ="funcName")String funcName,
@ -409,9 +500,15 @@ public class ResourcesController extends BaseController{
* @param pageSize
* @return
*/
@ApiOperation(value = "queryUdfFuncListPaging", notes= "QUERY_UDF_FUNCTION_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType ="String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType ="Int",example = "20")
})
@GetMapping(value="/udf-func/list-paging")
@ResponseStatus(HttpStatus.OK)
public Result queryUdfFuncList(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryUdfFuncList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("pageNo") Integer pageNo,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageSize") Integer pageSize
@ -433,14 +530,18 @@ public class ResourcesController extends BaseController{
}
/**
* query data resource by type
* query resource list by type
*
* @param loginUser
* @return
*/
@ApiOperation(value = "queryResourceList", notes= "QUERY_RESOURCE_LIST_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "UDF_TYPE", required = true, dataType ="UdfType")
})
@GetMapping(value="/udf-func/list")
@ResponseStatus(HttpStatus.OK)
public Result queryResourceList(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryResourceList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("type") UdfType type){
try{
logger.info("query datasource list, user:{}, type:{}", loginUser.getUserName(), type.toString());
@ -459,9 +560,14 @@ public class ResourcesController extends BaseController{
* @param name
* @return
*/
@ApiOperation(value = "verifyUdfFuncName", notes= "VERIFY_UDF_FUNCTION_NAME_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "FUNC_NAME",required = true, dataType ="String")
})
@GetMapping(value = "/udf-func/verify-name")
@ResponseStatus(HttpStatus.OK)
public Result verifyUdfFuncName(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result verifyUdfFuncName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value ="name") String name
) {
logger.info("login user {}, verfiy udf function name: {}",
@ -482,9 +588,13 @@ public class ResourcesController extends BaseController{
* @param loginUser
* @param udfFuncId
*/
@ApiOperation(value = "deleteUdfFunc", notes= "DELETE_UDF_FUNCTION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/udf-func/delete")
@ResponseStatus(HttpStatus.OK)
public Result deleteUdfFunc(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result deleteUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value ="id") int udfFuncId
) {
try{
@ -504,9 +614,13 @@ public class ResourcesController extends BaseController{
* @param userId
* @return
*/
@ApiOperation(value = "authorizedFile", notes= "AUTHORIZED_FILE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/authed-file")
@ResponseStatus(HttpStatus.CREATED)
public Result authorizedFile(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result authorizedFile(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
try{
logger.info("authorized file resource, user: {}, user id:{}", loginUser.getUserName(), userId);
@ -526,9 +640,13 @@ public class ResourcesController extends BaseController{
* @param userId
* @return
*/
@ApiOperation(value = "unauthorizedFile", notes= "UNAUTHORIZED_FILE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/unauth-file")
@ResponseStatus(HttpStatus.CREATED)
public Result unauthorizedFile(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result unauthorizedFile(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
try{
logger.info("resource unauthorized file, user:{}, unauthorized user id:{}", loginUser.getUserName(), userId);
@ -548,9 +666,13 @@ public class ResourcesController extends BaseController{
* @param userId
* @return
*/
@ApiOperation(value = "unauthUDFFunc", notes= "UNAUTHORIZED_UDF_FUNC_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/unauth-udf-func")
@ResponseStatus(HttpStatus.CREATED)
public Result unauthUDFFunc(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result unauthUDFFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
try{
logger.info("unauthorized udf function, login user:{}, unauthorized user id:{}", loginUser.getUserName(), userId);
@ -571,9 +693,13 @@ public class ResourcesController extends BaseController{
* @param userId
* @return
*/
@ApiOperation(value = "authUDFFunc", notes= "AUTHORIZED_UDF_FUNC_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType ="Int", example = "100")
})
@GetMapping(value = "/authed-udf-func")
@ResponseStatus(HttpStatus.CREATED)
public Result authorizedUDFFunction(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result authorizedUDFFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
try{
logger.info("auth udf function, login user:{}, auth user id:{}", loginUser.getUserName(), userId);

28
escheduler-api/src/main/java/cn/escheduler/api/controller/SchedulerController.java

@ -70,14 +70,14 @@ public class SchedulerController extends BaseController {
*/
@ApiOperation(value = "createSchedule", notes= "CREATE_SCHEDULE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, type = "Int"),
@ApiImplicitParam(name = "schedule", value = "SCHEDULE", type = "Int"),
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "schedule", value = "SCHEDULE", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "warningType", value = "WARNING_TYPE", type ="WarningType"),
@ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", type ="Int"),
@ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", type ="FailureStrategy"),
@ApiImplicitParam(name = "receivers", value = "RECEIVERS", type ="String"),
@ApiImplicitParam(name = "receiversCc", value = "RECEIVERS_CC", type ="String"),
@ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", type ="Int"),
@ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", type ="Priority"),
})
@PostMapping("/create")
@ -122,14 +122,14 @@ public class SchedulerController extends BaseController {
*/
@ApiOperation(value = "updateSchedule", notes= "UPDATE_SCHEDULE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, type = "Int"),
@ApiImplicitParam(name = "schedule", value = "SCHEDULE", type = "Int"),
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "schedule", value = "SCHEDULE", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "warningType", value = "WARNING_TYPE", type ="WarningType"),
@ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", type ="Int"),
@ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", type ="FailureStrategy"),
@ApiImplicitParam(name = "receivers", value = "RECEIVERS", type ="String"),
@ApiImplicitParam(name = "receiversCc", value = "RECEIVERS_CC", type ="String"),
@ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", type ="Int"),
@ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", type ="Priority"),
})
@PostMapping("/update")
@ -171,7 +171,7 @@ public class SchedulerController extends BaseController {
*/
@ApiOperation(value = "online", notes= "ONLINE_SCHEDULE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, type = "Int")
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100")
})
@PostMapping("/online")
public Result online(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ -199,7 +199,7 @@ public class SchedulerController extends BaseController {
*/
@ApiOperation(value = "offline", notes= "OFFLINE_SCHEDULE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, type = "Int")
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100")
})
@PostMapping("/offline")
public Result offline(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ -228,11 +228,11 @@ public class SchedulerController extends BaseController {
*/
@ApiOperation(value = "queryScheduleListPaging", notes= "QUERY_SCHEDULE_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, type = "Int"),
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true,type = "Int"),
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true,dataType = "Int", example = "100"),
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", type = "Int"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", type = "Int")
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType = "Int", example = "100")
})
@GetMapping("/list-paging")

85
escheduler-api/src/main/java/cn/escheduler/api/controller/ServerController.java

@ -1,85 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.escheduler.api.controller;
import cn.escheduler.api.service.ServerService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.dao.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import static cn.escheduler.api.enums.Status.LIST_MASTERS_ERROR;
import static cn.escheduler.api.enums.Status.LIST_WORKERS_ERROR;
/**
* server controller
*/
@RestController
@RequestMapping("process")
public class ServerController extends BaseController{
private static final Logger logger = LoggerFactory.getLogger(ExecutorController.class);
@Autowired
private ServerService serverService;
/**
* master list
* @param loginUser
* @return
*/
@GetMapping(value = "/master/list")
@ResponseStatus(HttpStatus.OK)
public Result listMaster(@RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
logger.info("login user: {}, query all master", loginUser.getUserName());
try{
logger.info("list master, user:{}", loginUser.getUserName());
Map<String, Object> result = serverService.queryMaster(loginUser);
return returnDataList(result);
}catch (Exception e){
logger.error(LIST_MASTERS_ERROR.getMsg(),e);
return error(LIST_MASTERS_ERROR.getCode(),
LIST_MASTERS_ERROR.getMsg());
}
}
/**
* worker list
* @param loginUser
* @return
*/
@GetMapping(value = "/worker/list")
@ResponseStatus(HttpStatus.OK)
public Result listWorker(@RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
logger.info("login user: {}, query all workers", loginUser.getUserName());
try{
Map<String, Object> result = serverService.queryWorker(loginUser);
return returnDataList(result);
}catch (Exception e){
logger.error(LIST_WORKERS_ERROR.getMsg(),e);
return error(LIST_WORKERS_ERROR.getCode(),
LIST_WORKERS_ERROR.getMsg());
}
}
}

6
escheduler-api/src/main/java/cn/escheduler/api/controller/TaskInstanceController.java

@ -56,15 +56,15 @@ public class TaskInstanceController extends BaseController{
*/
@ApiOperation(value = "queryTaskListPaging", notes= "QUERY_TASK_INSTANCE_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID",required = false, type = "Int"),
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID",required = false, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type ="String"),
@ApiImplicitParam(name = "taskName", value = "TASK_NAME", type ="String"),
@ApiImplicitParam(name = "stateType", value = "EXECUTION_STATUS", type ="ExecutionStatus"),
@ApiImplicitParam(name = "host", value = "HOST", type ="String"),
@ApiImplicitParam(name = "startDate", value = "START_DATE", type ="String"),
@ApiImplicitParam(name = "endDate", value = "END_DATE", type ="String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", type ="Int"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", type ="Int")
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType = "Int", example = "100")
})
@GetMapping("/list-paging")
@ResponseStatus(HttpStatus.OK)

12
escheduler-api/src/main/java/cn/escheduler/api/controller/TaskRecordController.java

@ -21,19 +21,25 @@ import cn.escheduler.api.service.TaskRecordService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.dao.model.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
import static cn.escheduler.api.enums.Status.QUERY_TASK_RECORD_LIST_PAGING_ERROR;
/**
* task record controller
* data quality controller
*/
@ApiIgnore
@RestController
@RequestMapping("/projects/task-record")
public class TaskRecordController extends BaseController{
@ -53,7 +59,7 @@ public class TaskRecordController extends BaseController{
*/
@GetMapping("/list-paging")
@ResponseStatus(HttpStatus.OK)
public Result queryTaskRecordListPaging(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryTaskRecordListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "taskName", required = false) String taskName,
@RequestParam(value = "state", required = false) String state,
@RequestParam(value = "sourceTable", required = false) String sourceTable,
@ -85,7 +91,7 @@ public class TaskRecordController extends BaseController{
*/
@GetMapping("/history-list-paging")
@ResponseStatus(HttpStatus.OK)
public Result queryHistoryTaskRecordListPaging(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryHistoryTaskRecordListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "taskName", required = false) String taskName,
@RequestParam(value = "state", required = false) String state,
@RequestParam(value = "sourceTable", required = false) String sourceTable,

51
escheduler-api/src/main/java/cn/escheduler/api/controller/TenantController.java

@ -22,11 +22,16 @@ import cn.escheduler.api.service.TenantService;
import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.dao.model.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
@ -36,6 +41,7 @@ import static cn.escheduler.api.enums.Status.*;
/**
* tenant controller
*/
@Api(tags = "TENANT_TAG", position = 1)
@RestController
@RequestMapping("/tenant")
public class TenantController extends BaseController{
@ -56,9 +62,17 @@ public class TenantController extends BaseController{
* @param desc
* @return
*/
@ApiOperation(value = "createTenant", notes= "CREATE_TENANT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String"),
@ApiImplicitParam(name = "tenantName", value = "TENANT_NAME", required = true, dataType ="String"),
@ApiImplicitParam(name = "queueId", value = "QUEUE_ID", required = true, dataType ="Int",example = "100"),
@ApiImplicitParam(name = "desc", value = "TENANT_DESC", dataType ="String")
})
@PostMapping(value = "/create")
@ResponseStatus(HttpStatus.CREATED)
public Result createTenant(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result createTenant(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "tenantCode") String tenantCode,
@RequestParam(value = "tenantName") String tenantName,
@RequestParam(value = "queueId") int queueId,
@ -85,9 +99,15 @@ public class TenantController extends BaseController{
* @param pageSize
* @return
*/
@ApiOperation(value = "queryTenantlistPaging", notes= "QUERY_TENANT_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType ="String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType ="Int",example = "20")
})
@GetMapping(value="/list-paging")
@ResponseStatus(HttpStatus.OK)
public Result queryTenantlistPaging(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result queryTenantlistPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("pageNo") Integer pageNo,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageSize") Integer pageSize){
@ -113,9 +133,10 @@ public class TenantController extends BaseController{
* @param loginUser
* @return
*/
@ApiOperation(value = "queryTenantlist", notes= "QUERY_TENANT_LIST_NOTES")
@GetMapping(value="/list")
@ResponseStatus(HttpStatus.OK)
public Result queryTenantlist(@RequestAttribute(value = Constants.SESSION_USER) User loginUser){
public Result queryTenantlist(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser){
logger.info("login user {}, query tenant list");
try{
Map<String, Object> result = tenantService.queryTenantList(loginUser);
@ -138,9 +159,18 @@ public class TenantController extends BaseController{
* @param desc
* @return
*/
@ApiOperation(value = "updateTenant", notes= "UPDATE_TENANT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "ID", value = "TENANT_ID", required = true, dataType ="Int", example = "100"),
@ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String"),
@ApiImplicitParam(name = "tenantName", value = "TENANT_NAME", required = true, dataType ="String"),
@ApiImplicitParam(name = "queueId", value = "QUEUE_ID", required = true, dataType ="Int", example = "100"),
@ApiImplicitParam(name = "desc", value = "TENANT_DESC", type ="String")
})
@PostMapping(value = "/update")
@ResponseStatus(HttpStatus.OK)
public Result updateTenant(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result updateTenant(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id,
@RequestParam(value = "tenantCode") String tenantCode,
@RequestParam(value = "tenantName") String tenantName,
@ -164,9 +194,14 @@ public class TenantController extends BaseController{
* @param id
* @return
*/
@ApiOperation(value = "deleteTenantById", notes= "DELETE_TENANT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "ID", value = "TENANT_ID", required = true, dataType ="Int", example = "100")
})
@PostMapping(value = "/delete")
@ResponseStatus(HttpStatus.OK)
public Result deleteTenantById(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result deleteTenantById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id) {
logger.info("login user {}, delete tenant, tenantCode: {},", loginUser.getUserName(), id);
try {
@ -186,9 +221,13 @@ public class TenantController extends BaseController{
* @param tenantCode
* @return
*/
@ApiOperation(value = "verifyTenantCode", notes= "VERIFY_TENANT_CODE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String")
})
@GetMapping(value = "/verify-tenant-code")
@ResponseStatus(HttpStatus.OK)
public Result verifyTenantCode(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
public Result verifyTenantCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value ="tenantCode") String tenantCode
) {

30
escheduler-api/src/main/java/cn/escheduler/api/controller/UsersController.java

@ -66,10 +66,10 @@ public class UsersController extends BaseController{
@ApiImplicitParams({
@ApiImplicitParam(name = "userName", value = "USER_NAME",type = "String"),
@ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", type ="String"),
@ApiImplicitParam(name = "tenantId", value = "TENANT_ID", type ="Int"),
@ApiImplicitParam(name = "queue", value = "QUEUE", type ="Int"),
@ApiImplicitParam(name = "email", value = "EMAIL", type ="Int"),
@ApiImplicitParam(name = "phone", value = "PHONE", type ="Int")
@ApiImplicitParam(name = "tenantId", value = "TENANT_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "queue", value = "QUEUE", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "email", value = "EMAIL", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "phone", value = "PHONE", dataType = "Int", example = "100")
})
@PostMapping(value = "/create")
@ResponseStatus(HttpStatus.CREATED)
@ -103,7 +103,7 @@ public class UsersController extends BaseController{
*/
@ApiOperation(value = "queryUserList", notes= "QUERY_USER_LIST_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO",type = "Int"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO",dataType = "Int", example = "100"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", type ="String"),
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type ="String")
})
@ -143,13 +143,13 @@ public class UsersController extends BaseController{
*/
@ApiOperation(value = "updateUser", notes= "UPDATE_USER_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "USER_ID",type = "Int"),
@ApiImplicitParam(name = "id", value = "USER_ID",dataType = "Int", example = "100"),
@ApiImplicitParam(name = "userName", value = "USER_NAME",type = "String"),
@ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", type ="String"),
@ApiImplicitParam(name = "tenantId", value = "TENANT_ID", type ="Int"),
@ApiImplicitParam(name = "queue", value = "QUEUE", type ="Int"),
@ApiImplicitParam(name = "email", value = "EMAIL", type ="Int"),
@ApiImplicitParam(name = "phone", value = "PHONE", type ="Int")
@ApiImplicitParam(name = "tenantId", value = "TENANT_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "queue", value = "QUEUE", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "email", value = "EMAIL", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "phone", value = "PHONE", dataType = "Int", example = "100")
})
@PostMapping(value = "/update")
@ResponseStatus(HttpStatus.OK)
@ -180,7 +180,7 @@ public class UsersController extends BaseController{
*/
@ApiOperation(value = "delUserById", notes= "DELETE_USER_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "USER_ID",type = "Int")
@ApiImplicitParam(name = "id", value = "USER_ID",dataType = "Int", example = "100")
})
@PostMapping(value = "/delete")
@ResponseStatus(HttpStatus.OK)
@ -205,7 +205,7 @@ public class UsersController extends BaseController{
*/
@ApiOperation(value = "grantProject", notes= "GRANT_PROJECT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID",type = "Int"),
@ApiImplicitParam(name = "userId", value = "USER_ID",dataType = "Int", example = "100"),
@ApiImplicitParam(name = "projectIds", value = "PROJECT_IDS",type = "String")
})
@PostMapping(value = "/grant-project")
@ -232,7 +232,7 @@ public class UsersController extends BaseController{
*/
@ApiOperation(value = "grantResource", notes= "GRANT_RESOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID",type = "Int"),
@ApiImplicitParam(name = "userId", value = "USER_ID",dataType = "Int", example = "100"),
@ApiImplicitParam(name = "resourceIds", value = "RESOURCE_IDS",type = "String")
})
@PostMapping(value = "/grant-file")
@ -260,7 +260,7 @@ public class UsersController extends BaseController{
*/
@ApiOperation(value = "grantUDFFunc", notes= "GRANT_UDF_FUNC_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID",type = "Int"),
@ApiImplicitParam(name = "userId", value = "USER_ID",dataType = "Int", example = "100"),
@ApiImplicitParam(name = "udfIds", value = "UDF_IDS",type = "String")
})
@PostMapping(value = "/grant-udf-func")
@ -289,7 +289,7 @@ public class UsersController extends BaseController{
*/
@ApiOperation(value = "grantDataSource", notes= "GRANT_DATASOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID",type = "Int"),
@ApiImplicitParam(name = "userId", value = "USER_ID",dataType = "Int", example = "100"),
@ApiImplicitParam(name = "datasourceIds", value = "DATASOURCE_IDS",type = "String")
})
@PostMapping(value = "/grant-datasource")

2
escheduler-api/src/main/java/cn/escheduler/api/controller/WorkerGroupController.java

@ -27,12 +27,14 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
/**
* worker group controller
*/
@ApiIgnore
@RestController
@RequestMapping("/worker-group")
public class WorkerGroupController extends BaseController{

105
escheduler-api/src/main/resources/messages.properties

@ -1,4 +1,86 @@
QUERY_SCHEDULE_LIST_NOTES=query schedule list
ACCESS_TOKEN_TAG=access token related operation
MONITOR_TAG=monitor related operation
MASTER_LIST_NOTES=master server list
WORKER_LIST_NOTES=worker server list
QUERY_DATABASE_STATE_NOTES=query database state
QUERY_ZOOKEEPER_STATE_NOTES=QUERY ZOOKEEPER STATE
TASK_STATE=task instance state
SOURCE_TABLE=SOURCE TABLE
DEST_TABLE=dest table
TASK_DATE=task date
QUERY_HISTORY_TASK_RECORD_LIST_PAGING_NOTES=query history task record list paging
DATA_SOURCE_TAG=data source related operation
CREATE_DATA_SOURCE_NOTES=create data source
DATA_SOURCE_NAME=data source name
DATA_SOURCE_NOTE=data source desc
DB_TYPE=database type
DATA_SOURCE_HOST=DATA SOURCE HOST
DATA_SOURCE_PORT=data source port
DATABASE_NAME=database name
QUEUE_TAG=
QUERY_QUEUE_LIST_NOTES=
QUERY_QUEUE_LIST_PAGING_NOTES=
CREATE_QUEUE_NOTES=
YARN_QUEUE_NAME=
QUEUE_ID=
TENANT_DESC=
QUERY_TENANT_LIST_PAGING_NOTES=
QUERY_TENANT_LIST_NOTES=
UPDATE_TENANT_NOTES=
DELETE_TENANT_NOTES=
RESOURCES_TAG=
CREATE_RESOURCE_NOTES=
RESOURCE_TYPE=
RESOURCE_NAME=
RESOURCE_DESC=
RESOURCE_FILE=
RESOURCE_ID=
QUERY_RESOURCE_LIST_NOTES=
DELETE_RESOURCE_BY_ID_NOTES=
VIEW_RESOURCE_BY_ID_NOTES=
ONLINE_CREATE_RESOURCE_NOTES=
SUFFIX=
CONTENT=
UPDATE_RESOURCE_NOTES=
DOWNLOAD_RESOURCE_NOTES=
CREATE_UDF_FUNCTION_NOTES=
UDF_TYPE=
FUNC_NAME=
CLASS_NAME=
ARG_TYPES=
UDF_DESC=
VIEW_UDF_FUNCTION_NOTES=
UPDATE_UDF_FUNCTION_NOTES=
QUERY_UDF_FUNCTION_LIST_PAGING_NOTES=
VERIFY_UDF_FUNCTION_NAME_NOTES=
DELETE_UDF_FUNCTION_NOTES=
AUTHORIZED_FILE_NOTES=
UNAUTHORIZED_FILE_NOTES=
AUTHORIZED_UDF_FUNC_NOTES=
UNAUTHORIZED_UDF_FUNC_NOTES=
VERIFY_QUEUE_NOTES=
TENANT_TAG=
CREATE_TENANT_NOTES=
TENANT_CODE=
TENANT_NAME=
QUEUE_NAME=
PASSWORD=password
DATA_SOURCE_OTHER=jdbc connection params, format:{"key1":"value1",...}
PROJECT_TAG=project related operation
CREATE_PROJECT_NOTES=create project
PROJECT_DESC=project description
UPDATE_PROJECT_NOTES=update project
PROJECT_ID=project id
QUERY_PROJECT_BY_ID_NOTES=query project info by project id
QUERY_PROJECT_LIST_PAGING_NOTES=QUERY PROJECT LIST PAGING
DELETE_PROJECT_BY_ID_NOTES=delete project by id
QUERY_UNAUTHORIZED_PROJECT_NOTES=query unauthorized project
QUERY_AUTHORIZED_PROJECT_NOTES=query authorized project
TASK_RECORD_TAG=task record related operation
QUERY_TASK_RECORD_LIST_PAGING_NOTES=query task record list paging
CREATE_TOKEN_NOTES=create token ,note: please login first
QUERY_ACCESS_TOKEN_LIST_NOTES=query access token list paging
SCHEDULE=schedule
WARNING_TYPE=warning type(sending strategy)
WARNING_GROUP_ID=warning group id
@ -50,16 +132,16 @@ PAGE_SIZE=page size
LIMIT=limit
VIEW_TREE_NOTES=view tree
GET_NODE_LIST_BY_DEFINITION_ID_NOTES=get task node list by process definition id
PROCESS_DEFINITION_ID_LIST=PROCESS DEFINITION ID LIST
PROCESS_DEFINITION_ID_LIST=process definition id list
QUERY_PROCESS_INSTANCE_BY_ID_NOTES=query process instance by process instance id
DELETE_PROCESS_INSTANCE_BY_ID_NOTES=delete process instance by process instance id
TASK_ID=TASK INSTANCE ID
TASK_ID=task instance id
SKIP_LINE_NUM=skip line num
QUERY_TASK_INSTANCE_LOG_NOTES=QUERY TASK INSTANCE LOG
QUERY_TASK_INSTANCE_LOG_NOTES=query task instance log
DOWNLOAD_TASK_INSTANCE_LOG_NOTES=download task instance log
USERS_TAG=users related operation
SCHEDULER_TAG=scheduler related operation
CREATE_SCHEDULE_NOTES=CREATE SCHEDULE
CREATE_SCHEDULE_NOTES=create schedule
CREATE_USER_NOTES=create user
TENANT_ID=tenant id
QUEUE=queue
@ -80,7 +162,7 @@ ALERT_GROUP_ID=alert group id
AUTHORIZED_USER_NOTES=authorized user
GRANT_UDF_FUNC_NOTES=grant udf function
UDF_IDS=udf ids(string format, multiple udf functions separated by ",")
GRANT_DATASOURCE_NOTES=GRANT DATASOURCE
GRANT_DATASOURCE_NOTES=grant datasource
DATASOURCE_IDS=datasource ids(string format, multiple datasources separated by ",")
QUERY_SUBPROCESS_INSTANCE_BY_TASK_ID_NOTES=query subprocess instance by task instance id
QUERY_PARENT_PROCESS_INSTANCE_BY_SUB_PROCESS_INSTANCE_ID_NOTES=query parent process instance info by sub process instance id
@ -95,4 +177,15 @@ EXECUTION_STATUS=runing status for workflow and task nodes
HOST=ip address of running task
START_DATE=start date
END_DATE=end date
QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES=query task list by process instance id
QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES=query task list by process instance id
UPDATE_DATA_SOURCE_NOTES=
DATA_SOURCE_ID=
QUERY_DATA_SOURCE_NOTES=
QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES=
QUERY_DATA_SOURCE_LIST_PAGING_NOTES=
CONNECT_DATA_SOURCE_NOTES=
CONNECT_DATA_SOURCE_TEST_NOTES=
DELETE_DATA_SOURCE_NOTES=
VERIFY_DATA_SOURCE_NOTES=
UNAUTHORIZED_DATA_SOURCE_NOTES=
AUTHORIZED_DATA_SOURCE_NOTES=

103
escheduler-api/src/main/resources/messages_en_US.properties

@ -1,4 +1,86 @@
QUERY_SCHEDULE_LIST_NOTES=query schedule list
ACCESS_TOKEN_TAG=access token related operation
MONITOR_TAG=monitor related operation
MASTER_LIST_NOTES=master server list
WORKER_LIST_NOTES=worker server list
QUERY_DATABASE_STATE_NOTES=query database state
QUERY_ZOOKEEPER_STATE_NOTES=QUERY ZOOKEEPER STATE
TASK_STATE=task instance state
SOURCE_TABLE=SOURCE TABLE
DEST_TABLE=dest table
TASK_DATE=task date
QUERY_HISTORY_TASK_RECORD_LIST_PAGING_NOTES=query history task record list paging
DATA_SOURCE_TAG=data source related operation
CREATE_DATA_SOURCE_NOTES=create data source
DATA_SOURCE_NAME=data source name
DATA_SOURCE_NOTE=data source desc
DB_TYPE=database type
DATA_SOURCE_HOST=DATA SOURCE HOST
DATA_SOURCE_PORT=data source port
DATABASE_NAME=database name
QUEUE_TAG=queue related operation
QUERY_QUEUE_LIST_NOTES=query queue list
QUERY_QUEUE_LIST_PAGING_NOTES=query queue list paging
CREATE_QUEUE_NOTES=create queue
YARN_QUEUE_NAME=yarn(hadoop) queue name
QUEUE_ID=queue id
TENANT_DESC=tenant desc
QUERY_TENANT_LIST_PAGING_NOTES=query tenant list paging
QUERY_TENANT_LIST_NOTES=query tenant list
UPDATE_TENANT_NOTES=update tenant
DELETE_TENANT_NOTES=delete tenant
RESOURCES_TAG=resource center related operation
CREATE_RESOURCE_NOTES=create resource
RESOURCE_TYPE=resource file type
RESOURCE_NAME=resource name
RESOURCE_DESC=resource file desc
RESOURCE_FILE=resource file
RESOURCE_ID=resource id
QUERY_RESOURCE_LIST_NOTES=query resource list
DELETE_RESOURCE_BY_ID_NOTES=delete resource by id
VIEW_RESOURCE_BY_ID_NOTES=view resource by id
ONLINE_CREATE_RESOURCE_NOTES=online create resource
SUFFIX=resource file suffix
CONTENT=resource file content
UPDATE_RESOURCE_NOTES=edit resource file online
DOWNLOAD_RESOURCE_NOTES=download resource file
CREATE_UDF_FUNCTION_NOTES=create udf function
UDF_TYPE=UDF type
FUNC_NAME=function name
CLASS_NAME=package and class name
ARG_TYPES=arguments
UDF_DESC=udf desc
VIEW_UDF_FUNCTION_NOTES=view udf function
UPDATE_UDF_FUNCTION_NOTES=update udf function
QUERY_UDF_FUNCTION_LIST_PAGING_NOTES=query udf function list paging
VERIFY_UDF_FUNCTION_NAME_NOTES=verify udf function name
DELETE_UDF_FUNCTION_NOTES=delete udf function
AUTHORIZED_FILE_NOTES=authorized file
UNAUTHORIZED_FILE_NOTES=unauthorized file
AUTHORIZED_UDF_FUNC_NOTES=authorized udf func
UNAUTHORIZED_UDF_FUNC_NOTES=unauthorized udf func
VERIFY_QUEUE_NOTES=verify queue
TENANT_TAG=tenant related operation
CREATE_TENANT_NOTES=create tenant
TENANT_CODE=tenant code
TENANT_NAME=tenant name
QUEUE_NAME=queue name
PASSWORD=password
DATA_SOURCE_OTHER=jdbc connection params, format:{"key1":"value1",...}
PROJECT_TAG=project related operation
CREATE_PROJECT_NOTES=create project
PROJECT_DESC=project description
UPDATE_PROJECT_NOTES=update project
PROJECT_ID=project id
QUERY_PROJECT_BY_ID_NOTES=query project info by project id
QUERY_PROJECT_LIST_PAGING_NOTES=QUERY PROJECT LIST PAGING
DELETE_PROJECT_BY_ID_NOTES=delete project by id
QUERY_UNAUTHORIZED_PROJECT_NOTES=query unauthorized project
QUERY_AUTHORIZED_PROJECT_NOTES=query authorized project
TASK_RECORD_TAG=task record related operation
QUERY_TASK_RECORD_LIST_PAGING_NOTES=query task record list paging
CREATE_TOKEN_NOTES=create token ,note: please login first
QUERY_ACCESS_TOKEN_LIST_NOTES=query access token list paging
SCHEDULE=schedule
WARNING_TYPE=warning type(sending strategy)
WARNING_GROUP_ID=warning group id
@ -50,16 +132,16 @@ PAGE_SIZE=page size
LIMIT=limit
VIEW_TREE_NOTES=view tree
GET_NODE_LIST_BY_DEFINITION_ID_NOTES=get task node list by process definition id
PROCESS_DEFINITION_ID_LIST=PROCESS DEFINITION ID LIST
PROCESS_DEFINITION_ID_LIST=process definition id list
QUERY_PROCESS_INSTANCE_BY_ID_NOTES=query process instance by process instance id
DELETE_PROCESS_INSTANCE_BY_ID_NOTES=delete process instance by process instance id
TASK_ID=TASK INSTANCE ID
TASK_ID=task instance id
SKIP_LINE_NUM=skip line num
QUERY_TASK_INSTANCE_LOG_NOTES=QUERY TASK INSTANCE LOG
QUERY_TASK_INSTANCE_LOG_NOTES=query task instance log
DOWNLOAD_TASK_INSTANCE_LOG_NOTES=download task instance log
USERS_TAG=users related operation
SCHEDULER_TAG=scheduler related operation
CREATE_SCHEDULE_NOTES=CREATE SCHEDULE
CREATE_SCHEDULE_NOTES=create schedule
CREATE_USER_NOTES=create user
TENANT_ID=tenant id
QUEUE=queue
@ -80,7 +162,7 @@ ALERT_GROUP_ID=alert group id
AUTHORIZED_USER_NOTES=authorized user
GRANT_UDF_FUNC_NOTES=grant udf function
UDF_IDS=udf ids(string format, multiple udf functions separated by ",")
GRANT_DATASOURCE_NOTES=GRANT DATASOURCE
GRANT_DATASOURCE_NOTES=grant datasource
DATASOURCE_IDS=datasource ids(string format, multiple datasources separated by ",")
QUERY_SUBPROCESS_INSTANCE_BY_TASK_ID_NOTES=query subprocess instance by task instance id
QUERY_PARENT_PROCESS_INSTANCE_BY_SUB_PROCESS_INSTANCE_ID_NOTES=query parent process instance info by sub process instance id
@ -96,3 +178,14 @@ HOST=ip address of running task
START_DATE=start date
END_DATE=end date
QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES=query task list by process instance id
UPDATE_DATA_SOURCE_NOTES=update data source
DATA_SOURCE_ID=DATA SOURCE ID
QUERY_DATA_SOURCE_NOTES=query data source by id
QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES=query data source list by database type
QUERY_DATA_SOURCE_LIST_PAGING_NOTES=query data source list paging
CONNECT_DATA_SOURCE_NOTES=CONNECT DATA SOURCE
CONNECT_DATA_SOURCE_TEST_NOTES=connect data source test
DELETE_DATA_SOURCE_NOTES=delete data source
VERIFY_DATA_SOURCE_NOTES=verify data source
UNAUTHORIZED_DATA_SOURCE_NOTES=unauthorized data source
AUTHORIZED_DATA_SOURCE_NOTES=authorized data source

93
escheduler-api/src/main/resources/messages_zh_CN.properties

@ -1,4 +1,86 @@
QUERY_SCHEDULE_LIST_NOTES=查询定时列表
ACCESS_TOKEN_TAG=access token相关操作,需要先登录
MONITOR_TAG=监控相关操作
MASTER_LIST_NOTES=master服务列表
WORKER_LIST_NOTES=worker服务列表
QUERY_DATABASE_STATE_NOTES=查询数据库状态
QUERY_ZOOKEEPER_STATE_NOTES=查询Zookeeper状态
TASK_STATE=任务实例状态
SOURCE_TABLE=源表
DEST_TABLE=目标表
TASK_DATE=任务时间
QUERY_HISTORY_TASK_RECORD_LIST_PAGING_NOTES=分页查询历史任务记录列表
DATA_SOURCE_TAG=数据源相关操作
CREATE_DATA_SOURCE_NOTES=创建数据源
DATA_SOURCE_NAME=数据源名称
DATA_SOURCE_NOTE=数据源描述
DB_TYPE=数据源类型
DATA_SOURCE_HOST=IP主机名
DATA_SOURCE_PORT=数据源端口
DATABASE_NAME=数据库名
QUEUE_TAG=队列相关操作
QUERY_QUEUE_LIST_NOTES=查询队列列表
QUERY_QUEUE_LIST_PAGING_NOTES=分页查询队列列表
CREATE_QUEUE_NOTES=创建队列
YARN_QUEUE_NAME=hadoop yarn队列名
QUEUE_ID=队列ID
TENANT_DESC=租户描述
QUERY_TENANT_LIST_PAGING_NOTES=分页查询租户列表
QUERY_TENANT_LIST_NOTES=查询租户列表
UPDATE_TENANT_NOTES=更新租户
DELETE_TENANT_NOTES=删除租户
RESOURCES_TAG=资源中心相关操作
CREATE_RESOURCE_NOTES=创建资源
RESOURCE_TYPE=资源文件类型
RESOURCE_NAME=资源文件名称
RESOURCE_DESC=资源文件描述
RESOURCE_FILE=资源文件
RESOURCE_ID=资源ID
QUERY_RESOURCE_LIST_NOTES=查询资源列表
DELETE_RESOURCE_BY_ID_NOTES=删除资源通过ID
VIEW_RESOURCE_BY_ID_NOTES=浏览资源通通过ID
ONLINE_CREATE_RESOURCE_NOTES=在线创建资源
SUFFIX=资源文件后缀
CONTENT=资源文件内容
UPDATE_RESOURCE_NOTES=在线更新资源文件
DOWNLOAD_RESOURCE_NOTES=下载资源文件
CREATE_UDF_FUNCTION_NOTES=创建UDF函数
UDF_TYPE=UDF类型
FUNC_NAME=函数名称
CLASS_NAME=包名类名
ARG_TYPES=参数
UDF_DESC=udf描述,使用说明
VIEW_UDF_FUNCTION_NOTES=查看udf函数
UPDATE_UDF_FUNCTION_NOTES=更新udf函数
QUERY_UDF_FUNCTION_LIST_PAGING_NOTES=分页查询udf函数列表
VERIFY_UDF_FUNCTION_NAME_NOTES=验证udf函数名
DELETE_UDF_FUNCTION_NOTES=删除UDF函数
AUTHORIZED_FILE_NOTES=授权文件
UNAUTHORIZED_FILE_NOTES=取消授权文件
AUTHORIZED_UDF_FUNC_NOTES=授权udf函数
UNAUTHORIZED_UDF_FUNC_NOTES=取消udf函数授权
VERIFY_QUEUE_NOTES=验证队列
TENANT_TAG=租户相关操作
CREATE_TENANT_NOTES=创建租户
TENANT_CODE=租户编码
TENANT_NAME=租户名称
QUEUE_NAME=队列名
PASSWORD=密码
DATA_SOURCE_OTHER=jdbc连接参数,格式为:{"key1":"value1",...}
PROJECT_TAG=项目相关操作
CREATE_PROJECT_NOTES=创建项目
PROJECT_DESC=项目描述
UPDATE_PROJECT_NOTES=更新项目
PROJECT_ID=项目ID
QUERY_PROJECT_BY_ID_NOTES=通过项目ID查询项目信息
QUERY_PROJECT_LIST_PAGING_NOTES=分页查询项目列表
DELETE_PROJECT_BY_ID_NOTES=删除项目通过ID
QUERY_UNAUTHORIZED_PROJECT_NOTES=查询未授权的项目
QUERY_AUTHORIZED_PROJECT_NOTES=查询授权项目
TASK_RECORD_TAG=任务记录相关操作
QUERY_TASK_RECORD_LIST_PAGING_NOTES=分页查询任务记录列表
CREATE_TOKEN_NOTES=创建token,注意需要先登录
QUERY_ACCESS_TOKEN_LIST_NOTES=分页查询access token列表
SCHEDULE=定时
WARNING_TYPE=发送策略
WARNING_GROUP_ID=发送组ID
@ -95,3 +177,14 @@ HOST=运行任务的主机IP地址
START_DATE=开始时间
END_DATE=结束时间
QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_NOTES=通过流程实例ID查询任务列表
UPDATE_DATA_SOURCE_NOTES=更新数据源
DATA_SOURCE_ID=数据源ID
QUERY_DATA_SOURCE_NOTES=查询数据源通过ID
QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES=查询数据源列表通过数据源类型
QUERY_DATA_SOURCE_LIST_PAGING_NOTES=分页查询数据源列表
CONNECT_DATA_SOURCE_NOTES=连接数据源
CONNECT_DATA_SOURCE_TEST_NOTES=连接数据源测试
DELETE_DATA_SOURCE_NOTES=删除数据源
VERIFY_DATA_SOURCE_NOTES=验证数据源
UNAUTHORIZED_DATA_SOURCE_NOTES=未授权的数据源
AUTHORIZED_DATA_SOURCE_NOTES=授权的数据源

Loading…
Cancel
Save