Search in sources :

Example 1 with ExtensionDataType

use of com.alibaba.otter.shared.common.model.config.data.ExtensionDataType in project otter by alibaba.

the class DataMediaPairAction method doEdit.

public void doEdit(@Param("submitKey") String submitKey, @Param("channelId") Long channelId, @FormGroup("dataMediaPairInfo") Group dataMediaPairInfo, @FormField(name = "formDataMediaPairError", group = "dataMediaPairInfo") CustomErrors err, Navigator nav) throws Exception {
    DataMediaPair dataMediaPair = new DataMediaPair();
    DataMedia sourceDataMedia = new DataMedia();
    DataMedia targetDataMedia = new DataMedia();
    dataMediaPairInfo.setProperties(dataMediaPair);
    // filter解析
    ExtensionDataType filterType = ExtensionDataType.valueOf(dataMediaPairInfo.getField("filterType").getStringValue());
    ExtensionData filterData = new ExtensionData();
    filterData.setExtensionDataType(filterType);
    if (filterType.isClazz()) {
        filterData.setClazzPath(dataMediaPairInfo.getField("filterText").getStringValue());
    } else if (filterType.isSource()) {
        filterData.setSourceText(dataMediaPairInfo.getField("filterText").getStringValue());
    }
    dataMediaPair.setFilterData(filterData);
    // fileresovler解析
    ExtensionDataType resolverType = ExtensionDataType.valueOf(dataMediaPairInfo.getField("resolverType").getStringValue());
    ExtensionData resolverData = new ExtensionData();
    resolverData.setExtensionDataType(resolverType);
    if (resolverType.isClazz()) {
        resolverData.setClazzPath(dataMediaPairInfo.getField("resolverText").getStringValue());
    } else if (resolverType.isSource()) {
        resolverData.setSourceText(dataMediaPairInfo.getField("resolverText").getStringValue());
    }
    dataMediaPair.setResolverData(resolverData);
    sourceDataMedia.setId(dataMediaPairInfo.getField("sourceDataMediaId").getLongValue());
    dataMediaPair.setSource(sourceDataMedia);
    targetDataMedia.setId(dataMediaPairInfo.getField("targetDataMediaId").getLongValue());
    dataMediaPair.setTarget(targetDataMedia);
    try {
        dataMediaPairService.modify(dataMediaPair);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidDataMediaPair");
        return;
    }
    if (submitKey.equals("保存")) {
        nav.redirectToLocation("dataMediaPairList.htm?pipelineId=" + dataMediaPair.getPipelineId());
    } else if (submitKey.equals("下一步")) {
        nav.redirectToLocation("addColumnPair.htm?pipelineId=" + dataMediaPair.getPipelineId() + "&channelId=" + channelId + "&dataMediaPairId=" + dataMediaPair.getId() + "&sourceMediaId=" + sourceDataMedia.getId() + "&targetMediaId=" + targetDataMedia.getId());
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) ExtensionDataType(com.alibaba.otter.shared.common.model.config.data.ExtensionDataType) DataMedia(com.alibaba.otter.shared.common.model.config.data.DataMedia) ExtensionData(com.alibaba.otter.shared.common.model.config.data.ExtensionData)

Example 2 with ExtensionDataType

use of com.alibaba.otter.shared.common.model.config.data.ExtensionDataType in project otter by alibaba.

the class DataMediaPairAction method doAdd.

/**
     * 添加DataMediaPair
     * 
     * @param channelInfo
     * @param channelParameterInfo
     * @throws Exception
     */
public void doAdd(@Param("submitKey") String submitKey, @FormGroup("dataMediaPairInfo") Group dataMediaPairInfo, @FormField(name = "formDataMediaPairError", group = "dataMediaPairInfo") CustomErrors err, Navigator nav) throws Exception {
    DataMediaPair dataMediaPair = new DataMediaPair();
    DataMedia sourceDataMedia = new DataMedia();
    DataMedia targetDataMedia = new DataMedia();
    dataMediaPairInfo.setProperties(dataMediaPair);
    // filter解析
    ExtensionDataType filterType = ExtensionDataType.valueOf(dataMediaPairInfo.getField("filterType").getStringValue());
    ExtensionData filterData = new ExtensionData();
    filterData.setExtensionDataType(filterType);
    if (filterType.isClazz()) {
        filterData.setClazzPath(dataMediaPairInfo.getField("filterText").getStringValue());
    } else if (filterType.isSource()) {
        filterData.setSourceText(dataMediaPairInfo.getField("filterText").getStringValue());
    }
    dataMediaPair.setFilterData(filterData);
    // fileresovler解析
    ExtensionDataType resolverType = ExtensionDataType.valueOf(dataMediaPairInfo.getField("resolverType").getStringValue());
    ExtensionData resolverData = new ExtensionData();
    resolverData.setExtensionDataType(resolverType);
    if (resolverType.isClazz()) {
        resolverData.setClazzPath(dataMediaPairInfo.getField("resolverText").getStringValue());
    } else if (resolverType.isSource()) {
        resolverData.setSourceText(dataMediaPairInfo.getField("resolverText").getStringValue());
    }
    dataMediaPair.setResolverData(resolverData);
    sourceDataMedia.setId(dataMediaPairInfo.getField("sourceDataMediaId").getLongValue());
    dataMediaPair.setSource(sourceDataMedia);
    targetDataMedia.setId(dataMediaPairInfo.getField("targetDataMediaId").getLongValue());
    dataMediaPair.setTarget(targetDataMedia);
    Long id = 0L;
    try {
        id = dataMediaPairService.createAndReturnId(dataMediaPair);
    } catch (RepeatConfigureException rce) {
        err.setMessage("invalidDataMediaPair");
        return;
    }
    if (submitKey.equals("保存")) {
        nav.redirectToLocation("dataMediaPairList.htm?pipelineId=" + dataMediaPair.getPipelineId());
    } else if (submitKey.equals("下一步")) {
        nav.redirectToLocation("addColumnPair.htm?dataMediaPairId=" + id + "&pipelineId=" + dataMediaPair.getPipelineId() + "&dataMediaPairId=" + id + "&sourceMediaId=" + sourceDataMedia.getId() + "&targetMediaId=" + targetDataMedia.getId());
    }
}
Also used : RepeatConfigureException(com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException) DataMediaPair(com.alibaba.otter.shared.common.model.config.data.DataMediaPair) ExtensionDataType(com.alibaba.otter.shared.common.model.config.data.ExtensionDataType) DataMedia(com.alibaba.otter.shared.common.model.config.data.DataMedia) ExtensionData(com.alibaba.otter.shared.common.model.config.data.ExtensionData)

Aggregations

RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)2 DataMedia (com.alibaba.otter.shared.common.model.config.data.DataMedia)2 DataMediaPair (com.alibaba.otter.shared.common.model.config.data.DataMediaPair)2 ExtensionData (com.alibaba.otter.shared.common.model.config.data.ExtensionData)2 ExtensionDataType (com.alibaba.otter.shared.common.model.config.data.ExtensionDataType)2