use of com.dtstack.taier.dao.domain.Dict in project Taier by DTStack.
the class ScheduleDictService method convertVersionNameToValue.
public String convertVersionNameToValue(String componentVersion, Integer taskType) {
if (StringUtils.isBlank(componentVersion)) {
return "";
}
EScheduleJobType scheduleJobType = EScheduleJobType.getByTaskType(taskType);
EComponentType componentType = scheduleJobType.getComponentType();
Integer dictType = DictType.getByEComponentType(componentType);
if (null != dictType) {
Dict versionDict = getByNameAndValue(dictType, componentVersion.trim(), null, null);
if (null != versionDict) {
return versionDict.getDictValue();
}
}
return "";
}
use of com.dtstack.taier.dao.domain.Dict in project Taier by DTStack.
the class ScheduleDictService method getHadoopVersion.
private List<ClientTemplate> getHadoopVersion() {
List<Dict> dicts = dictMapper.listDictByType(DictType.HADOOP_VERSION.type);
Map<String, List<Dict>> versions = dicts.stream().collect(Collectors.groupingBy(Dict::getDependName));
List<ClientTemplate> clientTemplates = new ArrayList<>(versions.size());
for (String dependName : versions.keySet()) {
List<Dict> keyDicts = versions.get(dependName);
keyDicts = keyDicts.stream().sorted(Comparator.comparing(Dict::getSort)).collect(Collectors.toList());
List<ClientTemplate> templates = keyDicts.stream().map(s -> new ClientTemplate(s.getDictName(), s.getDictValue())).collect(Collectors.toList());
ClientTemplate vendorFolder = new ClientTemplate();
vendorFolder.setKey(dependName);
vendorFolder.setValues(templates);
clientTemplates.add(vendorFolder);
}
clientTemplates.sort(Comparator.comparing(ClientTemplate::getKey));
return clientTemplates;
}
use of com.dtstack.taier.dao.domain.Dict in project Taier by DTStack.
the class BatchCatalogueService method initEngineCatalogue.
/**
* 初始化函数相关的二级菜单,系统函数目录 和 自定义函数目录
* @param tenantId
* @param userId
* @param name
* @param oneBatchCatalogue
*/
private void initEngineCatalogue(Long tenantId, Long userId, String name, BatchCatalogue oneBatchCatalogue) {
// 一级菜单初始化的时候 函数管理的一级菜单为引擎 原有的一级菜单 系统函数 自定义函数 挂在引擎下 作为二级菜单
if (isNeedFunction(name)) {
// 离线需要初始化的函数目录
List<Dict> batchFunctionDictList = dictService.listByDictType(DictType.DATA_DEVELOP_FUNCTION);
if (CollectionUtils.isNotEmpty(batchFunctionDictList)) {
for (Dict functionDict : batchFunctionDictList) {
// 需要 系统函数、自定义函数 挂在当前目录下
BatchCatalogue twoBatchCatalogue = new BatchCatalogue();
twoBatchCatalogue.setNodeName(functionDict.getDictDesc());
twoBatchCatalogue.setLevel(CatalogueLevel.SECOND.getLevel());
twoBatchCatalogue.setNodePid(oneBatchCatalogue.getId());
twoBatchCatalogue.setTenantId(tenantId);
twoBatchCatalogue.setCreateUserId(userId);
twoBatchCatalogue.setCatalogueType(RdosBatchCatalogueTypeEnum.NORAML.getType());
addOrUpdate(twoBatchCatalogue);
}
}
}
}
use of com.dtstack.taier.dao.domain.Dict in project Taier by DTStack.
the class BatchCatalogueService method initCatalogue.
/**
* 绑定租户时,初始化目录信息
* @param tenantId
* @param userId
* @param componentVOS 根据控制台配置的组件信息,初始化相应的目录
*/
@Transactional(rollbackFor = Exception.class)
public void initCatalogue(Long tenantId, Long userId, List<ComponentVO> componentVOS) {
// 离线各模块的 0 级目录,任务管理、函数管理、资源管理
List<Dict> zeroBatchCatalogueDictList = dictService.listByDictType(DictType.DATA_DEVELOP_CATALOGUE);
List<Integer> componentTypes = componentVOS.stream().map(ComponentVO::getComponentTypeCode).collect(Collectors.toList());
// 根据控制台配置的组件信息,获取需要初始化的 1 级目录,任务开发、SparkSQL、资源管理 等
List<Dict> oneBatchCatalogueDictList = this.initCatalogueDictLevelByEngineType(componentTypes);
Map<String, Set<String>> oneCatalogueValueAndNameMapping = oneBatchCatalogueDictList.stream().collect(Collectors.groupingBy(Dict::getDictValue, Collectors.mapping(Dict::getDictDesc, Collectors.toSet())));
for (Dict zeroDict : zeroBatchCatalogueDictList) {
// 初始化 0 级目录
BatchCatalogue zeroBatchCatalogue = new BatchCatalogue();
zeroBatchCatalogue.setNodeName(zeroDict.getDictDesc());
zeroBatchCatalogue.setNodePid(DEFAULT_NODE_PID);
zeroBatchCatalogue.setOrderVal(zeroDict.getSort());
zeroBatchCatalogue.setLevel(CatalogueLevel.ONE.getLevel());
zeroBatchCatalogue.setTenantId(tenantId);
zeroBatchCatalogue.setCreateUserId(userId);
zeroBatchCatalogue.setCatalogueType(RdosBatchCatalogueTypeEnum.NORAML.getType());
zeroBatchCatalogue = addOrUpdate(zeroBatchCatalogue);
if (CollectionUtils.isNotEmpty(oneCatalogueValueAndNameMapping.get(zeroDict.getDictValue()))) {
for (String oneCatalogueName : oneCatalogueValueAndNameMapping.get(zeroDict.getDictValue())) {
// 初始化 1 级目录
BatchCatalogue oneBatchCatalogue = new BatchCatalogue();
oneBatchCatalogue.setNodeName(oneCatalogueName);
oneBatchCatalogue.setLevel(CatalogueLevel.SECOND.getLevel());
oneBatchCatalogue.setNodePid(zeroBatchCatalogue.getId());
oneBatchCatalogue.setTenantId(tenantId);
oneBatchCatalogue.setCreateUserId(userId);
oneBatchCatalogue.setCatalogueType(RdosBatchCatalogueTypeEnum.NORAML.getType());
addOrUpdate(oneBatchCatalogue);
if (TASK_DEVELOPE.equals(oneCatalogueName)) {
// 初始化任务模版
initTemplateCatalogue(oneBatchCatalogue, tenantId, userId);
}
this.initEngineCatalogue(tenantId, userId, oneCatalogueName, oneBatchCatalogue);
}
}
}
}
use of com.dtstack.taier.dao.domain.Dict in project Taier by DTStack.
the class ComponentService method buildHdfsTypeName.
public String buildHdfsTypeName(Long tenantId, Long clusterId) {
if (null == clusterId) {
clusterId = clusterTenantMapper.getClusterIdByTenantId(tenantId);
}
Component component = getComponentByClusterId(clusterId, EComponentType.HDFS.getTypeCode(), null);
if (null == component || StringUtils.isBlank(component.getVersionName())) {
return "hdfs2";
}
String versionName = component.getVersionName();
List<Dict> dicts = scheduleDictService.listByDictType(DictType.HDFS_TYPE_NAME);
Optional<Dict> dbTypeNames = dicts.stream().filter(dict -> dict.getDictName().equals(versionName.trim())).findFirst();
if (dbTypeNames.isPresent()) {
return dbTypeNames.get().getDictValue();
}
String hadoopVersion = component.getVersionValue();
if (StringUtils.isBlank(hadoopVersion)) {
return "hdfs2";
}
return EComponentType.HDFS.name().toLowerCase() + hadoopVersion.charAt(0);
}
Aggregations