Search in sources :

Example 6 with TableDetailInfo

use of com.cubrid.common.core.common.model.TableDetailInfo in project cubrid-manager by CUBRID.

the class TableSchemaCompareInfoPart method getDBSchema.

private String getDBSchema(CubridDatabase db, Map<String, SchemaInfo> schemaInfos, List<SchemaInfo> commonTables) {
    // FIXME logic code move to core module
    if (schemaInfos == null) {
        return "";
    }
    Set<String> commonNames = new HashSet<String>();
    for (SchemaInfo table : commonTables) {
        commonNames.add(table.getClassname());
    }
    StringBuilder buf = new StringBuilder();
    if (!db.isVirtual()) {
        SchemaDDL schemaDDL = new SchemaDDL(null, db.getDatabaseInfo());
        List<TableDetailInfo> tableList = getTableInfoList(db);
        Collections.sort(tableList);
        try {
            for (SchemaInfo schemaInfo : commonTables) {
                addSchemaDDL(buf, schemaDDL, schemaInfo, true, false);
            }
            for (TableDetailInfo table : tableList) {
                if (commonNames.contains(table.getTableName())) {
                    continue;
                }
                SchemaInfo schemaInfo = schemaInfos.get(table.getTableName());
                addSchemaDDL(buf, schemaDDL, schemaInfo, true, false);
            }
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
    } else {
        WrappedDatabaseInfo info = ERXmlDatabaseInfoMapper.getWrappedDatabaseInfo(db.getDatabaseInfo());
        SchemaDDL schemaDDL = new SchemaDDL(null, info);
        List<SchemaInfo> tables = Arrays.asList(schemaInfos.values().toArray(new SchemaInfo[0]));
        Collections.sort(tables);
        for (SchemaInfo schemaInfo : commonTables) {
            addSchemaDDL(buf, schemaDDL, schemaInfo, true, true);
        }
        for (SchemaInfo si : tables) {
            if (commonNames.contains(si.getClassname())) {
                continue;
            }
            addSchemaDDL(buf, schemaDDL, si, true, true);
        }
    }
    return buf.toString();
}
Also used : SchemaDDL(com.cubrid.cubridmanager.core.cubrid.table.model.SchemaDDL) TableDetailInfo(com.cubrid.common.core.common.model.TableDetailInfo) WrappedDatabaseInfo(com.cubrid.common.ui.cubrid.database.erwin.WrappedDatabaseInfo) CoreException(org.eclipse.core.runtime.CoreException) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) HashSet(java.util.HashSet) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo)

Example 7 with TableDetailInfo

use of com.cubrid.common.core.common.model.TableDetailInfo in project cubrid-manager by CUBRID.

the class ParseVirtualDatabaseDetailProgress method run.

public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    monitor.beginTask("Parse ER xml...", 1);
    List<ICubridNode> nodes = database.getChildren();
    for (ICubridNode node : nodes) {
        TableDetailInfo detailInfo = new TableDetailInfo();
    }
    monitor.done();
}
Also used : TableDetailInfo(com.cubrid.common.core.common.model.TableDetailInfo) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

Example 8 with TableDetailInfo

use of com.cubrid.common.core.common.model.TableDetailInfo in project cubrid-manager by CUBRID.

the class TableDetailInfoTest method testTableDetailInfo.

public void testTableDetailInfo() {
    TableDetailInfo info = new TableDetailInfo();
    info.setClassType("Table");
    info.setColumnsCount(3);
    info.setFkCount(3);
    info.setHasUnCountColumnSize(true);
    info.setIndexCount(3);
    info.setPartitioned("partition");
    info.setPkCount(1);
    info.setRecordsCount(65536);
    info.setRecordsSize(null);
    info.setTableDesc("");
    info.setTableName("name");
    info.setUkCount(1);
    TableDetailInfo info1 = new TableDetailInfo();
    TableDetailInfo.copyAllAttribute(info, info1);
}
Also used : TableDetailInfo(com.cubrid.common.core.common.model.TableDetailInfo)

Example 9 with TableDetailInfo

use of com.cubrid.common.core.common.model.TableDetailInfo in project cubrid-manager by CUBRID.

the class ColumnViewerSorter method compare.

public int compare(Viewer viewer, Object e1, Object e2) {
    TableDetailInfo t1 = (TableDetailInfo) e1;
    TableDetailInfo t2 = (TableDetailInfo) e2;
    if (PROPERTY_NAME.equals(property)) {
        return compareName(t1, t2);
    } else if (PROPERTY_MEMO.equals(property)) {
        return compareMemo(t1, t2);
    } else if (PROPERTY_RECORD.equals(property)) {
        return compareRecord(t1, t2);
    } else if (PROPERTY_COLUMN.equals(property)) {
        return compareColumn(t1, t2);
    } else if (PROPERTY_PK.equals(property)) {
        return comparePK(t1, t2);
    } else if (PROPERTY_UK.equals(property)) {
        return compareUK(t1, t2);
    } else if (PROPERTY_FK.equals(property)) {
        return compareFK(t1, t2);
    } else if (PROPERTY_INDEX.equals(property)) {
        return compareIndex(t1, t2);
    } else if (PROPERTY_SIZE.equals(property)) {
        return compareSize(t1, t2);
    }
    return super.compare(viewer, e1, e2);
}
Also used : TableDetailInfo(com.cubrid.common.core.common.model.TableDetailInfo)

Example 10 with TableDetailInfo

use of com.cubrid.common.core.common.model.TableDetailInfo in project cubrid-manager by CUBRID.

the class ColumnViewerSorter method getAllSelectedNodes.

/**
	 * Get all selected nodes
	 *
	 * @return
	 */
private ICubridNode[] getAllSelectedNodes() {
    TableItem[] items = tableListView.getTable().getSelection();
    ICubridNode[] nodes = null;
    if (items.length > 0) {
        List<ICubridNode> nodeList = new ArrayList<ICubridNode>();
        for (TableItem item : items) {
            TableDetailInfo tableInfo = (TableDetailInfo) item.getData();
            Set<String> typeSet = new HashSet<String>();
            typeSet.add(NodeType.USER_TABLE);
            typeSet.add(NodeType.USER_PARTITIONED_TABLE);
            ICubridNode tableNode = CommonUITool.findNode(database, typeSet, tableInfo.getTableName());
            if (tableNode != null) {
                nodeList.add(tableNode);
            }
        }
        nodes = new ICubridNode[nodeList.size()];
        return nodeList.toArray(nodes);
    }
    return nodes;
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) ArrayList(java.util.ArrayList) TableDetailInfo(com.cubrid.common.core.common.model.TableDetailInfo) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) HashSet(java.util.HashSet)

Aggregations

TableDetailInfo (com.cubrid.common.core.common.model.TableDetailInfo)27 ArrayList (java.util.ArrayList)11 Connection (java.sql.Connection)6 HashMap (java.util.HashMap)6 TableSchemaCompareModel (com.cubrid.common.ui.compare.schema.model.TableSchemaCompareModel)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)5 SQLException (java.sql.SQLException)5 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)4 WrappedDatabaseInfo (com.cubrid.common.ui.cubrid.database.erwin.WrappedDatabaseInfo)4 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)4 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)4 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)4 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)4 TableItem (org.eclipse.swt.widgets.TableItem)4 PartInitException (org.eclipse.ui.PartInitException)4 AbstractUITask (com.cubrid.common.core.task.AbstractUITask)3 ITask (com.cubrid.common.core.task.ITask)3 TableSchemaModel (com.cubrid.common.ui.compare.schema.model.TableSchemaModel)3 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)3 OpenTablesDetailInfoPartProgress (com.cubrid.common.ui.spi.progress.OpenTablesDetailInfoPartProgress)3