Search in sources :

Example 6 with BatchFunction

use of com.dtstack.taier.dao.domain.BatchFunction in project Taier by DTStack.

the class BatchFunctionService method init.

/**
 * 启动服务时,就初始化系统函数到缓存中
 */
@PostConstruct
public void init() {
    Map<String, BatchFunction> batchFunctionMap = systemFunctions.getIfPresent(SYSTEM_FUNCTIONS);
    if (batchFunctionMap == null || batchFunctionMap.size() == 0) {
        List<BatchFunction> listSystemFunction = developFunctionDao.listSystemFunction(null);
        batchFunctionMap = Maps.newConcurrentMap();
        for (BatchFunction systemFunction : listSystemFunction) {
            batchFunctionMap.put(systemFunction.getName(), systemFunction);
        }
        systemFunctions.put(SYSTEM_FUNCTIONS, batchFunctionMap);
    }
    systemFunctions.put(SYSTEM_FUNCTIONS, batchFunctionMap);
}
Also used : BatchFunction(com.dtstack.taier.dao.domain.BatchFunction) PostConstruct(javax.annotation.PostConstruct)

Example 7 with BatchFunction

use of com.dtstack.taier.dao.domain.BatchFunction in project Taier by DTStack.

the class BatchFunctionService method getFunction.

/**
 * 根据id获取函数
 * @param functionId
 * @return
 */
public BatchFunctionVO getFunction(Long functionId) {
    BatchFunction batchFunction = developFunctionDao.getOne(functionId);
    if (Objects.isNull(batchFunction)) {
        return new BatchFunctionVO();
    }
    BatchFunctionVO vo = BatchFunctionVO.toVO(batchFunction);
    // 如果函数有资源,则设置函数的资源
    BatchFunctionResource resourceFunctionByFunctionId = batchFunctionResourceService.getResourceFunctionByFunctionId(batchFunction.getId());
    if (Objects.nonNull(resourceFunctionByFunctionId)) {
        vo.setResources(resourceFunctionByFunctionId.getResourceId());
    }
    vo.setCreateUser(userService.getById(batchFunction.getCreateUserId()));
    vo.setModifyUser(userService.getById(batchFunction.getModifyUserId()));
    return vo;
}
Also used : BatchFunctionVO(com.dtstack.taier.develop.dto.devlop.BatchFunctionVO) BatchFunction(com.dtstack.taier.dao.domain.BatchFunction) BatchFunctionResource(com.dtstack.taier.dao.domain.BatchFunctionResource)

Aggregations

BatchFunction (com.dtstack.taier.dao.domain.BatchFunction)7 RdosDefineException (com.dtstack.taier.common.exception.RdosDefineException)3 SqlParserImpl (com.dtstack.taier.develop.sql.SqlParserImpl)2 BatchCatalogue (com.dtstack.taier.dao.domain.BatchCatalogue)1 BatchFunctionResource (com.dtstack.taier.dao.domain.BatchFunctionResource)1 BatchResource (com.dtstack.taier.dao.domain.BatchResource)1 BatchTask (com.dtstack.taier.dao.domain.BatchTask)1 BatchCatalogueVO (com.dtstack.taier.develop.dto.devlop.BatchCatalogueVO)1 BatchFunctionVO (com.dtstack.taier.develop.dto.devlop.BatchFunctionVO)1 CatalogueVO (com.dtstack.taier.develop.dto.devlop.CatalogueVO)1 ReadWriteLockVO (com.dtstack.taier.develop.dto.devlop.ReadWriteLockVO)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 PostConstruct (javax.annotation.PostConstruct)1 Transactional (org.springframework.transaction.annotation.Transactional)1