Search in sources :

Example 1 with Column

use of com.github.yiuman.citrus.mda.entity.Column in project citrus by Yiuman.

the class HistoricConverter method convert.

@Override
public HistoryTable convert(Table table) {
    HistoryTable historyTable = Converter.super.convert(table);
    historyTable.setUuid(null);
    historyTable.setTableUuid(table.getUuid());
    List<Column> columnList = TableRelUtils.getTableRelInfos(table.getUuid(), Column.class);
    if (!CollectionUtils.isEmpty(columnList)) {
        historyTable.setColumns(columnList.parallelStream().map(LambdaUtils.functionWrapper(column -> ConvertUtils.convert(HistoryColumn.class, column))).collect(Collectors.toList()));
    }
    List<Indexes> indexesList = TableRelUtils.getTableRelInfos(table.getUuid(), Indexes.class);
    if (!CollectionUtils.isEmpty(indexesList)) {
        historyTable.setIndexes(indexesList.parallelStream().map(LambdaUtils.functionWrapper(indexes -> ConvertUtils.convert(HistoryIndexes.class, indexes))).collect(Collectors.toList()));
    }
    return historyTable;
}
Also used : HistoryTable(com.github.yiuman.citrus.mda.entity.history.HistoryTable) ConvertUtils(com.github.yiuman.citrus.support.utils.ConvertUtils) Collectors(java.util.stream.Collectors) Indexes(com.github.yiuman.citrus.mda.entity.Indexes) LambdaUtils(com.github.yiuman.citrus.support.utils.LambdaUtils) Table(com.github.yiuman.citrus.mda.entity.Table) HistoryColumn(com.github.yiuman.citrus.mda.entity.history.HistoryColumn) List(java.util.List) HistoryIndexes(com.github.yiuman.citrus.mda.entity.history.HistoryIndexes) CollectionUtils(org.springframework.util.CollectionUtils) Converter(com.github.yiuman.citrus.mda.converter.Converter) Column(com.github.yiuman.citrus.mda.entity.Column) TableRelUtils(com.github.yiuman.citrus.mda.converter.TableRelUtils) HistoryColumn(com.github.yiuman.citrus.mda.entity.history.HistoryColumn) Column(com.github.yiuman.citrus.mda.entity.Column) Indexes(com.github.yiuman.citrus.mda.entity.Indexes) HistoryIndexes(com.github.yiuman.citrus.mda.entity.history.HistoryIndexes) HistoryTable(com.github.yiuman.citrus.mda.entity.history.HistoryTable)

Aggregations

Converter (com.github.yiuman.citrus.mda.converter.Converter)1 TableRelUtils (com.github.yiuman.citrus.mda.converter.TableRelUtils)1 Column (com.github.yiuman.citrus.mda.entity.Column)1 Indexes (com.github.yiuman.citrus.mda.entity.Indexes)1 Table (com.github.yiuman.citrus.mda.entity.Table)1 HistoryColumn (com.github.yiuman.citrus.mda.entity.history.HistoryColumn)1 HistoryIndexes (com.github.yiuman.citrus.mda.entity.history.HistoryIndexes)1 HistoryTable (com.github.yiuman.citrus.mda.entity.history.HistoryTable)1 ConvertUtils (com.github.yiuman.citrus.support.utils.ConvertUtils)1 LambdaUtils (com.github.yiuman.citrus.support.utils.LambdaUtils)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 CollectionUtils (org.springframework.util.CollectionUtils)1