Search in sources :

Example 1 with CopyDbTask

use of com.cubrid.cubridmanager.core.cubrid.database.task.CopyDbTask in project cubrid-manager by CUBRID.

the class CopyDatabaseDialog method getCopyDbTask.

/**
	 * Check the directory of server
	 * 
	 * 
	 * @return the SocketTask
	 */
private SocketTask getCopyDbTask() {
    CopyDbTask task = new CopyDbTask(database.getServer().getServerInfo());
    task.setSrcdbname(sourceDBNameText.getText());
    task.setDestdbname(destinationDBNameText.getText());
    task.setDestdbpath(destinationDBDirPathText.getText());
    task.setExvolpath(volumePathText.getText());
    task.setLogpath(destinationDBLogPathText.getText());
    if (overwriteButton.getSelection()) {
        task.setOverwrite(YesNoType.Y);
    } else {
        task.setOverwrite(YesNoType.N);
    }
    if (moveButton.getSelection()) {
        task.setMove(YesNoType.Y);
    } else {
        task.setMove(YesNoType.N);
    }
    String oldVolName = null, newVolName = null, oldVolDir = null, newVolDir = null;
    if (copyVolButton.getSelection()) {
        task.setAdvanced(OnOffType.ON);
        StringBuffer openStr = new StringBuffer("volume");
        for (int i = 0; i < copyDBVolList.getItemCount(); i++) {
            TableItem ti = copyDBVolList.getItem(i);
            for (DbSpaceInfo bean : volumeList) {
                if (bean.getSpacename().equals(ti.getText(0))) {
                    oldVolDir = bean.getLocation();
                    break;
                }
            }
            oldVolName = ti.getText(0);
            newVolName = ti.getText(1);
            newVolDir = ti.getText(2);
            if (oldVolDir != null) {
                oldVolDir = oldVolDir.replaceAll(":", "|");
            }
            if (newVolDir != null) {
                newVolDir = newVolDir.replaceAll(":", "|");
            }
            openStr.append("\n").append(oldVolDir).append("/").append(oldVolName).append(":").append(newVolDir).append("/").append(newVolName);
        }
        task.setOpen(openStr.toString());
        task.setClose("volume");
    } else {
        task.setAdvanced(OnOffType.OFF);
    }
    return task;
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) CopyDbTask(com.cubrid.cubridmanager.core.cubrid.database.task.CopyDbTask) DbSpaceInfo(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfo) Point(org.eclipse.swt.graphics.Point)

Aggregations

CopyDbTask (com.cubrid.cubridmanager.core.cubrid.database.task.CopyDbTask)1 DbSpaceInfo (com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfo)1 Point (org.eclipse.swt.graphics.Point)1 TableItem (org.eclipse.swt.widgets.TableItem)1