Search in sources :

Example 1 with UpdateNodeParameterCommand

use of org.talend.designer.core.ui.editor.update.cmd.UpdateNodeParameterCommand in project tdi-studio-se by Talend.

the class RepositoryUpdateTest method launchRepositoryUpdateOnNode.

/**
     * DOC nrousseau Comment method "updateNode".
     * @param id
     * @param process
     * @param node
     * @throws PersistenceException
     */
private void launchRepositoryUpdateOnNode(String id, Process process, Node node) throws PersistenceException {
    GenericConnectionItem connectionItem;
    IRepositoryViewObject object;
    object = ProxyRepositoryFactory.getInstance().getLastVersion(id);
    connectionItem = (GenericConnectionItem) object.getProperty().getItem();
    Assert.assertEquals(1, SchemaUtils.getMetadataTables(connectionItem.getConnection(), SubContainer.class).size());
    UpdateResult ur = createUpdateResult(node);
    ur.setResult(EUpdateItemType.NODE_PROPERTY, EUpdateResult.UPDATE, connectionItem);
    ur.setJob(process);
    UpdateNodeParameterCommand cmd = new UpdateNodeParameterCommand(ur);
    cmd.execute();
}
Also used : UpdateNodeParameterCommand(org.talend.designer.core.ui.editor.update.cmd.UpdateNodeParameterCommand) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) GenericConnectionItem(org.talend.repository.generic.model.genericMetadata.GenericConnectionItem) UpdateResult(org.talend.core.model.update.UpdateResult) EUpdateResult(org.talend.core.model.update.EUpdateResult)

Example 2 with UpdateNodeParameterCommand

use of org.talend.designer.core.ui.editor.update.cmd.UpdateNodeParameterCommand in project tdi-studio-se by Talend.

the class UpdateManagerUtils method executeUpdate.

private static void executeUpdate(UpdateResult result, IProgressMonitor monitor, boolean updateAllJobs) {
    if (result.isReadOnlyProcess()) {
        return;
    }
    // update
    Command command = null;
    IUpdateItemType updateType = result.getUpdateType();
    if (updateType instanceof EUpdateItemType) {
        switch((EUpdateItemType) updateType) {
            case NODE_PROPERTY:
            case NODE_SCHEMA:
            case NODE_QUERY:
            case NODE_SAP_IDOC:
            case NODE_SAP_FUNCTION:
            case NODE_VALIDATION_RULE:
                command = new UpdateNodeParameterCommand(result);
                break;
            case JOB_PROPERTY_EXTRA:
            case JOB_PROPERTY_STATS_LOGS:
            case JOB_PROPERTY_HEADERFOOTER:
            case JOB_PROPERTY_STORM:
            case JOB_PROPERTY_MAPREDUCE:
                command = new UpdateMainParameterCommand(result);
                break;
            case CONTEXT:
                command = executeContextUpdates(result);
                break;
            case CONTEXT_GROUP:
                command = executeContextGroupUpdates(result);
                break;
            case JOBLET_RENAMED:
            case JOBLET_SCHEMA:
            case RELOAD:
                command = executeJobletNodesUpdates(result);
                break;
            case JUNIT_RELOAD:
                command = executeJunitNodesUpdates(result);
                break;
            // break;
            case MAP_PATH:
                command = new UpdateNodePathCommand(result);
                break;
            default:
                break;
        }
    }
    if (command != null) {
        SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1 * UpdatesConstants.SCALE, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK);
        subMonitor.beginTask(UpdatesConstants.EMPTY, 1);
        subMonitor.subTask(getResultTaskInfor(result));
        //
        Object job = result.getJob();
        boolean executed = false;
        if (job != null && job instanceof IGEFProcess) {
            IDesignerCoreUIService designerCoreUIService = CoreUIPlugin.getDefault().getDesignerCoreUIService();
            if (designerCoreUIService != null) {
                executed = designerCoreUIService.executeCommand((IGEFProcess) job, command);
            }
        }
        if (!executed) {
            command.execute();
        }
        subMonitor.worked(1);
    }
    // from extension point
    UpdateManagerProviderDetector.INSTANCE.doUpdate(monitor, result);
}
Also used : UpdateNodeParameterCommand(org.talend.designer.core.ui.editor.update.cmd.UpdateNodeParameterCommand) UpdateContextParameterCommand(org.talend.designer.core.ui.editor.update.cmd.UpdateContextParameterCommand) UpdateNodePathCommand(org.talend.designer.core.ui.editor.update.cmd.UpdateNodePathCommand) Command(org.eclipse.gef.commands.Command) UpdateMainParameterCommand(org.talend.designer.core.ui.editor.update.cmd.UpdateMainParameterCommand) UpdateJobletNodeCommand(org.talend.designer.core.ui.editor.update.cmd.UpdateJobletNodeCommand) UpdateNodeParameterCommand(org.talend.designer.core.ui.editor.update.cmd.UpdateNodeParameterCommand) UpdateJunitNodeCommand(org.talend.designer.core.ui.editor.update.cmd.UpdateJunitNodeCommand) UpdateMainParameterCommand(org.talend.designer.core.ui.editor.update.cmd.UpdateMainParameterCommand) IUpdateItemType(org.talend.core.model.update.IUpdateItemType) UpdateNodePathCommand(org.talend.designer.core.ui.editor.update.cmd.UpdateNodePathCommand) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IDesignerCoreUIService(org.talend.core.ui.services.IDesignerCoreUIService) EUpdateItemType(org.talend.core.model.update.EUpdateItemType) SubProgressMonitor(org.eclipse.core.runtime.SubProgressMonitor) IGEFProcess(org.talend.core.ui.process.IGEFProcess)

Aggregations

IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 UpdateNodeParameterCommand (org.talend.designer.core.ui.editor.update.cmd.UpdateNodeParameterCommand)2 SubProgressMonitor (org.eclipse.core.runtime.SubProgressMonitor)1 Command (org.eclipse.gef.commands.Command)1 EUpdateItemType (org.talend.core.model.update.EUpdateItemType)1 EUpdateResult (org.talend.core.model.update.EUpdateResult)1 IUpdateItemType (org.talend.core.model.update.IUpdateItemType)1 UpdateResult (org.talend.core.model.update.UpdateResult)1 IGEFProcess (org.talend.core.ui.process.IGEFProcess)1 IDesignerCoreUIService (org.talend.core.ui.services.IDesignerCoreUIService)1 UpdateContextParameterCommand (org.talend.designer.core.ui.editor.update.cmd.UpdateContextParameterCommand)1 UpdateJobletNodeCommand (org.talend.designer.core.ui.editor.update.cmd.UpdateJobletNodeCommand)1 UpdateJunitNodeCommand (org.talend.designer.core.ui.editor.update.cmd.UpdateJunitNodeCommand)1 UpdateMainParameterCommand (org.talend.designer.core.ui.editor.update.cmd.UpdateMainParameterCommand)1 UpdateNodePathCommand (org.talend.designer.core.ui.editor.update.cmd.UpdateNodePathCommand)1 GenericConnectionItem (org.talend.repository.generic.model.genericMetadata.GenericConnectionItem)1