Search in sources :

Example 1 with RangePartitionComparator

use of com.cubrid.common.ui.cubrid.table.control.RangePartitionComparator in project cubrid-manager by CUBRID.

the class TableEditorPart method loadPartitionInfoList.

/**
	 * Load partition information list
	 */
private void loadPartitionInfoList() {
    boolean isPartitionTable = false;
    if (!isNewTableFlag) {
        isPartitionTable = "YES".equals(oldSchemaInfo.isPartitionGroup());
    }
    if (isPartitionTable) {
        GetPartitionedClassListTask task = new GetPartitionedClassListTask(database.getDatabaseInfo());
        List<PartitionInfo> list = task.getPartitionItemList(newSchemaInfo.getClassname());
        partitionInfoList.clear();
        if (!ArrayUtil.isEmpty(list)) {
            PartitionInfo partitionInfo = list.get(0);
            if (partitionInfo != null && partitionInfo.getPartitionType() == PartitionType.RANGE) {
                RangePartitionComparator comparator = new RangePartitionComparator(partitionInfo.getPartitionExprType());
                Collections.sort(list, comparator);
            }
            partitionInfoList.addAll(list);
        }
    }
    oldPartitionInfoList = new ArrayList<PartitionInfo>();
    for (int i = 0; i < partitionInfoList.size(); i++) {
        PartitionInfo partitionInfo = partitionInfoList.get(i);
        if (partitionInfo != null) {
            oldPartitionInfoList.add(partitionInfo.clone());
        }
    }
    if (oldSchemaInfo != null) {
        oldSchemaInfo.setPartitionList(oldPartitionInfoList);
    }
    if (newSchemaInfo != null) {
        newSchemaInfo.setPartitionList(partitionInfoList);
    }
}
Also used : GetPartitionedClassListTask(com.cubrid.cubridmanager.core.cubrid.table.task.GetPartitionedClassListTask) PartitionInfo(com.cubrid.common.core.common.model.PartitionInfo) RangePartitionComparator(com.cubrid.common.ui.cubrid.table.control.RangePartitionComparator) Constraint(com.cubrid.common.core.common.model.Constraint)

Aggregations

Constraint (com.cubrid.common.core.common.model.Constraint)1 PartitionInfo (com.cubrid.common.core.common.model.PartitionInfo)1 RangePartitionComparator (com.cubrid.common.ui.cubrid.table.control.RangePartitionComparator)1 GetPartitionedClassListTask (com.cubrid.cubridmanager.core.cubrid.table.task.GetPartitionedClassListTask)1