Search in sources :

Example 1 with WSDataModelPK

use of com.amalto.workbench.webservices.WSDataModelPK in project tmdm-studio-se by Talend.

the class DOMViewDialog method updateKeyMap.

private void updateKeyMap(String dataModelName) {
    if (dataModelName == null || port == null) {
        return;
    }
    if (keyWordMap.get(dataModelName) == null) {
        WSGetDataModel wsGetModel = new WSGetDataModel(new WSDataModelPK(dataModelName));
        try {
            WSDataModel dataModel = port.getDataModel(wsGetModel);
            String xsdSchemaStr = dataModel.getXsdSchema();
            if (xsdSchemaStr != null) {
                XSDSchema schema = Util.getXSDSchema(xsdSchemaStr);
                Set<String> allKeyWords = getAllKeyWords(schema);
                if (!allKeyWords.isEmpty()) {
                    String[] keys = allKeyWords.toArray(new String[0]);
                    Arrays.sort(keys);
                    keyWordMap.put(dataModelName, keys);
                }
            }
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        }
    }
}
Also used : WSDataModel(com.amalto.workbench.webservices.WSDataModel) WSGetDataModel(com.amalto.workbench.webservices.WSGetDataModel) WSDataModelPK(com.amalto.workbench.webservices.WSDataModelPK) XSDSchema(org.eclipse.xsd.XSDSchema)

Example 2 with WSDataModelPK

use of com.amalto.workbench.webservices.WSDataModelPK in project tmdm-studio-se by Talend.

the class SelectImportedModulesDialog method resolveSchemaList.

protected boolean resolveSchemaList(List<String> schemaList) throws XtentisException {
    TMDMService port = getPort();
    if (port == null) {
        MessageDialog.openError(getShell(), Messages._Error, Messages.ServerNotNull);
        return false;
    }
    // $NON-NLS-1$
    List<WSDataModelPK> xdmPKs = port.getDataModelPKs(new WSRegexDataModelPKs("")).getWsDataModelPKs();
    if (xdmPKs != null) {
        for (WSDataModelPK xdmPK : xdmPKs) {
            String name = xdmPK.getPk();
            if (!name.startsWith("XMLSCHEMA")) {
                // $NON-NLS-1$
                schemaList.add(name);
            }
        }
    }
    return true;
}
Also used : TMDMService(com.amalto.workbench.webservices.TMDMService) WSRegexDataModelPKs(com.amalto.workbench.webservices.WSRegexDataModelPKs) WSDataModelPK(com.amalto.workbench.webservices.WSDataModelPK)

Example 3 with WSDataModelPK

use of com.amalto.workbench.webservices.WSDataModelPK 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 4 with WSDataModelPK

use of com.amalto.workbench.webservices.WSDataModelPK in project tmdm-studio-se by Talend.

the class Util method getForeingKeyInDataModel.

/**
 * set the list with all the foreign concepty name in the parent
 *
 * @author ymli
 * @param list
 * @param parent
 * @throws Exception
 */
public static void getForeingKeyInDataModel(Set<String> list, TreeParent parent, TMDMService service) throws Exception {
    TreeObject[] children = parent.getChildren();
    for (TreeObject object : children) {
        if (object instanceof TreeParent) {
            getForeingKeyInDataModel(list, (TreeParent) object, service);
            continue;
        }
        WSDataModel wsDataModel = service.getDataModel(new WSGetDataModel(new WSDataModelPK(object.getDisplayName())));
        XSDSchema xsd = Util.createXsdSchema(wsDataModel.getXsdSchema(), object);
        getForeingKeyInSchema(list, xsd);
    }
}
Also used : WSDataModel(com.amalto.workbench.webservices.WSDataModel) TreeParent(com.amalto.workbench.models.TreeParent) TreeObject(com.amalto.workbench.models.TreeObject) WSGetDataModel(com.amalto.workbench.webservices.WSGetDataModel) WSDataModelPK(com.amalto.workbench.webservices.WSDataModelPK) XSDSchema(org.eclipse.xsd.XSDSchema)

Example 5 with WSDataModelPK

use of com.amalto.workbench.webservices.WSDataModelPK in project tmdm-studio-se by Talend.

the class Util method getDataModel.

// The ending| bug:21784
public static List<String> getDataModel(TreeObject obj, String datamodel, String conceptName) {
    List<String> systemDataModelValues = Util.getChildren(obj.getServerRoot(), TreeObject.DATA_MODEL);
    // filter the datamodel according to conceptName
    List<String> avaiList = new ArrayList<String>();
    avaiList.addAll(systemDataModelValues);
    if (datamodel != null) {
        avaiList.clear();
        avaiList.add(datamodel);
    } else if (conceptName != null && !conceptName.contains("*")) {
        // $NON-NLS-1$
        for (String data : systemDataModelValues) {
            try {
                WSDataModel dm = Util.getMDMService(obj).getDataModel(new WSGetDataModel(new WSDataModelPK(data)));
                if (dm != null) {
                    // XSDSchema xsdSchema = Util.getXSDSchema(dm.getXsdSchema());
                    String schema = dm.getXsdSchema();
                    // $NON-NLS-1$//$NON-NLS-2$
                    Pattern p = Pattern.compile("<xsd:element(.*?)name=\"" + conceptName + "\"");
                    if (!p.matcher(schema).find()) {
                        avaiList.remove(data);
                    }
                }
            } catch (Exception e1) {
                log.error(e1.getMessage(), e1);
            }
        }
    }
    if (avaiList.size() == 0) {
        avaiList.addAll(systemDataModelValues);
    }
    return avaiList;
}
Also used : Pattern(java.util.regex.Pattern) WSDataModel(com.amalto.workbench.webservices.WSDataModel) ArrayList(java.util.ArrayList) ConnectException(java.net.ConnectException) IOException(java.io.IOException) WebServiceException(javax.xml.ws.WebServiceException) MissingJarsException(com.amalto.workbench.service.MissingJarsException) MalformedURLException(java.net.MalformedURLException) SAXParseException(org.xml.sax.SAXParseException) InaccessibleWSDLException(com.sun.xml.internal.ws.wsdl.parser.InaccessibleWSDLException) WSGetDataModel(com.amalto.workbench.webservices.WSGetDataModel) WSDataModelPK(com.amalto.workbench.webservices.WSDataModelPK)

Aggregations

WSDataModelPK (com.amalto.workbench.webservices.WSDataModelPK)17 WSDataModel (com.amalto.workbench.webservices.WSDataModel)10 WSGetDataModel (com.amalto.workbench.webservices.WSGetDataModel)10 TMDMService (com.amalto.workbench.webservices.TMDMService)8 TreeObject (com.amalto.workbench.models.TreeObject)6 ArrayList (java.util.ArrayList)6 WSDataClusterPK (com.amalto.workbench.webservices.WSDataClusterPK)5 WSRegexDataModelPKs (com.amalto.workbench.webservices.WSRegexDataModelPKs)4 TreeParent (com.amalto.workbench.models.TreeParent)3 WSDataCluster (com.amalto.workbench.webservices.WSDataCluster)3 WSGetDataCluster (com.amalto.workbench.webservices.WSGetDataCluster)3 WSGetMenu (com.amalto.workbench.webservices.WSGetMenu)3 WSGetRoutingRule (com.amalto.workbench.webservices.WSGetRoutingRule)3 WSGetStoredProcedure (com.amalto.workbench.webservices.WSGetStoredProcedure)3 WSGetTransformerV2 (com.amalto.workbench.webservices.WSGetTransformerV2)3 WSGetView (com.amalto.workbench.webservices.WSGetView)3 WSMenu (com.amalto.workbench.webservices.WSMenu)3 WSMenuPK (com.amalto.workbench.webservices.WSMenuPK)3 WSRoutingRule (com.amalto.workbench.webservices.WSRoutingRule)3 WSRoutingRulePK (com.amalto.workbench.webservices.WSRoutingRulePK)3