use of com.cubrid.common.core.common.model.PartitionInfo in project cubrid-manager by CUBRID.
the class PartitionEditRangePage method init.
/**
*
* Initial the page content
*
*/
private void init() {
partitionExprTypeCombo.setItems(PartitionUtil.getSupportedDateTypes());
if (!partitionInfoList.isEmpty() && editedPartitionInfo == null) {
PartitionInfo partitonInfo = partitionInfoList.get(0);
String partitionType = partitonInfo.getPartitionType().getText().toUpperCase();
String partitionExpr = partitonInfo.getPartitionExpr();
String exprDataType = partitonInfo.getPartitionExprType();
if (exprDataType == null) {
partitionExprTypeCombo.setEnabled(true);
partitionExprTypeCombo.select(0);
} else {
partitionExprTypeCombo.setText(PartitionUtil.getMatchType(exprDataType));
partitionExprTypeCombo.setEnabled(false);
}
partitionTypeText.setText(partitionType);
partitionExprText.setText(partitionExpr);
}
if (editedPartitionInfo != null) {
partitionNameText.setText(editedPartitionInfo.getPartitionName());
String str = editedPartitionInfo.getPartitionValues().get(1);
if (str == null) {
maxValueButton.setSelection(true);
partitionRangeText.setEnabled(false);
} else {
partitionRangeText.setText(str);
}
}
partitionNameText.addModifyListener(this);
partitionRangeText.addModifyListener(this);
}
use of com.cubrid.common.core.common.model.PartitionInfo in project cubrid-manager by CUBRID.
the class PartitionEditRangePage method isExistRangeValue.
/**
*
* Check the range value whether exist
*
* @param value the range value
* @return <code>true</code> if exist;otherwise <code>false</code>
*/
private boolean isExistRangeValue(String value) {
if (partitionInfoList.isEmpty()) {
return false;
} else {
String editedValue = null;
if (this.editedPartitionInfo != null) {
editedValue = editedPartitionInfo.getPartitionValues().get(1);
}
RangePartitionComparator comparator = new RangePartitionComparator(partitionExprTypeCombo.getText());
for (int i = 0; i < partitionInfoList.size(); i++) {
PartitionInfo info = partitionInfoList.get(i);
String str = info.getPartitionValues().get(1);
if (comparator.compareData(str, value) == 0 && (editedValue == null || comparator.compareData(editedValue, value) != 0)) {
return true;
}
}
}
return false;
}
use of com.cubrid.common.core.common.model.PartitionInfo in project cubrid-manager by CUBRID.
the class PartitionTableLabelProvider method getColumnText.
/**
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object,
* int)
* @param element the object representing the entire row, or
* <code>null</code> indicating that no input object is set in the
* viewer
* @param columnIndex the zero-based index of the column in which the label
* appears
* @return String or or <code>null</code> if there is no text for the given
* object at columnIndex
*/
public String getColumnText(Object element, int columnIndex) {
PartitionInfo item = (PartitionInfo) element;
switch(columnIndex) {
case 0:
return item.getPartitionClassName();
case 1:
return item.getPartitionName();
case 2:
return item.getPartitionType().getText().toUpperCase();
case 3:
return item.getPartitionExpr();
case 4:
String partType = item.getPartitionType().getText().toUpperCase();
PartitionType partitionType = PartitionType.valueOf(partType);
if (partitionType == PartitionType.HASH) {
return "";
} else if (partitionType == PartitionType.RANGE) {
boolean isUsingQuote = PartitionUtil.isUsingQuoteForExprValue(item.getPartitionExprType());
String str = "{";
if (item.getPartitionValues().get(0) != null) {
str += (isUsingQuote ? "'" : "") + item.getPartitionValues().get(0) + (isUsingQuote ? "'" : "");
}
if (item.getPartitionValues().get(1) == null) {
str += ",MAXVALUE}";
} else {
str += "," + (isUsingQuote ? "'" : "") + item.getPartitionValues().get(1) + (isUsingQuote ? "'" : "") + "}";
}
return str;
} else {
return "{" + item.getPartitionValuesString(PartitionUtil.isUsingQuoteForExprValue(item.getPartitionExprType())) + "}";
}
case 5:
if (item.getRows() < 0) {
return "";
} else {
return String.valueOf(item.getRows());
}
default:
break;
}
return "";
}
use of com.cubrid.common.core.common.model.PartitionInfo in project cubrid-manager by CUBRID.
the class CreatePartitionWizard method changePartitionExprDataType.
/**
*
* Change all partition expression data type
*
* @param type the partition expression
*/
private void changePartitionExprDataType(String type) {
// FIXME move this logic to core module
for (int i = 0; i < partitionInfoList.size(); i++) {
PartitionInfo info = partitionInfoList.get(i);
info.setPartitionExprType(type);
}
}
use of com.cubrid.common.core.common.model.PartitionInfo in project cubrid-manager by CUBRID.
the class CreatePartitionWizard method changePartitionExpr.
/**
*
* Change all partition information expression
*
* @param expr the partition expression
*/
private void changePartitionExpr(String expr) {
// FIXME move this logic to core module
for (int i = 0; i < partitionInfoList.size(); i++) {
PartitionInfo info = partitionInfoList.get(i);
info.setPartitionExpr(expr);
info.setRows(-1);
}
}
Aggregations