mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 04:27:39 +00:00
(improvement)(headless)Improve javadocs and log messages.
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package com.tencent.supersonic.common.pojo;
|
package com.tencent.supersonic.common.pojo;
|
||||||
|
|
||||||
import com.tencent.supersonic.common.service.SystemConfigService;
|
import com.tencent.supersonic.common.service.SystemConfigService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
@@ -10,7 +9,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
|
||||||
public abstract class ParameterConfig {
|
public abstract class ParameterConfig {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -19,29 +17,28 @@ public abstract class ParameterConfig {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private Environment environment;
|
private Environment environment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return system parameters to be set with user interface
|
||||||
|
*/
|
||||||
protected abstract List<Parameter> getSysParameters();
|
protected abstract List<Parameter> getSysParameters();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parameter value will be derived by following orders:
|
* Parameter value will be derived in the following order:
|
||||||
* 1. `system config` set with user interface
|
* 1. `system config` set with user interface
|
||||||
* 2. `system property` set with application.yaml
|
* 2. `system property` set with application.yaml file
|
||||||
* 3. `default value` set with parameter declaration
|
* 3. `default value` set with parameter declaration
|
||||||
* @param parameter
|
* @param parameter instance
|
||||||
* @return parameter value
|
* @return parameter value
|
||||||
*/
|
*/
|
||||||
public String getParameterValue(Parameter parameter) {
|
public String getParameterValue(Parameter parameter) {
|
||||||
String paramName = parameter.getName();
|
String paramName = parameter.getName();
|
||||||
String value = sysConfigService.getSystemConfig().getParameterByName(paramName);
|
String value = sysConfigService.getSystemConfig().getParameterByName(paramName);
|
||||||
try {
|
if (StringUtils.isBlank(value)) {
|
||||||
if (StringUtils.isBlank(value)) {
|
if (environment.containsProperty(paramName)) {
|
||||||
if (environment.containsProperty(paramName)) {
|
value = environment.getProperty(paramName);
|
||||||
value = environment.getProperty(paramName);
|
} else {
|
||||||
} else {
|
value = parameter.getDefaultValue();
|
||||||
value = parameter.getDefaultValue();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Failed to get parameter value for {} with exception: {}", paramName, e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -159,7 +159,6 @@ public abstract class BaseMapper implements SchemaMapper {
|
|||||||
}
|
}
|
||||||
SchemaElement elementDb = dataSetSchema.getElement(elementType, elementID);
|
SchemaElement elementDb = dataSetSchema.getElement(elementType, elementID);
|
||||||
if (Objects.isNull(elementDb)) {
|
if (Objects.isNull(elementDb)) {
|
||||||
log.warn("element is null, elementType:{},elementID:{}", elementType, elementID);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
BeanUtils.copyProperties(elementDb, element);
|
BeanUtils.copyProperties(elementDb, element);
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class RuleSqlParser implements SemanticParser {
|
|||||||
@Override
|
@Override
|
||||||
public void parse(QueryContext queryContext, ChatContext chatContext) {
|
public void parse(QueryContext queryContext, ChatContext chatContext) {
|
||||||
if (!queryContext.getText2SQLType().enableRule()) {
|
if (!queryContext.getText2SQLType().enableRule()) {
|
||||||
log.info("not enable rule, skip");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SchemaMapInfo mapInfo = queryContext.getMapInfo();
|
SchemaMapInfo mapInfo = queryContext.getMapInfo();
|
||||||
|
|||||||
Reference in New Issue
Block a user