Search in sources :

Example 46 with MDMServerDef

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

the class SelectImportedModulesDialog2 method getPort.

@Override
protected TMDMService getPort() throws XtentisException {
    SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
    if (dialog.open() == IDialogConstants.OK_ID) {
        MDMServerDef serverDef = dialog.getSelectedServerDef();
        this.serverDef = serverDef;
        return RepositoryWebServiceAdapter.getMDMService(serverDef);
    }
    return null;
}
Also used : SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 47 with MDMServerDef

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

the class RenameViewAction method renameViewObject.

private void renameViewObject(IRepositoryViewObject viewObj) {
    MDMServerObjectItem item = (MDMServerObjectItem) viewObj.getProperty().getItem();
    MDMServerObject serverObject = item.getMDMServerObject();
    IProxyRepositoryFactory factory = getFactory();
    try {
        if (serverObject != null) {
            String oldName = serverObject.getName();
            RenameViewDialog dialog = getRenameDialog(oldName);
            int returnCode = dialog.open();
            if (returnCode == IDialogConstants.OK_ID) {
                String newName = dialog.getValue();
                if (RepositoryTransformUtil.getInstance().getViewType(oldName) == TYPE_WEBFILTER) {
                    newName = PREFIX_VIEW_UPPER + newName;
                } else {
                    if (newName.startsWith(PREFIX_VIEW_UPPER)) {
                        viewTypeChanged = true;
                        item.getState().setPath(IPath.SEPARATOR + PATH_WEBFILTER);
                    }
                }
                if (newName != null && factory.isEditableAndLockIfPossible(item)) {
                    serverObject.setName(newName);
                    viewObj.getProperty().setLabel(newName);
                    viewObj.getProperty().setDisplayName(newName);
                    factory.save(viewObj.getProperty().getItem(), false);
                    MDMServerDef lastServerDef = RepositoryResourceUtil.getLastServerDef(viewObj);
                    if (lastServerDef != null) {
                        CommandManager.getInstance().pushCommand(ICommand.CMD_RENAME, viewObj.getId(), new String[] { oldName, newName });
                    }
                }
                commonViewer.refresh(viewObj);
            }
        }
    } catch (PersistenceException e) {
        log.error(e.getMessage(), e);
    } finally {
        try {
            factory.unlock(item);
        } catch (PersistenceException e) {
            log.error(e.getMessage(), e);
        } catch (LoginException e) {
            log.error(e.getMessage(), e);
        }
    }
}
Also used : MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) PersistenceException(org.talend.commons.exception.PersistenceException) RenameViewDialog(org.talend.mdm.repository.ui.dialogs.RenameViewDialog) LoginException(org.talend.commons.exception.LoginException) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 48 with MDMServerDef

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

the class MDMServerDecorator method decorateRepositoryObject.

private void decorateRepositoryObject(Item item, IDecoration decoration) {
    if (item != null) {
        String version = item.getProperty().getVersion();
        if (item instanceof WSResourceItem) {
            // resource image show catalog
            WSResourceItem ritem = (WSResourceItem) item;
            String imageCatalog = ritem.getResource().getImageCatalog();
            if (imageCatalog != null) {
                // $NON-NLS-1$
                decoration.addSuffix(" " + imageCatalog);
            }
        } else if (version != null) {
            // $NON-NLS-1$
            decoration.addSuffix(" " + version);
        }
        MDMServerDef serverDef = RepositoryResourceUtil.getLastServerDef(item);
        if (serverDef != null) {
            decoration.addOverlay(IMG_SERVER, IDecoration.TOP_RIGHT);
            // $NON-NLS-1$
            decoration.addSuffix(" " + serverDef.getName());
        }
    }
}
Also used : WSResourceItem(org.talend.mdm.repository.model.mdmproperties.WSResourceItem) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 49 with MDMServerDef

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

the class ConnectToWebUIAction method getUrl.

private String getUrl() {
    // $NON-NLS-1$
    String path = "/talendmdm";
    // $NON-NLS-1$
    String defaultHostPort = "http://localhost:8080";
    List<IRepositoryViewObject> viewObjects = ServerDefService.getAllServerDefViewObjects();
    if (viewObjects == null || viewObjects.size() == 0) {
        return defaultHostPort + path;
    }
    SelectServerDefDialog selServerDlg = getSelectServerDefDialog();
    if (selServerDlg.open() == IDialogConstants.OK_ID) {
        MDMServerDef serverDef = selServerDlg.getSelectedServerDef();
        return serverDef.getProtocol() + serverDef.getHost() + ":" + serverDef.getPort() + // $NON-NLS-1$
        Util.getContextPath(serverDef.getPath());
    }
    return null;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 50 with MDMServerDef

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

the class UserSecurityComboBoxDialogCellEditor method getSchemaFromServer.

private String getSchemaFromServer() {
    String schema = null;
    MDMServerDef serverDef = getServerDef();
    if (isAccessible(serverDef)) {
        TMDMService service = getService(serverDef);
        WSDataModel wsDataModel = service.getDataModel(new WSGetDataModel(new WSDataModelPK(dataModelName)));
        schema = wsDataModel.getXsdSchema();
    }
    return schema;
}
Also used : WSDataModel(com.amalto.workbench.webservices.WSDataModel) TMDMService(com.amalto.workbench.webservices.TMDMService) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) WSGetDataModel(com.amalto.workbench.webservices.WSGetDataModel) WSDataModelPK(com.amalto.workbench.webservices.WSDataModelPK)

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