Search in sources :

Example 1 with GetQueryPlanListTask

use of com.cubrid.cubridmanager.core.cubrid.jobauto.task.GetQueryPlanListTask 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 2 with GetQueryPlanListTask

use of com.cubrid.cubridmanager.core.cubrid.jobauto.task.GetQueryPlanListTask in project cubrid-manager by CUBRID.

the class CubridQueryPlanFolderLoader method load.

/**
	 * 
	 * Load children object for parent
	 * 
	 * @param parent the parent node
	 * @param monitor the IProgressMonitor object
	 */
public void load(ICubridNode parent, final IProgressMonitor monitor) {
    synchronized (this) {
        if (isLoaded()) {
            return;
        }
        CubridDatabase database = ((ISchemaNode) parent).getDatabase();
        DatabaseInfo databaseInfo = database.getDatabaseInfo();
        final GetQueryPlanListTask task = new GetQueryPlanListTask(parent.getServer().getServerInfo());
        task.setDbName(database.getLabel());
        monitorCancel(monitor, new ITask[] { task });
        task.execute();
        final String errorMsg = task.getErrorMsg();
        if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
            parent.removeAllChild();
            openErrorBox(errorMsg);
            setLoaded(true);
            return;
        }
        if (monitor.isCanceled()) {
            setLoaded(true);
            return;
        }
        parent.removeAllChild();
        List<QueryPlanInfo> queryPlanInfoList = task.getQueryPlanInfoList();
        if (queryPlanInfoList != null && !queryPlanInfoList.isEmpty()) {
            for (QueryPlanInfo queryPlanInfo : queryPlanInfoList) {
                String id = parent.getId() + NODE_SEPARATOR + queryPlanInfo.getQuery_id();
                ICubridNode queryPlanInfoNode = new DefaultSchemaNode(id, queryPlanInfo.getQuery_id(), "icons/navigator/auto_query_item.png");
                queryPlanInfoNode.setContainer(false);
                queryPlanInfoNode.setModelObj(queryPlanInfo);
                queryPlanInfoNode.setType(CubridNodeType.QUERY_PLAN);
                parent.addChild(queryPlanInfoNode);
            }
        }
        databaseInfo.setQueryPlanInfoList(queryPlanInfoList);
        Collections.sort(parent.getChildren());
        setLoaded(true);
        CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
    }
}
Also used : ISchemaNode(com.cubrid.common.ui.spi.model.ISchemaNode) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) GetQueryPlanListTask(com.cubrid.cubridmanager.core.cubrid.jobauto.task.GetQueryPlanListTask) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridNodeChangedEvent(com.cubrid.common.ui.spi.event.CubridNodeChangedEvent) CubridDatabase(com.cubrid.common.ui.spi.model.CubridDatabase) QueryPlanInfo(com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo) DefaultSchemaNode(com.cubrid.common.ui.spi.model.DefaultSchemaNode)

Aggregations

QueryPlanInfo (com.cubrid.cubridmanager.core.cubrid.jobauto.model.QueryPlanInfo)2 GetQueryPlanListTask (com.cubrid.cubridmanager.core.cubrid.jobauto.task.GetQueryPlanListTask)2 CubridNodeChangedEvent (com.cubrid.common.ui.spi.event.CubridNodeChangedEvent)1 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)1 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)1 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)1 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)1 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)1 BackupPlanInfo (com.cubrid.cubridmanager.core.cubrid.jobauto.model.BackupPlanInfo)1 GetBackupPlanListTask (com.cubrid.cubridmanager.core.cubrid.jobauto.task.GetBackupPlanListTask)1