Search in sources :

Example 1 with XtentisException

use of com.amalto.workbench.utils.XtentisException in project tmdm-studio-se by Talend.

the class DefaultDeployCommand method doExecute.

private IStatus doExecute(Object params, IProgressMonitor monitor) {
    ERepositoryObjectType type = getViewObjectType();
    String objectName = getLabel();
    IInteractiveHandler handler = InteractiveService.findHandler(type);
    if (handler != null) {
        String typeLabel = handler.getLabel();
        monitor.subTask(Messages.bind(Messages.Deploy_text, typeLabel));
        try {
            boolean isOK = handler.deploy(this);
            if (getDeployStatus() != null) {
                return getDeployStatus();
            }
            if (isOK) {
                if (getCommandType() == CMD_MODIFY) {
                    return DeployStatus.getOKStatus(this, Messages.bind(Messages.Deploy_successfully_text, typeLabel, objectName));
                }
                return DeployStatus.getOKStatus(this, Messages.bind(Messages.Create_successfully_text, typeLabel, objectName));
            } else {
                return DeployStatus.getErrorStatus(this, Messages.bind(Messages.Deploy_fail_text, typeLabel, objectName));
            }
        } catch (OperationIgnoredException e) {
            return null;
        } catch (OperationCanceledException e) {
            return DeployStatus.getInfoStatus(this, Messages.bind(Messages.Deploy_cancel_text, typeLabel, objectName));
        } catch (WebServiceException e) {
            return getDetailErrorMsg(Messages.Deploy_fail_cause_text, typeLabel, objectName, e);
        } catch (XtentisException e) {
            return getDetailErrorMsg(Messages.Deploy_fail_cause_text, typeLabel, objectName, e);
        } catch (RuntimeException e) {
            return getDetailErrorMsg(Messages.Deploy_fail_cause_text, typeLabel, objectName, e);
        }
    } else {
        return DeployStatus.getErrorStatus(this, Messages.bind(Messages.Deploy_notSupport_text, objectName));
    }
}
Also used : OperationIgnoredException(com.amalto.workbench.utils.OperationIgnoredException) WebServiceException(javax.xml.ws.WebServiceException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) IInteractiveHandler(org.talend.mdm.repository.core.service.IInteractiveHandler) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 2 with XtentisException

use of com.amalto.workbench.utils.XtentisException in project tmdm-studio-se by Talend.

the class ExportDataClusterAction method doRun.

@Override
protected void doRun() {
    List<Object> selectedObject = getSelectedObject();
    if (!selectedObject.isEmpty()) {
        IRepositoryViewObject viewObj = (IRepositoryViewObject) selectedObject.get(0);
        SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
        if (dialog.open() == IDialogConstants.OK_ID) {
            MDMServerDef serverDef = dialog.getSelectedServerDef();
            MDMServerObjectItem item = (MDMServerObjectItem) viewObj.getProperty().getItem();
            String dName = item.getMDMServerObject().getName();
            try {
                FileDialog fd = new FileDialog(getShell(), SWT.SAVE);
                // $NON-NLS-1$
                fd.setFilterExtensions(new String[] { "*.zip" });
                String fPath = fd.open();
                if (fPath != null) {
                    TMDMService service = RepositoryWebServiceAdapter.getMDMService(serverDef);
                    service.ping(new WSPing(Messages.ExportDataClusterAction_exportContent));
                    DataClusterService dataClusterService = DataClusterService.getIntance();
                    if (dataClusterService.isExistDataCluster(service, dName)) {
                        File tempFolder = IOUtil.getTempFolder();
                        String tempFolderPath = tempFolder.getAbsolutePath();
                        dataClusterService.storeIndexFile(tempFolderPath, dName);
                        // 
                        IDataContentProcess process = dataClusterService.getNewExportContentProcess(service, tempFolderPath, dName, fPath);
                        try {
                            process.run();
                        } catch (InterruptedException e) {
                            // do nothing
                            return;
                        }
                        MultiStatus status = process.getResult();
                        if (status != null && status.getChildren().length > 0) {
                            MessageDialog.openError(getShell(), Messages._Error, Messages.bind(Messages.ExportDataClusterAction_failedExportContent, dName));
                        } else {
                            MessageDialog.openInformation(getShell(), Messages.ExportDataClusterAction_exportContent, Messages.bind(Messages.ExportDataClusterAction_successExport, dName));
                        }
                    } else {
                        MessageDialog.openInformation(getShell(), Messages.Common_Warning, Messages.bind(Messages.ExportDataClusterAction_noContainerFound, dName));
                    }
                }
            } catch (XtentisException e) {
                log.error(e.getMessage(), e);
            } catch (WebServiceException e) {
                MessageDialog.openError(getShell(), Messages.ExportDataClusterAction_exportContent, Messages.AbstractDataClusterAction_ConnectFailed);
            }
        }
    }
}
Also used : WSPing(com.amalto.workbench.webservices.WSPing) DataClusterService(org.talend.mdm.repository.core.service.DataClusterService) WebServiceException(javax.xml.ws.WebServiceException) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IDataContentProcess(org.talend.mdm.repository.core.datacontent.IDataContentProcess) MultiStatus(org.eclipse.core.runtime.MultiStatus) TMDMService(com.amalto.workbench.webservices.TMDMService) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FileDialog(org.eclipse.swt.widgets.FileDialog) File(java.io.File) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 3 with XtentisException

use of com.amalto.workbench.utils.XtentisException in project tmdm-studio-se by Talend.

the class ImportDataClusterAction method doRun.

@Override
protected void doRun() {
    FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
    // $NON-NLS-1$
    fd.setFilterExtensions(new String[] { "*.zip" });
    String fPath = fd.open();
    if (fPath != null) {
        DataClusterService dataClusterService = DataClusterService.getIntance();
        File tempFolder = IOUtil.getTempFolder();
        String tempFolderPath = tempFolder.getAbsolutePath();
        dataClusterService.unZipFile(fPath, tempFolderPath);
        String dName = dataClusterService.loadIndexFile(tempFolderPath);
        if (dName == null) {
            MessageDialog.openError(getShell(), Messages.Common_Error, Messages.ImportDataClusterAction_errorFormat);
            return;
        }
        tempFolderPath += File.separator + dName;
        // 
        SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
        if (dialog.open() == IDialogConstants.OK_ID) {
            MDMServerDef serverDef = dialog.getSelectedServerDef();
            try {
                TMDMService service = RepositoryWebServiceAdapter.getMDMService(serverDef);
                service.ping(new WSPing(Messages.ImportDataClusterAction_importTitle));
                if (!dataClusterService.isExistDataCluster(service, dName)) {
                    if (MessageDialog.openQuestion(getShell(), Messages.ImportDataClusterAction_createDataClusterTitle, Messages.bind(Messages.ImportDataClusterAction_createConfirm, dName))) {
                        dataClusterService.createDataCluster(service, dName);
                    } else {
                        return;
                    }
                }
                IDataContentProcess process = dataClusterService.getNewImportContentProcess(serverDef, dName, tempFolderPath);
                try {
                    process.run();
                } catch (InterruptedException e) {
                    // do nothing
                    return;
                }
                MultiStatus multiStatus = process.getResult();
                if (multiStatus != null && multiStatus.getChildren().length > 0) {
                    MultiStatusDialog statusDialog = new MultiStatusDialog(getShell(), multiStatus.getMessage(), multiStatus);
                    statusDialog.open();
                } else {
                    // show success info
                    MessageDialog.openInformation(getShell(), Messages.ImportDataClusterAction_importTitle, Messages.bind(Messages.ImportDataClusterAction_successImport, dName));
                }
            } catch (XtentisException e) {
                log.error(e.getMessage(), e);
            } catch (WebServiceException e) {
                MessageDialog.openError(getShell(), Messages.ImportDataClusterAction_importTitle, Messages.AbstractDataClusterAction_ConnectFailed);
            } finally {
                IOUtil.cleanFolder(tempFolder);
            }
        }
    }
}
Also used : WSPing(com.amalto.workbench.webservices.WSPing) DataClusterService(org.talend.mdm.repository.core.service.DataClusterService) WebServiceException(javax.xml.ws.WebServiceException) IDataContentProcess(org.talend.mdm.repository.core.datacontent.IDataContentProcess) MultiStatusDialog(org.talend.mdm.repository.ui.dialogs.message.MultiStatusDialog) MultiStatus(org.eclipse.core.runtime.MultiStatus) TMDMService(com.amalto.workbench.webservices.TMDMService) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) FileDialog(org.eclipse.swt.widgets.FileDialog) File(java.io.File) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 4 with XtentisException

use of com.amalto.workbench.utils.XtentisException in project tmdm-studio-se by Talend.

the class XpathSelectDialog method changeDomTree.

protected void changeDomTree(final TreeParent pObject, String filter) {
    String modelDisplay = dataModelCombo.getText();
    if (modelDisplay.length() == 0) {
        return;
    }
    this.dataModelName = modelDisplay;
    // this.selectedDataModelName = modelDisplay;
    // xobject = pObject.findObject(TreeObject.DATA_MODEL, modelDisplay);
    TMDMService service = null;
    try {
        service = Util.getMDMService(pObject);
    } catch (XtentisException e3) {
        log.error(e3.getMessage(), e3);
    } catch (Exception e3) {
        log.error(e3.getMessage(), e3);
    }
    WSDataModel wsDataModel = null;
    String schema = null;
    XSDSchema xsd = null;
    if (service == null) {
        xsd = MDMRepositoryViewExtensionService.getDataModelXsd(pObject, filter, dataModelName);
        provideViwerContent(xsd, filter);
    } else {
        try {
            wsDataModel = service.getDataModel(new WSGetDataModel(new WSDataModelPK(dataModelName)));
            // XSDSchema xsdSchema = Util.getXSDSchema(wsDataModel.getXsdSchema());
            // Util.nodeToString(xsdSchema.getDocument());
            schema = wsDataModel.getXsdSchema();
            xsd = Util.createXsdSchema(schema, pObject);
            provideViwerContent(xsd, filter);
        } catch (Exception e1) {
            log.error(e1.getMessage(), e1);
        }
    }
}
Also used : WSDataModel(com.amalto.workbench.webservices.WSDataModel) TMDMService(com.amalto.workbench.webservices.TMDMService) XtentisException(com.amalto.workbench.utils.XtentisException) XtentisException(com.amalto.workbench.utils.XtentisException) XSDSchema(org.eclipse.xsd.XSDSchema) WSGetDataModel(com.amalto.workbench.webservices.WSGetDataModel) WSDataModelPK(com.amalto.workbench.webservices.WSDataModelPK)

Example 5 with XtentisException

use of com.amalto.workbench.utils.XtentisException in project tmdm-studio-se by Talend.

the class ModelImpactAnalyseService method analyzeModelImpact.

public static Map<IRepositoryViewObject, ImpactOperation> analyzeModelImpact(MDMServerDef serverDef, List<IRepositoryViewObject> modelViewObjs) throws InterruptedException {
    try {
        Map<IRepositoryViewObject, Result> changes = analyzeModelChanges(serverDef, modelViewObjs);
        if (!changes.isEmpty()) {
            Shell shell = Display.getDefault().getActiveShell();
            ImpactResultDialog dialog = new ImpactResultDialog(shell, changes);
            if (dialog.open() == IDialogConstants.OK_ID) {
                Map<IRepositoryViewObject, ImpactOperation> configuration = dialog.getImpactConfiguration();
                return configuration;
            } else {
                Map<IRepositoryViewObject, ImpactOperation> configuration = new HashMap<IRepositoryViewObject, ModelImpactAnalyseService.ImpactOperation>(changes.size());
                for (IRepositoryViewObject viewObj : changes.keySet()) {
                    configuration.put(viewObj, ImpactOperation.CANCEL);
                }
                return configuration;
            }
        }
    } catch (XtentisException e) {
        log.error(e.getMessage(), e);
    }
    return null;
}
Also used : ImpactResultDialog(org.talend.mdm.repository.ui.dialogs.impact.ImpactResultDialog) Shell(org.eclipse.swt.widgets.Shell) HashMap(java.util.HashMap) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) XtentisException(com.amalto.workbench.utils.XtentisException)

Aggregations

XtentisException (com.amalto.workbench.utils.XtentisException)22 TMDMService (com.amalto.workbench.webservices.TMDMService)10 WebServiceException (javax.xml.ws.WebServiceException)8 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)4 WSPing (com.amalto.workbench.webservices.WSPing)3 ArrayList (java.util.ArrayList)3 SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)3 Line (com.amalto.workbench.models.Line)2 TreeObject (com.amalto.workbench.models.TreeObject)2 WSConceptKey (com.amalto.workbench.webservices.WSConceptKey)2 WSDataModelPK (com.amalto.workbench.webservices.WSDataModelPK)2 WSDigest (com.amalto.workbench.webservices.WSDigest)2 WSDigestKey (com.amalto.workbench.webservices.WSDigestKey)2 File (java.io.File)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2