Search in sources :

Example 1 with TemplateStatisticsInputMetaResponse

use of com.webank.wedatasphere.qualitis.rule.response.TemplateStatisticsInputMetaResponse in project Qualitis by WeBankFinTech.

the class RuleTemplateServiceImpl method getModifyRuleTemplateDetail.

@Override
public RuleTemplateResponse getModifyRuleTemplateDetail(Long templateId) throws UnExpectedRequestException {
    // Check template existence
    Template templateInDb = checkRuleTemplate(templateId);
    RuleTemplateResponse response = new RuleTemplateResponse(templateInDb);
    response.setClusterNum(templateInDb.getClusterNum());
    response.setDbNum(templateInDb.getDbNum());
    response.setTableNum(templateInDb.getTableNum());
    response.setFieldNum(templateInDb.getFieldNum());
    List<TemplateDataSourceType> templateDataSourceTypes = templateDataSourceTypeDao.findByTemplate(templateInDb);
    response.setDatasourceType(templateDataSourceTypes.stream().map(TemplateDataSourceType::getDataSourceTypeId).collect(Collectors.toList()));
    response.setActionType(templateInDb.getActionType());
    response.setMidTableAction(templateInDb.getMidTableAction());
    response.setSaveMidTable(templateInDb.getSaveMidTable());
    List<TemplateOutputMetaResponse> outputMetaResponses = new ArrayList<>(1);
    List<TemplateMidTableInputMetaResponse> midTableInputMetaResponses = new ArrayList<>(2);
    List<TemplateStatisticsInputMetaResponse> statisticsInputMetaResponses = new ArrayList<>(1);
    for (TemplateOutputMeta templateOutputMeta : templateInDb.getTemplateOutputMetas()) {
        TemplateOutputMetaResponse templateOutputMetaResponse = new TemplateOutputMetaResponse();
        templateOutputMetaResponse.setOutputName(templateOutputMeta.getOutputName());
        outputMetaResponses.add(templateOutputMetaResponse);
    }
    response.setTemplateOutputMetaResponses(outputMetaResponses);
    for (TemplateMidTableInputMeta templateMidTableInputMeta : templateInDb.getTemplateMidTableInputMetas()) {
        TemplateMidTableInputMetaResponse templateMidTableInputMetaResponse = new TemplateMidTableInputMetaResponse();
        templateMidTableInputMetaResponse.setName(templateMidTableInputMeta.getName());
        templateMidTableInputMetaResponse.setPlaceholder(templateMidTableInputMeta.getPlaceholder());
        templateMidTableInputMetaResponse.setPlaceholderDescription(templateMidTableInputMeta.getPlaceholderDescription());
        templateMidTableInputMetaResponse.setInputType(templateMidTableInputMeta.getInputType());
        midTableInputMetaResponses.add(templateMidTableInputMetaResponse);
    }
    response.setTemplateMidTableInputMetaResponses(midTableInputMetaResponses);
    for (TemplateStatisticsInputMeta templateStatisticsInputMeta : templateInDb.getStatisticAction()) {
        TemplateStatisticsInputMetaResponse templateStatisticsInputMetaResponse = new TemplateStatisticsInputMetaResponse();
        templateStatisticsInputMetaResponse.setName(templateStatisticsInputMeta.getName());
        templateStatisticsInputMetaResponse.setFuncName(templateStatisticsInputMeta.getFuncName());
        templateStatisticsInputMetaResponse.setValue(templateStatisticsInputMeta.getValue());
        templateStatisticsInputMetaResponse.setValueType(templateStatisticsInputMeta.getValueType());
        statisticsInputMetaResponses.add(templateStatisticsInputMetaResponse);
    }
    response.setTemplateStatisticsInputMetaResponses(statisticsInputMetaResponses);
    return response;
}
Also used : ArrayList(java.util.ArrayList) TemplateMidTableInputMeta(com.webank.wedatasphere.qualitis.rule.entity.TemplateMidTableInputMeta) TemplateStatisticsInputMetaResponse(com.webank.wedatasphere.qualitis.rule.response.TemplateStatisticsInputMetaResponse) TemplateOutputMeta(com.webank.wedatasphere.qualitis.rule.entity.TemplateOutputMeta) Template(com.webank.wedatasphere.qualitis.rule.entity.Template) TemplateStatisticsInputMeta(com.webank.wedatasphere.qualitis.rule.entity.TemplateStatisticsInputMeta) RuleTemplateResponse(com.webank.wedatasphere.qualitis.rule.response.RuleTemplateResponse) TemplateOutputMetaResponse(com.webank.wedatasphere.qualitis.rule.response.TemplateOutputMetaResponse) TemplateMidTableInputMetaResponse(com.webank.wedatasphere.qualitis.rule.response.TemplateMidTableInputMetaResponse) TemplateDataSourceType(com.webank.wedatasphere.qualitis.rule.entity.TemplateDataSourceType)

Aggregations

Template (com.webank.wedatasphere.qualitis.rule.entity.Template)1 TemplateDataSourceType (com.webank.wedatasphere.qualitis.rule.entity.TemplateDataSourceType)1 TemplateMidTableInputMeta (com.webank.wedatasphere.qualitis.rule.entity.TemplateMidTableInputMeta)1 TemplateOutputMeta (com.webank.wedatasphere.qualitis.rule.entity.TemplateOutputMeta)1 TemplateStatisticsInputMeta (com.webank.wedatasphere.qualitis.rule.entity.TemplateStatisticsInputMeta)1 RuleTemplateResponse (com.webank.wedatasphere.qualitis.rule.response.RuleTemplateResponse)1 TemplateMidTableInputMetaResponse (com.webank.wedatasphere.qualitis.rule.response.TemplateMidTableInputMetaResponse)1 TemplateOutputMetaResponse (com.webank.wedatasphere.qualitis.rule.response.TemplateOutputMetaResponse)1 TemplateStatisticsInputMetaResponse (com.webank.wedatasphere.qualitis.rule.response.TemplateStatisticsInputMetaResponse)1 ArrayList (java.util.ArrayList)1