use of com.cubrid.cubridmanager.core.cubrid.table.model.SchemaChangeLog in project cubrid-manager by CUBRID.
the class TableEditorPart method addNewUniqueLog.
/**
* Add a log of new unique key.
*
* @param unique
*/
private void addNewUniqueLog(Constraint unique) {
String key = newSchemaInfo.getClassname() + "$" + unique.getName();
SchemaChangeLog changeLog = new SchemaChangeLog(null, key, SchemeInnerType.TYPE_INDEX);
schemaChangeMgr.addSchemeChangeLog(changeLog);
}
use of com.cubrid.cubridmanager.core.cubrid.table.model.SchemaChangeLog in project cubrid-manager by CUBRID.
the class TableEditorPart method openEditIndexDialog.
/**
* Open the index edit dialog with the constraint object
*
* @param editedIndex Constraint
*/
private void openEditIndexDialog(Constraint editedIndex) {
boolean isNewConstraint = true;
for (int i = 0, len = originalConstraints.size(); i < len; i++) {
if (originalConstraints.get(i) == editedIndex) {
isNewConstraint = false;
}
}
AddIndexDialog dlg = new AddIndexDialog(getSite().getShell(), newSchemaInfo, database, editedIndex, isNewConstraint);
int returnCode = dlg.open();
if (returnCode == AddIndexDialog.OK) {
Constraint newIndex = dlg.getIndexConstraint();
if (newIndex == null) {
return;
}
newSchemaInfo.removeConstraintByName(editedIndex.getName(), editedIndex.getType());
newSchemaInfo.addConstraint(newIndex);
// For bug TOOLS-2394 Unique index can't be added again
if (Constraint.ConstraintType.UNIQUE.getText().equals(newIndex.getType()) && newIndex.getAttributes().size() == 1) {
DBAttribute attr = newSchemaInfo.getDBAttributeByName(newIndex.getAttributes().get(0), false);
attr.setUnique(true);
loadColumnData();
}
boolean modifiedUK = Constraint.ConstraintType.UNIQUE.getText().equals(editedIndex.getType()) && editedIndex.getAttributes().size() == 1;
boolean noNewUK = !Constraint.ConstraintType.UNIQUE.getText().equals(newIndex.getType()) || newIndex.getAttributes().size() != 1;
if (modifiedUK && noNewUK) {
String attrName = editedIndex.getAttributes().get(0);
DBAttribute attr = newSchemaInfo.getDBAttributeByName(attrName, false);
if (attr != null) {
attr.setUnique(false);
loadColumnData();
}
}
String key1 = editedIndex.getDefaultName(newSchemaInfo.getClassname()) + "$" + editedIndex.getName();
String key2 = newIndex.getDefaultName(newSchemaInfo.getClassname()) + "$" + newIndex.getName();
SchemaChangeLog changeLog = new SchemaChangeLog(key1, key2, SchemeInnerType.TYPE_INDEX);
schemaChangeMgr.addSchemeChangeLog(changeLog);
indexTableView.setInput(newSchemaInfo);
}
}
use of com.cubrid.cubridmanager.core.cubrid.table.model.SchemaChangeLog in project cubrid-manager by CUBRID.
the class TableEditorPart method addPosAttrLog.
/**
* Add a log of change the attribute position.
*
* @param attrId
* @param isClassAttribute
*/
private void addPosAttrLog(DBAttribute attribute) {
SchemaChangeLog changeLog = new SchemaChangeLog(attribute.getName(), attribute.getName(), SchemeInnerType.TYPE_POSITION);
schemaChangeMgr.addSchemeChangeLog(changeLog);
}
use of com.cubrid.cubridmanager.core.cubrid.table.model.SchemaChangeLog in project cubrid-manager by CUBRID.
the class TableEditorPart method addEditAttrLog.
/**
* Add a log of editing an attribute to change list.
*
* @param attrName String
* @param isClassAttribute boolean
* @param newAttrName String
*/
private void addEditAttrLog(String attrName, String newAttrName, boolean isClassAttribute) {
SchemaChangeLog changeLog = new SchemaChangeLog(attrName, newAttrName, getSchemaInnerType(isClassAttribute));
schemaChangeMgr.addSchemeChangeLog(changeLog);
}
use of com.cubrid.cubridmanager.core.cubrid.table.model.SchemaChangeLog in project cubrid-manager by CUBRID.
the class TableEditorPart method addNewAttrLog.
/**
* Add a log of adding an attribute to change list.
*
* @param newAttrName String
* @param isClassAttribute boolean
*/
public void addNewAttrLog(String newAttrName, boolean isClassAttribute) {
SchemaChangeLog changeLog = new SchemaChangeLog(null, newAttrName, getSchemaInnerType(isClassAttribute));
schemaChangeMgr.addSchemeChangeLog(changeLog);
}
Aggregations