use of com.cubrid.common.core.common.model.SchemaInfo in project cubrid-manager by CUBRID.
the class TableDashboardDetailContentProvider method getElements.
/**
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
* @param inputElement the input element
* @return the array of elements to display in the viewer
*/
public Object[] getElements(Object inputElement) {
if (inputElement instanceof SchemaInfo) {
SchemaInfo schema = (SchemaInfo) inputElement;
List<DBAttribute> list = new ArrayList<DBAttribute>();
if (showClassAttribute) {
list.addAll(schema.getClassAttributes());
}
list.addAll(schema.getAttributes());
return list.toArray();
} else {
return new Object[0];
}
}
use of com.cubrid.common.core.common.model.SchemaInfo in project cubrid-manager by CUBRID.
the class CubridIndexNavigatorContentProvider method getElements.
public Object[] getElements(Object inputElement) {
if (inputElement instanceof SchemaInfo) {
SchemaInfo schema = (SchemaInfo) inputElement;
List<Constraint> list = new ArrayList<Constraint>();
List<Constraint> constraints = schema.getConstraints();
for (Constraint constraint : constraints) {
if (constraint.getType().equals(Constraint.ConstraintType.INDEX.getText()) || constraint.getType().equals(Constraint.ConstraintType.UNIQUE.getText()) || constraint.getType().equals(Constraint.ConstraintType.REVERSEINDEX.getText()) || constraint.getType().equals(Constraint.ConstraintType.REVERSEUNIQUE.getText()) || constraint.getType().equals(Constraint.ConstraintType.PRIMARYKEY.getText())) {
list.add(constraint);
}
}
return list.toArray();
} else {
return new Object[0];
}
}
use of com.cubrid.common.core.common.model.SchemaInfo in project cubrid-manager by CUBRID.
the class CubridIndexNavigatorView method setFocus.
public void setFocus() {
CubridNavigatorView mainNav = CubridNavigatorView.findNavigationView();
if (mainNav != null) {
SchemaInfo schemaInfo = mainNav.getCurrentSchemaInfo();
updateView(schemaInfo);
}
}
use of com.cubrid.common.core.common.model.SchemaInfo in project cubrid-manager by CUBRID.
the class ERSchemaEditor method getUpdateDescriptionTaskList.
/**
* Get UpdateDescriptionTaskList
*
* @param dbInfo
* @return
*/
private List<UpdateDescriptionTask> getUpdateDescriptionTaskList(DatabaseInfo dbInfo) {
List<UpdateDescriptionTask> updateDescriptionTaskList = new ArrayList<UpdateDescriptionTask>();
Map<String, SchemaInfo> schemaInfos = erSchema.getAllSchemaInfo();
Collection<SchemaInfo> erdSchemaInfos = schemaInfos.values();
GetAllSchemaTask task = new GetAllSchemaTask(dbInfo);
task.execute();
Map<String, SchemaInfo> dbSchemaInfoMap = task.getSchemas();
String taskName = com.cubrid.common.ui.cubrid.table.Messages.updateDescriptionTask;
for (SchemaInfo newSchemaInfo : erdSchemaInfos) {
String tableName = newSchemaInfo.getClassname();
SchemaInfo dbSchemaInfo = dbSchemaInfoMap.get(tableName);
if (dbSchemaInfo == null) {
continue;
}
for (DBAttribute newAttr : newSchemaInfo.getAttributes()) {
DBAttribute oldAttr = dbSchemaInfo.getDBAttributeByName(newAttr.getName(), newAttr.isClassAttribute());
if (oldAttr == null || StringUtil.isEqual(oldAttr.getDescription(), newAttr.getDescription())) {
continue;
}
updateDescriptionTaskList.add(new UpdateDescriptionTask(taskName, dbInfo, tableName, newAttr.getName(), newAttr.getDescription()));
}
if (!StringUtil.isEqual(dbSchemaInfo.getDescription(), newSchemaInfo.getDescription())) {
updateDescriptionTaskList.add(new UpdateDescriptionTask(taskName, dbInfo, tableName, "", newSchemaInfo.getDescription()));
}
}
return updateDescriptionTaskList;
}
use of com.cubrid.common.core.common.model.SchemaInfo in project cubrid-manager by CUBRID.
the class ERSchemaEditor method compareDDL2DB.
public void compareDDL2DB() {
DatabaseInfo info = database.getDatabaseInfo();
if (info == null) {
CommonUITool.openErrorBox(Messages.errNoDatabase);
return;
}
if (!info.isLogined()) {
CommonUITool.openErrorBox(Messages.msgDBNotLogin);
return;
}
ServerInfo serverInfo = info.getServerInfo();
if (serverInfo != null && !serverInfo.isConnected()) {
CommonUITool.openErrorBox(Messages.msgDBNotLogin);
return;
}
Map<String, SchemaInfo> schemaInfos = erSchema.getAllSchemaInfo();
Map<String, TableSchema> tableSchemas = new HashMap<String, TableSchema>();
WrappedDatabaseInfo wrappedDatabaseInfo = new WrappedDatabaseInfo(info.getDbName(), info.getServerInfo());
ERXmlDatabaseInfoMapper.addWrappedDatabaseInfo(info, wrappedDatabaseInfo);
wrappedDatabaseInfo.addSchemaInfos(schemaInfos);
SchemaDDL ddl = new SchemaDDL(null, wrappedDatabaseInfo);
for (String tableName : schemaInfos.keySet()) {
SchemaInfo schemaInfo = schemaInfos.get(tableName);
if (schemaInfo == null || !tableName.equals(schemaInfo.getClassname())) {
continue;
}
// now do not support view table
String strDDL = ddl.getSchemaDDL(schemaInfo, true, true);
TableSchema tableSchema = new TableSchema(tableName, "");
tableSchema.setSchemaInfo(strDDL);
tableSchemas.put(tableSchema.getName(), tableSchema);
}
wrappedDatabaseInfo.addTableSchemas(tableSchemas);
compareTableSchemas(getEditorInput().getName(), tableSchemas, schemaInfos);
}
Aggregations