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();
}
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);
}
Aggregations