Search in sources :

Example 6 with XtentisException

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

the class RepositoryWebServiceAdapter method getMDMService.

public static TMDMService getMDMService(Shell shell, MDMServerDef lastserverDef) {
    if (lastserverDef == null) {
        MessageDialog.openWarning(null, Messages.Warning_text, Messages.RepositoryWebServiceAdapter_DeployFirst);
        return null;
    }
    SelectServerDefDialog dialog = new SelectServerDefDialog(shell);
    dialog.create();
    dialog.setSelectServer(lastserverDef);
    try {
        if (dialog.open() == IDialogConstants.OK_ID) {
            MDMServerDef serverDef = dialog.getSelectedServerDef();
            TMDMService port = RepositoryWebServiceAdapter.getMDMService(serverDef);
            return port;
        }
    } catch (XtentisException e) {
        log.error(e.getMessage(), e);
    }
    return null;
}
Also used : TMDMService(com.amalto.workbench.webservices.TMDMService) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 7 with XtentisException

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

the class RepositoryResourceUtil method getBusinessConceptKey.

public static WSConceptKey getBusinessConceptKey(WSGetBusinessConceptKey businessConcepKey) throws XtentisException {
    String pk = businessConcepKey.getWsDataModelPK().getPk();
    String concept = businessConcepKey.getConcept();
    WSDataModelE dataModel = RepositoryQueryService.findDataModelByName(pk);
    if (dataModel != null) {
        try {
            XSDSchema xsdSchema = Util.getXSDSchema(dataModel.getXsdSchema());
            for (XSDIdentityConstraintDefinition idDef : xsdSchema.getIdentityConstraintDefinitions()) {
                if (idDef.getName().equals(concept)) {
                    WSConceptKey key = new WSConceptKey();
                    // 
                    XSDXPathDefinition selector = idDef.getSelector();
                    key.setSelector(selector.getValue());
                    // 
                    EList<XSDXPathDefinition> fields = idDef.getFields();
                    List<String> keyFields = new ArrayList<String>();
                    for (XSDXPathDefinition pathDef : fields) {
                        keyFields.add(pathDef.getValue());
                    }
                    key.getFields().clear();
                    key.getFields().addAll(keyFields);
                    return key;
                }
            }
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }
    return null;
}
Also used : WSDataModelE(org.talend.mdm.repository.model.mdmserverobject.WSDataModelE) ArrayList(java.util.ArrayList) XSDIdentityConstraintDefinition(org.eclipse.xsd.XSDIdentityConstraintDefinition) XSDXPathDefinition(org.eclipse.xsd.XSDXPathDefinition) WSConceptKey(com.amalto.workbench.webservices.WSConceptKey) CoreException(org.eclipse.core.runtime.CoreException) PartInitException(org.eclipse.ui.PartInitException) LoginException(org.talend.commons.exception.LoginException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IOException(java.io.IOException) XtentisException(com.amalto.workbench.utils.XtentisException) FileNotFoundException(java.io.FileNotFoundException) PersistenceException(org.talend.commons.exception.PersistenceException) XSDSchema(org.eclipse.xsd.XSDSchema)

Example 8 with XtentisException

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

the class XSDDeleteConceptAction method checkContainFK.

protected boolean checkContainFK(String fkName) throws Exception {
    // add by ymli. fix buy 0010029
    Set<String> list = Util.getForeignKeys();
    if (list == null) {
        TMDMService service = null;
        try {
            service = Util.getMDMService(page.getXObject());
        } catch (XtentisException e) {
            log.error(e.getMessage(), e);
        }
        list = new HashSet<String>();
        Util.getForeingKeyInDataModel(list, page.getXObject().getParent(), service);
        Util.setForeignKeys(list);
    }
    return list.contains(fkName);
}
Also used : TMDMService(com.amalto.workbench.webservices.TMDMService) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 9 with XtentisException

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

the class TreeObjectCheckTreeViewer method initConsistencyData.

private Map<TreeObject, ConsistencyData> initConsistencyData(MDMServerDef serverDef, List<TreeObject> treeObjs) {
    Map<TreeObject, ConsistencyData> map = new HashMap<TreeObject, ConsistencyData>();
    try {
        ConsistencyService consistencyService = ConsistencyService.getInstance();
        Map<TreeObject, WSDigest> serverDigestValues = consistencyService.queryServerDigestValue(serverDef, treeObjs);
        if (treeObjs.size() > 0 && serverDigestValues.isEmpty()) {
            return map;
        }
        for (TreeObject treeObject : treeObjs) {
            ConsistencyData consistencyData = new ConsistencyData();
            WSDigest serverDigestTime = serverDigestValues.get(treeObject);
            consistencyData.setServerDigestTime(serverDigestTime);
            String objName = getTreeObjectName(treeObject);
            ERepositoryObjectType viewType = RepositoryQueryService.getRepositoryObjectType(treeObject.getType());
            if (viewType == null) {
                continue;
            }
            if (viewType == IServerObjectRepositoryType.TYPE_RESOURCE || viewType == IServerObjectRepositoryType.TYPE_JOB || viewType == IServerObjectRepositoryType.TYPE_WORKFLOW) {
                consistencyData.setCompareResult(CompareResultEnum.NOT_SUPPORT);
            } else {
                IRepositoryViewObject viewObj = RepositoryResourceUtil.findViewObjectByName(viewType, objName);
                if (viewObj == null) {
                    consistencyData.setCompareResult(CompareResultEnum.NOT_EXIST_IN_LOCAL);
                } else {
                    consistencyService.updateCurrentDigestValue(viewObj);
                    Item item = viewObj.getProperty().getItem();
                    String ld = consistencyService.getLocalDigestValue(item);
                    String cd = consistencyService.getCurrentDigestValue(item);
                    long localTimestamp = consistencyService.getLocalTimestamp(item);
                    // key
                    String type = viewObj.getRepositoryObjectType().getKey();
                    String objectName = viewObj.getLabel();
                    WSDigestKey key = new WSDigestKey(objectName, type);
                    consistencyData.setLocalDigestTime(new WSDigest(ld, localTimestamp, key));
                    // init compare result;
                    CompareResultEnum result;
                    if (serverDigestTime == null || serverDigestTime.getDigestValue() == null) {
                        result = CompareResultEnum.NOT_EXIST_IN_SERVER;
                    } else {
                        String rd = serverDigestTime.getDigestValue();
                        result = consistencyService.getCompareResult(cd, ld, rd);
                    }
                    consistencyData.setCompareResult(result);
                }
            }
            map.put(treeObject, consistencyData);
        }
    } catch (WebServiceException e) {
        log.error(e.getMessage(), e);
    } catch (XtentisException e) {
        log.error(e.getMessage(), e);
    }
    return map;
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) HashMap(java.util.HashMap) WSDigestKey(com.amalto.workbench.webservices.WSDigestKey) WSDigest(com.amalto.workbench.webservices.WSDigest) ConsistencyService(org.talend.mdm.repository.core.service.ConsistencyService) Item(org.talend.core.model.properties.Item) TreeItem(org.eclipse.swt.widgets.TreeItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TreeObject(com.amalto.workbench.models.TreeObject) CompareResultEnum(org.talend.mdm.repository.core.service.ConsistencyService.CompareResultEnum) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) ConsistencyData(org.talend.mdm.repository.core.service.ConsistencyService.ConsistencyData) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 10 with XtentisException

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

the class ServerDefDialog method buttonPressed.

@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.OK_ID) {
        if (!validateInput()) {
            return;
        }
        updateUI2Model(serverDef);
    }
    if (buttonId == CHECK_CONNECTION_ID) {
        if (!validateInput()) {
            return;
        }
        MDMServerDef tmpServerDef = MdmmetadataFactory.eINSTANCE.createMDMServerDef();
        tmpServerDef.setAlgorithm(PasswordUtil.ALGORITHM_COMMON_V2);
        updateUI2Model(tmpServerDef);
        try {
            ServerDefService.checkMDMConnection(tmpServerDef.getDecryptedServerDef());
            setMessage(Messages.ServerExplorer_ConnectSuccessful);
        } catch (MissingJarsException e) {
            return;
        } catch (XtentisException e) {
            setErrorMessage(Messages.ServerExplorer_ConnectFailed);
        } catch (MalformedURLException e) {
            setErrorMessage(Messages.ServerExplorer_ConnectFailed);
        }
    }
    super.buttonPressed(buttonId);
}
Also used : MalformedURLException(java.net.MalformedURLException) MissingJarsException(com.amalto.workbench.service.MissingJarsException) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) 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