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();
}
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();
}
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);
}
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);
}
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;
}
Aggregations