use of com.amalto.workbench.webservices.WSDataClusterPK in project tmdm-studio-se by Talend.
the class TestTriggerAction method test.
protected void test() {
try {
String dataCluster = dialog.getDataContainer();
String concept = dialog.getConcept();
String[] recordIds = dialog.getRecordIds();
if (recordIds == null || recordIds.length == 0) {
MessageDialog.openError(getShell(), Messages._Error, Messages.RoutingRuleMainPage2_NoRecordSelected);
return;
}
WSRoutingRulePKArray routeItemV2 = service.routeItemV2(new WSRouteItemV2(new WSItemPK(concept, Arrays.asList(recordIds), new WSDataClusterPK(dataCluster))));
if (routeItemV2 == null || routeItemV2.getWsRoutingRulePKs() == null || routeItemV2.getWsRoutingRulePKs().size() == 0) {
MessageDialog.openInformation(getShell(), Messages.RoutingRuleMainPage2_Success, Messages.RoutingRuleMainPage2_noTriggerExecuted);
return;
}
List<WSRoutingRulePK> wsRoutingRulePKs = routeItemV2.getWsRoutingRulePKs();
StringBuilder builder = new StringBuilder(wsRoutingRulePKs.get(0).getPk());
for (int i = 1; i < wsRoutingRulePKs.size(); i++) {
// $NON-NLS-1$
builder.append("," + wsRoutingRulePKs.get(i).getPk());
}
MessageDialog.openInformation(getShell(), Messages.RoutingRuleMainPage2_Success, Messages.bind(Messages.RoutingRuleMainPage2_ExecuteTriggerSuccess, builder.toString()));
} catch (Exception e) {
log.error(e.getMessage(), e);
MessageDialog.openError(getShell(), Messages._Error, Messages.RoutingRuleMainPage2_ErrorTestTrigger);
}
}
use of com.amalto.workbench.webservices.WSDataClusterPK in project tmdm-studio-se by Talend.
the class DataContainerInteractiveHandler method doRemove.
@Override
public boolean doRemove(TMDMService service, AbstractDeployCommand cmd) throws XtentisException {
WSDataClusterPK pk = new WSDataClusterPK();
String name = cmd.getObjName();
pk.setPk(name);
service.deleteDataCluster(new WSDeleteDataCluster(pk));
TreeObjectUtil.deleteSpecificationFromAttachedRole(service, name, EXtentisObjects.DataCluster.getName());
return true;
}
use of com.amalto.workbench.webservices.WSDataClusterPK in project tmdm-studio-se by Talend.
the class OpenObjectAction method doSelectServer.
public boolean doSelectServer(Item item, IRepositoryViewEditorInput editorInput) {
MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
if (serverObject.getType() == TreeObject.DATA_CLUSTER) {
// Data Cluster
MDMServerDef lastServerDef = RepositoryResourceUtil.getLastServerDef(item);
MDMServerDef serverDef = openServerDialog(lastServerDef);
if (serverDef != null) {
XObjectBrowserInput input = (XObjectBrowserInput) editorInput;
TreeObject xobject = (TreeObject) input.getModel();
if (xobject != null && xobject.getWsKey() != null) {
TreeParent serverRoot = getServerRoot(serverDef);
xobject.setWsKey(new WSDataClusterPK(xobject.getWsKey().toString()));
xobject.setServerRoot(serverRoot);
return true;
}
}
return false;
}
return true;
}
use of com.amalto.workbench.webservices.WSDataClusterPK 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.WSDataClusterPK in project tmdm-studio-se by Talend.
the class DataClusterComposite method refreshData.
protected boolean refreshData() {
try {
if (conceptCombo.isDisposed()) {
return false;
}
if (getXObject().getEndpointAddress() == null) {
return false;
}
TMDMService service = Util.getMDMService(getXObject());
WSDataCluster cluster = null;
if (getXObject().getWsObject() == null) {
// then fetch from server
cluster = service.getDataCluster(new WSGetDataCluster((WSDataClusterPK) getXObject().getWsKey()));
getXObject().setWsObject(cluster);
} else {
// it has been opened by an editor - use the object there
// added for TMDM-3064
// the following may throw ServerException to identify the data continer not exist on the server
cluster = service.getDataCluster(new WSGetDataCluster(new WSDataClusterPK(getXObject().getName())));
// if you could go to next line, that means the data container is on the server specified
cluster = (WSDataCluster) getXObject().getWsObject();
}
// add by myli; fix the bug:0013077: if the data is too much, just get the entities from the model instead
// of from the container.
// $NON-NLS-1$
String clusterName = URLEncoder.encode(cluster.getName(), "utf-8");
// WSString countStr = port.count(new WSCount(new WSDataClusterPK(cluster.getName()), "*", null, 100)); //$NON-NLS-1$
// long count = Long.parseLong(countStr.getValue());
WSStringArray conceptsInDataCluster = service.getConceptsInDataCluster(new WSGetConceptsInDataCluster(new WSDataClusterPK(clusterName)));
if (conceptsInDataCluster != null) {
List<String> concepts = conceptsInDataCluster.getStrings();
conceptCombo.removeAll();
// $NON-NLS-1$
conceptCombo.add("*");
for (String concept : concepts) {
conceptCombo.add(concept);
}
} else {
boolean selected = doSelectDataModelForEntityRecords(clusterName);
if (!selected) {
return false;
}
}
conceptCombo.select(0);
searchText.setFocus();
} catch (ServerException e) {
log.error(e.getMessage(), e);
MessageDialog.openError(getSite().getShell(), Messages._Error, Messages.DataClusterBrowser_dataContainerError);
return false;
} catch (WebServiceException e) {
log.error(e.getMessage(), e);
if (!Util.handleConnectionException(getSite().getShell(), e, null)) {
MessageDialog.openError(getSite().getShell(), Messages._Error, Messages.DataClusterBrowser_connectionError);
}
return false;
} catch (Exception e) {
log.error(e.getMessage(), e);
MessageDialog.openError(this.getSite().getShell(), Messages._Error, Messages.bind(Messages.DataClusterBrowser_error, e.getLocalizedMessage()));
return false;
}
return true;
}
Aggregations