Search in sources :

Example 1 with QueryPlanInfo

use of com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo in project cubrid-manager by CUBRID.

the class EditQueryPlanDialog method initPara.

/**
	 * Sets the queryPlanInfo and selection which is a folder
	 *
	 * @param selection the selection to set
	 */
public void initPara(DefaultSchemaNode selection) {
    childrenLabel = new ArrayList<String>();
    ICubridNode[] childrenNode = null;
    QueryPlanInfo qpi = null;
    if (operation == AddEditType.EDIT) {
        qpi = (QueryPlanInfo) selection.getAdapter(QueryPlanInfo.class);
        childrenNode = selection.getParent().getChildren(new NullProgressMonitor());
    } else {
        qpi = new QueryPlanInfo();
        childrenNode = selection.getChildren(new NullProgressMonitor());
    }
    queryPlanInfo = new QueryPlanInfoHelp();
    queryPlanInfo.setQueryPlanInfo(qpi);
    database = selection.getDatabase();
    for (ICubridNode childNode : childrenNode) {
        childrenLabel.add(childNode.getLabel());
    }
    withUser = CompatibleUtil.isSupportQueryPlanWithUser(database.getDatabaseInfo());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) QueryPlanInfoHelp(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfoHelp) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)

Example 2 with QueryPlanInfo

use of com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo in project cubrid-manager by CUBRID.

the class JobAutoDashboardEditorPart method editQueryPlan.

public void editQueryPlan() {
    TableItem[] items = queryPlanInfoTable.getTable().getSelection();
    if (items.length != 0) {
        TableItem item = items[0];
        QueryPlanInfo queryPlanInfo = (QueryPlanInfo) item.getData();
        Set<String> typeSet = new HashSet<String>();
        typeSet.add(CubridNodeType.QUERY_PLAN);
        ICubridNode queryPlanNode = findAutoJobInfoNode(CubridNodeType.QUERY_PLAN, queryPlanInfo.getQuery_id());
        if (queryPlanNode != null) {
            EditQueryPlanAction action = (EditQueryPlanAction) ActionManager.getInstance().getAction(EditQueryPlanAction.ID);
            if (action.run(database, (DefaultSchemaNode) queryPlanNode) == IDialogConstants.OK_ID) {
                refreshQueryPlan();
            }
        }
    } else {
        CommonUITool.openWarningBox(Messages.errJobAutoNoSelection);
    }
}
Also used : TableItem(org.eclipse.swt.widgets.TableItem) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode) HashSet(java.util.HashSet) EditQueryPlanAction(com.cubrid.cubridmanager.ui.cubrid.jobauto.action.EditQueryPlanAction)

Example 3 with QueryPlanInfo

use of com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo in project cubrid-manager by CUBRID.

the class JobAutoDashboardEditorPart method deleteQueryPlan.

public void deleteQueryPlan() {
    TableItem[] items = queryPlanInfoTable.getTable().getSelection();
    if (items.length > 0) {
        List<ISchemaNode> selectNodeList = new ArrayList<ISchemaNode>();
        for (TableItem item : items) {
            QueryPlanInfo queryPlanInfo = (QueryPlanInfo) item.getData();
            Set<String> typeSet = new HashSet<String>();
            typeSet.add(CubridNodeType.QUERY_PLAN);
            ICubridNode queryPlanNode = CommonUITool.findNode(database, typeSet, queryPlanInfo.getQuery_id());
            selectNodeList.add((ISchemaNode) queryPlanNode);
        }
        if (selectNodeList.size() > 0) {
            DeleteQueryPlanAction action = (DeleteQueryPlanAction) ActionManager.getInstance().getAction(DeleteQueryPlanAction.ID);
            ISchemaNode[] nodeArr = new ISchemaNode[selectNodeList.size()];
            action.run(selectNodeList.toArray(nodeArr));
            refreshQueryPlan();
        }
    } else {
        CommonUITool.openWarningBox(Messages.errJobAutoNoSelection);
    }
}
Also used : ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) TableItem(org.eclipse.swt.widgets.TableItem) ArrayList(java.util.ArrayList) DeleteQueryPlanAction(com.cubrid.cubridmanager.ui.cubrid.jobauto.action.DeleteQueryPlanAction) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo) HashSet(java.util.HashSet)

Example 4 with QueryPlanInfo

use of com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo in project cubrid-manager by CUBRID.

the class OpenJobAutomationInfoPartProgress method run.

/* (non-Javadoc)
	 * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
	 */
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    if (getBackupPlanInfo) {
        final GetBackupPlanListTask getBackupPlanInfoListTask = new GetBackupPlanListTask(database.getServer().getServerInfo());
        getBackupPlanInfoListTask.setDbName(database.getLabel());
        getBackupPlanInfoListTask.execute();
        if (getBackupPlanInfoListTask.isSuccess()) {
            backupPlanInfoList = getBackupPlanInfoListTask.getBackupPlanInfoList();
        } else {
            backupPlanInfoList = new ArrayList<BackupPlanInfo>();
        }
    }
    if (getQueryPlanInfo) {
        final GetQueryPlanListTask getQueryPlanListTask = new GetQueryPlanListTask(database.getServer().getServerInfo());
        getQueryPlanListTask.setDbName(database.getLabel());
        getQueryPlanListTask.execute();
        if (getQueryPlanListTask.isSuccess()) {
            queryPlanInfoList = getQueryPlanListTask.getQueryPlanInfoList();
        } else {
            queryPlanInfoList = new ArrayList<QueryPlanInfo>();
        }
    }
    success = true;
}
Also used : GetQueryPlanListTask(com.cubrid.cubridmanager.core.cubrid.jobauto.task.GetQueryPlanListTask) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo) BackupPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.BackupPlanInfo) GetBackupPlanListTask(com.cubrid.cubridmanager.core.cubrid.jobauto.task.GetBackupPlanListTask)

Example 5 with QueryPlanInfo

use of com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo in project cubrid-manager by CUBRID.

the class DatabaseInfoTest method testRemoveQueryPlanInfo.

/**
	 * Test method for
	 * {@link com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo#removeQueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)}
	 * .
	 */
public void testRemoveQueryPlanInfo() {
    QueryPlanInfo queryPlanInfo = new QueryPlanInfo();
    bean.removeQueryPlanInfo(queryPlanInfo);
    bean.setQueryPlanInfoList(new ArrayList<QueryPlanInfo>());
    bean.addQueryPlanInfo(queryPlanInfo);
    bean.removeQueryPlanInfo(queryPlanInfo);
}
Also used : QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)

Aggregations

QueryPlanInfo (com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)13 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)7 ArrayList (java.util.ArrayList)7 QueryPlanInfoHelp (com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfoHelp)5 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)4 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)3 CommonTaskExec (com.cubrid.common.ui.spi.progress.CommonTaskExec)3 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)3 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)3 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)3 SetQueryPlanListTask (com.cubrid.cubridmanager.core.cubrid.jobauto.task.SetQueryPlanListTask)3 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)2 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)2 BackupPlanInfo (com.cubrid.cubridmanager.core.cubrid.jobauto.model.BackupPlanInfo)2 GetQueryPlanListTask (com.cubrid.cubridmanager.core.cubrid.jobauto.task.GetQueryPlanListTask)2 DbUserInfo (com.cubrid.cubridmanager.core.cubrid.user.model.DbUserInfo)2 EditQueryPlanDialog (com.cubrid.cubridmanager.ui.cubrid.jobauto.dialog.EditQueryPlanDialog)2 HashSet (java.util.HashSet)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 TableItem (org.eclipse.swt.widgets.TableItem)2