Search in sources :

Example 1 with MDMServerDef

use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef 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 MDMServerDef

use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.

the class DeployOnMDMAction method getMdmServer.

private MDMServerDef getMdmServer(SpagoBiServer spagoBiServer) {
    MDMServerDef mdmServerDef = MdmmetadataFactory.eINSTANCE.createMDMServerDef();
    mdmServerDef.setName(spagoBiServer.getShortDescription());
    mdmServerDef.setHost(spagoBiServer.getHost());
    mdmServerDef.setPort(spagoBiServer.getPort());
    mdmServerDef.setUser(spagoBiServer.getLogin());
    mdmServerDef.setPasswd(spagoBiServer.getPassword());
    return mdmServerDef;
}
Also used : MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 3 with MDMServerDef

use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.

the class MDMServerDefItemImpl method getServerDef.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public MDMServerDef getServerDef() {
    if (serverDef != null && serverDef.eIsProxy()) {
        InternalEObject oldServerDef = (InternalEObject) serverDef;
        serverDef = (MDMServerDef) eResolveProxy(oldServerDef);
        if (serverDef.eResource() == null && eResource() != null) {
            URI uri = EcoreUtil.getURI(serverDef);
            if (uri.hasFragment()) {
                uri = uri.trimFragment();
            }
            Resource resource = eResource().getResourceSet().getResource(uri, true);
            for (EObject object : resource.getContents()) {
                if (object instanceof MDMServerDef) {
                    serverDef = (MDMServerDef) object;
                    break;
                }
            }
        }
        if (serverDef != oldServerDef) {
            if (eNotificationRequired()) {
                eNotify(new ENotificationImpl(this, Notification.RESOLVE, MdmpropertiesPackage.MDM_SERVER_DEF_ITEM__SERVER_DEF, oldServerDef, serverDef));
            }
        }
    }
    return serverDef;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) Resource(org.eclipse.emf.ecore.resource.Resource) URI(org.eclipse.emf.common.util.URI) InternalEObject(org.eclipse.emf.ecore.InternalEObject) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 4 with MDMServerDef

use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.

the class MDMServerDefImpl method getDecryptedServerDef.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.mdm.repository.model.mdmmetadata.MDMServerDef#getDecryptedServerDef()
     */
@Override
public MDMServerDef getDecryptedServerDef() {
    MDMServerDef clone = EcoreUtil.copy(this);
    if (clone.getPasswd() == null || clone.getPasswd().trim().length() == 0) {
        clone.setPasswd(getTempPasswd());
    } else {
        String decryptedPassword = PasswordUtil.decryptPassword(getPasswd(), algorithm);
        clone.setPasswd(decryptedPassword);
    }
    return clone;
}
Also used : MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 5 with MDMServerDef

use of org.talend.mdm.repository.model.mdmmetadata.MDMServerDef in project tmdm-studio-se by Talend.

the class MDMServerDefImpl method getEncryptedServerDef.

@Override
public MDMServerDef getEncryptedServerDef() {
    MDMServerDef clone = EcoreUtil.copy(this);
    String encryptedPassword = PasswordUtil.encryptPassword(getPasswd(), algorithm);
    clone.setPasswd(encryptedPassword);
    return clone;
}
Also used : MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Aggregations

MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)66 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)36 SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)15 Item (org.talend.core.model.properties.Item)11 MDMServerDefItem (org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem)10 MDMServerObjectItem (org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)10 IStatus (org.eclipse.core.runtime.IStatus)8 MDMServerObject (org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)8 PersistenceException (org.talend.commons.exception.PersistenceException)7 AbstractDeployCommand (org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand)7 TMDMService (com.amalto.workbench.webservices.TMDMService)6 CommandManager (org.talend.mdm.repository.core.command.CommandManager)6 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)6 TreeObject (com.amalto.workbench.models.TreeObject)5 XtentisException (com.amalto.workbench.utils.XtentisException)5 ArrayList (java.util.ArrayList)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 Test (org.junit.Test)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 LinkedList (java.util.LinkedList)4