use of com.amalto.workbench.dialogs.DataModelSelectDialog in project tmdm-studio-se by Talend.
the class DataClusterComposite method doSelectDataModelForEntityRecords.
/**
* @param clusterName
* @throws XtentisException
* @throws Exception
*/
private boolean doSelectDataModelForEntityRecords(String clusterName) throws XtentisException, Exception {
// if (false) {
// Modified by hbhong,to fix bug 21784|
TreeParent treeParent = (TreeParent) getAdapter(TreeParent.class);
DataModelSelectDialog dialog = new DataModelSelectDialog(getSite(), treeParent, clusterName);
// The ending| bug:21784
dialog.setBlockOnOpen(true);
dialog.open();
if (dialog.getReturnCode() == Window.OK) {
List<String> allConcept = new ArrayList<String>();
String[] xpaths = dialog.getXpath();
for (String xpath : xpaths) {
WSDataModel dm = Util.getMDMService(this.getXObject()).getDataModel(new WSGetDataModel(new WSDataModelPK(xpath)));
if (dm == null) {
return false;
}
List<String> concepts = Util.getConcepts(Util.getXSDSchema(dm.getXsdSchema()));
allConcept.addAll(concepts);
}
String[] concepts = allConcept.toArray(new String[0]);
TreeObject object = null;
TreeObject[] children = treeParent.getChildren();
for (TreeObject element : children) {
object = element;
if (object.getType() == TreeObject.DATA_MODEL) {
break;
}
}
// $NON-NLS-1$
String revision = "";
if (object != null) {
// revisions).
if (object.getDisplayName().contains(Messages.DataClusterBrowserMainPage_16) && object.getDisplayName().contains(Messages.DataClusterBrowserMainPage_17)) {
revision = // $NON-NLS-1$
object.getDisplayName().substring(// $NON-NLS-1$
object.getDisplayName().indexOf("[") + 1, // $NON-NLS-1$
object.getDisplayName().indexOf("]"));
}
}
for (int i = 0; i < concepts.length; i++) {
String concept = concepts[i];
if (revision == null || revision.equals("")) {
// $NON-NLS-1$
// $NON-NLS-1$
revision = "HEAD";
}
// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
concepts[i] = concept + " " + "[" + revision + "]";
}
conceptCombo.removeAll();
// $NON-NLS-1$
conceptCombo.add("*");
for (String concept : concepts) {
conceptCombo.add(concept);
}
} else {
// $NON-NLS-1$
conceptCombo.add("*");
}
return true;
}
Aggregations