use of com.amalto.workbench.webservices.WSDataModel 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);
}
}
}
use of com.amalto.workbench.webservices.WSDataModel 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);
}
}
}
use of com.amalto.workbench.webservices.WSDataModel 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);
}
}
use of com.amalto.workbench.webservices.WSDataModel 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;
}
use of com.amalto.workbench.webservices.WSDataModel in project tmdm-studio-se by Talend.
the class Util method getXSDSchema.
public static XSDSchema getXSDSchema(TreeObject treeObj, String dataModelName) {
TreeObject dataModelFolder = treeObj.findServerFolder(TreeObject.DATA_MODEL);
TMDMService port = null;
try {
port = Util.getMDMService(dataModelFolder);
} catch (XtentisException e3) {
log.error(e3.getMessage(), e3);
} catch (Exception e3) {
log.error(e3.getMessage(), e3);
}
WSDataModel wsDataModel = null;
try {
wsDataModel = port.getDataModel(new WSGetDataModel(new WSDataModelPK(dataModelName)));
String schema = wsDataModel.getXsdSchema();
return Util.createXsdSchema(schema, dataModelFolder);
} catch (Exception e1) {
log.error(e1.getMessage(), e1);
}
return null;
}
Aggregations