Package com.alibaba.otter.shared.common.model.config.data

Examples of com.alibaba.otter.shared.common.model.config.data.DataMatrix


    /**
     * 用于DO对象转化为Model对象
     */
    private DataMatrix doToModel(DataMatrixDO matrixDo) {
        DataMatrix matrix = new DataMatrix();
        try {
            matrix.setId(matrixDo.getId());
            matrix.setGroupKey(matrixDo.getGroupKey());
            matrix.setDescription(matrixDo.getDescription());
            matrix.setMaster(matrixDo.getMaster());
            matrix.setSlave(matrixDo.getSlave());
            matrix.setGmtCreate(matrixDo.getGmtCreate());
            matrix.setGmtModified(matrixDo.getGmtModified());
        } catch (Exception e) {
            logger.error("ERROR ## change the canal Do to Model has an exception");
            throw new ManagerException(e);
        }

View Full Code Here


    }

    public String onFindMedia(FindMediaEvent event) {
        Assert.notNull(event);
        Assert.notNull(event.getDataId());
        DataMatrix matrix = dataMatrixService.findByGroupKey(event.getDataId());
        return JsonUtils.marshalToString(matrix);
    }
View Full Code Here

        condition.put("offset", paginator.getOffset());
        condition.put("length", paginator.getLength());
        List<DataMatrix> matrixs = new ArrayList<DataMatrix>();
        if ((null != matrixId) && (matrixId != 0l)) {
            DataMatrix matrix = dataMatrixService.findById(matrixId);
            matrixs.add(matrix);
            paginator.setItems(1);
            paginator.setPage(0);
            searchKey = String.valueOf(matrixId); // 定义为新的searchKey
        } else if (StringUtils.isNotEmpty(groupKey)) {
            DataMatrix matrix = dataMatrixService.findByGroupKey(groupKey);
            matrixs.add(matrix);
            paginator.setItems(1);
            paginator.setPage(0);
            searchKey = String.valueOf(groupKey); // 定义为新的searchKey
        } else {
            matrixs = dataMatrixService.listByCondition(condition);
        }

        List<SeniorDataMatrix> seniorMatrixs = new ArrayList<SeniorDataMatrix>();
        for (DataMatrix matrix : matrixs) {
            SeniorDataMatrix seniorMatrix = new SeniorDataMatrix();
            seniorMatrix.setId(matrix.getId());
            seniorMatrix.setGroupKey(matrix.getGroupKey());
            seniorMatrix.setMaster(matrix.getMaster());
            seniorMatrix.setSlave(matrix.getSlave());
            seniorMatrix.setGmtCreate(matrix.getGmtCreate());
            seniorMatrix.setGmtModified(matrix.getGmtModified());

            Map dataSourceCondition = new HashMap();
            condition.put("searchKey", "jdbc:mysql://groupKey=" + matrix.getGroupKey());
            List<DataMediaSource> dataSources = dataMediaSourceService.listByCondition(dataSourceCondition);
            seniorMatrix.setUsed(!CollectionUtils.isEmpty(dataSources));

            seniorMatrixs.add(seniorMatrix);
        }
View Full Code Here

    @Resource(name = "dataMediaSourceService")
    private DataMediaSourceService dataMediaSourceService;

    public void execute(@Param("matrixId") Long matrixId, Context context) throws Exception {
        DataMatrix matrix = dataMatrixService.findById(matrixId);

        Map condition = new HashMap();
        condition.put("searchKey", "jdbc:mysql://groupKey=" + matrix.getGroupKey());
        List<DataMediaSource> dataSources = dataMediaSourceService.listByCondition(condition);

        context.put("dataMatrix", matrix);
        context.put("dataSources", dataSources);
    }
View Full Code Here

    /**
     * @param context
     * @throws WebxException
     */
    public void execute(@Param("matrixId") Long matrixId, Context context) throws Exception {
        DataMatrix matrix = dataMatrixService.findById(matrixId);
        context.put("dataMatrix", matrix);
    }
View Full Code Here

    private DataMatrixService dataMatrixService;

    public void doAdd(@FormGroup("dataMatrixInfo") Group dataMatrixInfo,
                      @FormField(name = "formDataMatrixError", group = "dataMatrixInfo") CustomErrors err, Navigator nav)
                                                                                                                         throws Exception {
        DataMatrix matrix = new DataMatrix();
        dataMatrixInfo.setProperties(matrix);

        try {
            dataMatrixService.create(matrix);
        } catch (RepeatConfigureException rce) {
View Full Code Here

    }

    public void doEdit(@FormGroup("dataMatrixInfo") Group dataMatrixInfo,
                       @FormField(name = "formDataMatrixError", group = "dataMatrixInfo") CustomErrors err,
                       Navigator nav) throws Exception {
        DataMatrix matrix = new DataMatrix();
        dataMatrixInfo.setProperties(matrix);

        try {
            dataMatrixService.modify(matrix);
        } catch (RepeatConfigureException rce) {
            err.setMessage("invalidDataMatrix");
            return;
        }

        nav.redirectToLocation("dataMatrixList.htm?matrixId=" + matrix.getId());
    }
View Full Code Here

        dataMatrixService.remove(matrixId);
        nav.redirectToLocation("dataMatrixList.htm");
    }

    public void doSwitch(@Param("matrixId") Long matrixId, Navigator nav) throws WebxException {
        DataMatrix matrix = dataMatrixService.findById(matrixId);
        String slave = matrix.getMaster();
        String master = matrix.getSlave();
        if (StringUtils.isNotEmpty(master) && StringUtils.isNotEmpty(slave)) {
            matrix.setMaster(master);
            matrix.setSlave(slave);
        }

        dataMatrixService.modify(matrix);
        nav.redirectToLocation("dataMatrixList.htm?matrixId=" + matrixId);
    }
View Full Code Here

    }

    public String onFindMedia(FindMediaEvent event) {
        Assert.notNull(event);
        Assert.notNull(event.getDataId());
        DataMatrix matrix = dataMatrixService.findByGroupKey(event.getDataId());
        return JsonUtils.marshalToString(matrix);
    }
View Full Code Here

TOP

Related Classes of com.alibaba.otter.shared.common.model.config.data.DataMatrix

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.