use of org.talend.mdm.engines.client.ui.wizards.DeployOnMDMExportWizard in project tmdm-studio-se by Talend.
the class DeployOnMDMAction method doRun.
@Override
protected void doRun() {
List<IRepositoryViewObject> viewObjs = getSelectedViewObject();
DeployOnMDMExportWizard publishWizard = new DeployOnMDMExportWizard();
publishWizard.setWindowTitle(EXPORTJOBSCRIPTS);
publishWizard.init(getWorkbench(), (IStructuredSelection) this.getSelection());
Shell activeShell = Display.getCurrent().getActiveShell();
WizardDialog dialog = new WizardDialog(activeShell, publishWizard);
dialog.open();
boolean deploySucceed = publishWizard.isDeploySucceed();
if (deploySucceed) {
IRemoveCommandService service = (IRemoveCommandService) GlobalServiceRegister.getDefault().getService(IRemoveCommandService.class);
SpagoBiServer spagoBiServer = publishWizard.getMdmServer();
MDMServerDef mdmServer = getMdmServer(spagoBiServer);
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
try {
for (IRepositoryViewObject viewObj : viewObjs) {
Item item = viewObj.getProperty().getItem();
Property property = item.getProperty();
if (property != null) {
boolean eDeliver = property.eDeliver();
property.eSetDeliver(false);
property.getAdditionalProperties().put(PROP_LAST_SERVER_DEF, mdmServer.getName());
factory.save(item);
property.eSetDeliver(eDeliver);
}
refreshMdmRepositoryViewTree();
service.removeDeployPhaseCommandOf(ERepositoryObjectType.PROCESS, item);
}
} catch (PersistenceException e) {
log.error(e.getMessage(), e);
}
}
}
use of org.talend.mdm.engines.client.ui.wizards.DeployOnMDMExportWizard in project tmdm-studio-se by Talend.
the class JobInteractiveHandler method deploy.
@Override
public boolean deploy(AbstractDeployCommand cmd) throws XtentisException {
setToDefaultValue();
if (cmd instanceof BatchDeployJobCommand) {
BatchDeployJobCommand deployJobCommand = (BatchDeployJobCommand) cmd;
List<IRepositoryViewObject> viewObjects = deployJobCommand.getViewObjects();
if (viewObjects.isEmpty()) {
return true;
}
IStructuredSelection selection = getSelection(viewObjects);
//
final DeployOnMDMExportWizard publishWizard = new DeployOnMDMExportWizard();
SpagoBiServer server = getServer(deployJobCommand.getServerDef());
publishWizard.setMdmServer(server);
IWorkbench workbench = RepositoryPlugin.getDefault().getWorkbench();
publishWizard.setWindowTitle(Messages.JobInteractiveHandler_wizardTitle);
publishWizard.init(workbench, selection);
final Display display = Display.getDefault();
display.syncExec(new Runnable() {
public void run() {
Shell activeShell = display.getActiveShell();
WizardDialog dialog = new WizardDialog(activeShell, publishWizard);
int open = dialog.open();
if (open == IDialogConstants.CANCEL_ID) {
setDeployCancelled(true);
} else {
setResult(publishWizard.isDeploySucceed());
RuntimeException e = publishWizard.getDeployException();
if (e != null) {
setException(e);
}
}
}
});
}
if (deployCancelled) {
throw new OperationCanceledException();
}
if (deployException != null) {
throw deployException;
}
return result;
}
Aggregations