use of com.amalto.workbench.webservices.WSDataModelPK 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;
}
use of com.amalto.workbench.webservices.WSDataModelPK in project tmdm-studio-se by Talend.
the class EditXObjectAction method run.
@Override
public void run() {
try {
super.run();
if (xobject == null || !xobject.isXObject()) {
return;
}
// Access to server and get port
TMDMService service = Util.getMDMService(new URL(xobject.getEndpointAddress()), xobject.getUsername(), xobject.getPassword());
switch(xobject.getType()) {
case TreeObject.DATA_MODEL:
WSDataModel wsDataModel = service.getDataModel(new WSGetDataModel((WSDataModelPK) xobject.getWsKey()));
xobject.setWsObject(wsDataModel);
// XSDEditorUtil.openDataModel(xobject, false);
return;
case TreeObject.VIEW:
WSView wsView = service.getView(new WSGetView((WSViewPK) xobject.getWsKey()));
xobject.setWsObject(wsView);
break;
case TreeObject.DATA_CLUSTER:
WSDataCluster wsDataCluster = service.getDataCluster(new WSGetDataCluster((WSDataClusterPK) xobject.getWsKey()));
xobject.setWsObject(wsDataCluster);
break;
case TreeObject.STORED_PROCEDURE:
WSStoredProcedure wsStoredProcedure = service.getStoredProcedure(new WSGetStoredProcedure((WSStoredProcedurePK) xobject.getWsKey()));
xobject.setWsObject(wsStoredProcedure);
break;
case TreeObject.ROUTING_RULE:
WSRoutingRule wsRoutingRule = service.getRoutingRule(new WSGetRoutingRule((WSRoutingRulePK) xobject.getWsKey()));
xobject.setWsObject(wsRoutingRule);
break;
case TreeObject.TRANSFORMER:
WSTransformerV2 wsTranformer = service.getTransformerV2(new WSGetTransformerV2((WSTransformerV2PK) xobject.getWsKey()));
xobject.setWsObject(wsTranformer);
break;
case TreeObject.MENU:
WSMenu wsMenu = service.getMenu(new WSGetMenu((WSMenuPK) xobject.getWsKey()));
xobject.setWsObject(wsMenu);
break;
case TreeObject.SERVICE_CONFIGURATION:
break;
case TreeObject.JOB_REGISTRY:
// System.out.println("JOB_REGISTRY "+ xobject.getDisplayName());
break;
case TreeObject.JOB:
// System.out.println("JOB "+ xobject.getDisplayName()+" "+xobject.getWsKey());
xobject.setWsObject(xobject.getDisplayName());
break;
case TreeObject.ROLE:
if (exAdapter != null) {
exAdapter.run(service, xobject);
}
break;
case TreeObject.RESOURCES:
case TreeObject.CUSTOM_TYPE:
case TreeObject.DATA_MODEL_RESOURCE:
case TreeObject.DATA_MODEL_TYPES_RESOURCE:
case TreeObject.CUSTOM_TYPES_RESOURCE:
case TreeObject.PICTURES_RESOURCE:
break;
default:
MessageDialog.openError(getShell(), Messages._Error, Messages.bind(Messages.EditXObjectAction_ErrorMsg1, IConstants.TALEND, xobject.getType()));
return;
}
if (page == null) {
this.page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
}
this.page.openEditor(new XObjectEditorInput(xobject, xobject.getDisplayName()), // $NON-NLS-1$
"com.amalto.workbench.editors.XObjectEditor");
} catch (Exception e) {
log.error(e.getMessage(), e);
if (!Util.handleConnectionException(getShell(), e, Messages.EditXObjectAction_ErrorMsg2)) {
MessageDialog.openError(getShell(), Messages._Error, Messages.bind(Messages.EditXObjectAction_ErrorMsg2, e.getLocalizedMessage()));
}
}
}
use of com.amalto.workbench.webservices.WSDataModelPK in project tmdm-studio-se by Talend.
the class ResourceCompareInput method commitToDB.
private void commitToDB() {
try {
String toCommitContent = CompareManager.getInstance().getLeftContent();
// $NON-NLS-1$
toCommitContent = XmlUtil.formatCompact(toCommitContent, "UTF-8");
if (this.compareHeadInfo.isItem()) {
Util.getMDMService(compareHeadInfo.getXobject()).putItem(new WSPutItem(false, (WSDataClusterPK) compareHeadInfo.getXobject().getWsKey(), // $NON-NLS-1$
"".equals(compareHeadInfo.getDataModelName()) ? null : new WSDataModelPK(compareHeadInfo.getDataModelName()), toCommitContent));
} else {
// TODO add support for Object(s)
}
} catch (Exception e) {
log.error(e.getMessage(), e);
if (!Util.handleConnectionException((Shell) null, e, null)) {
MessageDialog.openError(null, Messages._Error, Messages.bind(Messages.ResourceCompareInput_ErrorMsg, e.getLocalizedMessage()));
}
}
}
use of com.amalto.workbench.webservices.WSDataModelPK 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;
}
use of com.amalto.workbench.webservices.WSDataModelPK in project tmdm-studio-se by Talend.
the class ProjectDecisionDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
// Should not really be here but well,....
parent.getShell().setText(this.title);
Composite composite = (Composite) super.createDialogArea(parent);
GridLayout layout = (GridLayout) composite.getLayout();
layout.numColumns = 2;
try {
// process the decision
// $NON-NLS-1$
String dataClusterName = "";
// $NON-NLS-1$
String dataModelName = "";
boolean doOverwrite = true;
Matcher m = dp.matcher(decision);
if (m.matches()) {
dataClusterName = m.group(1);
dataModelName = m.group(2);
if (m.groupCount() >= 4) {
// $NON-NLS-1$
doOverwrite = (!"false".equals(m.group(3)));
}
}
TMDMService port = Util.getMDMService(new URL(transformerObject.getEndpointAddress()), transformerObject.getUsername(), transformerObject.getPassword());
// Grab the available Clusters
// $NON-NLS-1$
List<WSDataClusterPK> dcpks = port.getDataClusterPKs(new WSRegexDataClusterPKs(".*")).getWsDataClusterPKs();
Label dataClustersLabel = new Label(composite, SWT.NULL);
dataClustersLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
dataClustersLabel.setText(Messages.ProjectDecisionDialog_DataContainers);
dataClustersCombo = new Combo(composite, SWT.DROP_DOWN);
dataClustersCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
int dataClusterSelect = -1;
if (dcpks != null) {
int i = 0;
for (WSDataClusterPK pk : dcpks) {
dataClustersCombo.add(pk.getPk());
if (pk.getPk().equals(dataClusterName)) {
dataClusterSelect = i;
}
i++;
}
}
dataClustersCombo.select(dataClusterSelect);
// Grab the available Models
// $NON-NLS-1$
List<WSDataModelPK> dmpks = port.getDataModelPKs(new WSRegexDataModelPKs(".*")).getWsDataModelPKs();
Label dataModelsLabel = new Label(composite, SWT.NULL);
dataModelsLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
dataModelsLabel.setText(Messages.ProjectDecisionDialog_DataModels);
dataModelsCombo = new Combo(composite, SWT.DROP_DOWN);
dataModelsCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
int dataModelSelect = -1;
if (dmpks != null) {
int i = 0;
for (WSDataModelPK pk : dmpks) {
dataModelsCombo.add(pk.getPk());
if (pk.getPk().equals(dataModelName)) {
dataModelSelect = i;
}
i++;
}
}
dataModelsCombo.select(dataModelSelect);
// Overwrite
Label overwriteLabel = new Label(composite, SWT.NULL);
overwriteLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
overwriteLabel.setText(Messages.ProjectDecisionDialog_Overwrite);
overwriteButton = new Button(composite, SWT.CHECK);
overwriteButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
overwriteButton.setSelection(doOverwrite);
} catch (Exception e) {
if (!Util.handleConnectionException(this.getShell(), e, null)) {
MessageDialog.openError(ProjectDecisionDialog.this.getShell(), Messages.ProjectDecisionDialog_ErrorTitle, Messages.bind(Messages.ProjectDecisionDialog_ErrorMsg, e.getMessage()));
}
}
return composite;
}
Aggregations