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