Search in sources :

Example 1 with IRemoveCommandService

use of com.amalto.workbench.service.bridge.IRemoveCommandService 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)

Aggregations

IRemoveCommandService (com.amalto.workbench.service.bridge.IRemoveCommandService)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 Shell (org.eclipse.swt.widgets.Shell)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 Item (org.talend.core.model.properties.Item)1 Property (org.talend.core.model.properties.Property)1 SpagoBiServer (org.talend.core.model.properties.SpagoBiServer)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 DeployOnMDMExportWizard (org.talend.mdm.engines.client.ui.wizards.DeployOnMDMExportWizard)1 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)1 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)1