Search in sources :

Example 1 with DeployOnMDMExportWizard

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);
        }
    }
}
Also used : SpagoBiServer(org.talend.core.model.properties.SpagoBiServer) Item(org.talend.core.model.properties.Item) Shell(org.eclipse.swt.widgets.Shell) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) IRemoveCommandService(com.amalto.workbench.service.bridge.IRemoveCommandService) WizardDialog(org.eclipse.jface.wizard.WizardDialog) Property(org.talend.core.model.properties.Property) DeployOnMDMExportWizard(org.talend.mdm.engines.client.ui.wizards.DeployOnMDMExportWizard) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 2 with DeployOnMDMExportWizard

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;
}
Also used : SpagoBiServer(org.talend.core.model.properties.SpagoBiServer) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IWorkbench(org.eclipse.ui.IWorkbench) Shell(org.eclipse.swt.widgets.Shell) BatchDeployJobCommand(org.talend.mdm.repository.core.command.deploy.job.BatchDeployJobCommand) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) WizardDialog(org.eclipse.jface.wizard.WizardDialog) DeployOnMDMExportWizard(org.talend.mdm.engines.client.ui.wizards.DeployOnMDMExportWizard) Display(org.eclipse.swt.widgets.Display)

Aggregations

WizardDialog (org.eclipse.jface.wizard.WizardDialog)2 Shell (org.eclipse.swt.widgets.Shell)2 SpagoBiServer (org.talend.core.model.properties.SpagoBiServer)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 DeployOnMDMExportWizard (org.talend.mdm.engines.client.ui.wizards.DeployOnMDMExportWizard)2 IRemoveCommandService (com.amalto.workbench.service.bridge.IRemoveCommandService)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Display (org.eclipse.swt.widgets.Display)1 IWorkbench (org.eclipse.ui.IWorkbench)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 Item (org.talend.core.model.properties.Item)1 Property (org.talend.core.model.properties.Property)1 BatchDeployJobCommand (org.talend.mdm.repository.core.command.deploy.job.BatchDeployJobCommand)1 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)1 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)1