use of com.amalto.workbench.webservices.TMDMService in project tmdm-studio-se by Talend.
the class ViewBrowserMainPage method refreshData.
// createCharacteristicsContent
@Override
protected void refreshData() {
try {
if (viewableBEsList.isDisposed() || searchableBEsList.isDisposed() || wcListViewer.getList().isDisposed() || searchItemCombo.isDisposed() || dataClusterCombo.isDisposed()) {
return;
}
WSView view = null;
if (getXObject().getWsObject() == null) {
// then fetch from server
TMDMService port = getMDMService();
view = port.getView(new WSGetView((WSViewPK) getXObject().getWsKey()));
getXObject().setWsObject(view);
} else {
// it has been opened by an editor - use the object there
view = (WSView) getXObject().getWsObject();
}
java.util.List<String> paths = view.getViewableBusinessElements();
// Fill the vbe List
viewableBEsList.removeAll();
for (String path : paths) {
viewableBEsList.add(path);
}
paths = view.getSearchableBusinessElements();
searchableBEsList.removeAll();
searchItemCombo.removeAll();
if (paths != null) {
for (String path : paths) {
searchableBEsList.add(path);
searchItemCombo.add(path);
}
}
searchItemCombo.add(FULL_TEXT);
searchItemCombo.setText(FULL_TEXT);
wcListViewer.setInput(view);
wcListViewer.refresh();
dataClusterCombo.removeAll();
java.util.List<WSDataClusterPK> dataClusterPKs = getDataClusterPKs();
if ((dataClusterPKs == null) || (dataClusterPKs.size() == 0)) {
MessageDialog.openError(this.getSite().getShell(), Messages._Error, Messages.ViewBrowserMainPage_ErrorMsg1);
return;
}
for (WSDataClusterPK pk : dataClusterPKs) {
dataClusterCombo.add(pk.getPk());
}
dataClusterCombo.select(0);
clusterTypeCombo.setItems(getClusterTypes());
clusterTypeCombo.select(0);
this.getManagedForm().reflow(true);
searchText.setFocus();
} catch (Exception e) {
log.error(e.getMessage(), e);
if (!Util.handleConnectionException(this.getSite().getShell(), e, Messages.ViewBrowserMainPage_ErrorTitle2)) {
MessageDialog.openError(this.getSite().getShell(), Messages.ViewBrowserMainPage_ErrorTitle2, Messages.bind(Messages.ViewBrowserMainPage_ErrorMsg2, e.getLocalizedMessage()));
}
}
}
use of com.amalto.workbench.webservices.TMDMService in project tmdm-studio-se by Talend.
the class ViewBrowserMainPage method getResults.
public String[] getResults() {
Cursor waitCursor = null;
try {
Display display = getEditor().getSite().getPage().getWorkbenchWindow().getWorkbench().getDisplay();
waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
this.getSite().getShell().setCursor(waitCursor);
TMDMService service = getMDMService();
java.util.List<String> results = null;
int maxItem = 10;
// $NON-NLS-1$ //$NON-NLS-2$
String search = "".equals(searchText.getText()) ? "*" : searchText.getText();
WSDataClusterPK wsDataClusterPK = new WSDataClusterPK(dataClusterCombo.getText() + getPkAddition());
if (FULL_TEXT.equals(searchItemCombo.getText())) {
boolean matchAllWords = matchAllWordsBtn.getSelection();
results = service.quickSearch(new WSQuickSearch(null, matchAllWords, maxItem, null, search, 0, Integer.MAX_VALUE, wsDataClusterPK, getViewPK())).getStrings();
} else {
WSView wsview = (WSView) wcListViewer.getInput();
java.util.List<WSWhereCondition> array = wsview.getWhereConditions();
java.util.List<WSWhereItem> conditions = new ArrayList<WSWhereItem>();
for (WSWhereCondition condition : array) {
WSWhereItem item = new WSWhereItem(null, condition, null);
conditions.add(item);
}
WSWhereCondition condition = new WSWhereCondition(searchItemCombo.getText(), WSWhereOperator.CONTAINS, search, true, WSStringPredicate.AND);
WSWhereItem item = new WSWhereItem(null, condition, null);
conditions.add(item);
WSWhereAnd and = new WSWhereAnd(conditions);
WSWhereItem wi = new WSWhereItem(and, null, null);
results = service.viewSearch(new WSViewSearch("ascending", maxItem, null, 0, -1, wi, wsDataClusterPK, getViewPK())).getStrings();
}
resultsLabel.setText(Messages.bind(Messages.ViewBrowserMainPage_Results, results.size() - 1));
if (results.size() > 1) {
return results.subList(1, results.size()).toArray(new String[0]);
}
return new String[0];
} catch (Exception e) {
log.error(e.getMessage(), e);
if ((e.getLocalizedMessage() != null) && e.getLocalizedMessage().contains("10000")) {
MessageDialog.openError(this.getSite().getShell(), Messages.ViewBrowserMainPage_ErrorTitle4, Messages.ViewBrowserMainPage_ErrorMsg4);
} else if (!Util.handleConnectionException(this.getSite().getShell(), e, Messages.ViewBrowserMainPage_ErrorTitle5)) {
MessageDialog.openError(this.getSite().getShell(), Messages.ViewBrowserMainPage_ErrorTitle5, e.getLocalizedMessage());
}
return null;
} finally {
try {
this.getSite().getShell().setCursor(null);
waitCursor.dispose();
} catch (Exception e) {
}
}
}
use of com.amalto.workbench.webservices.TMDMService in project tmdm-studio-se by Talend.
the class ItemsTrashBrowserMainPage method getResults.
protected LineItem[] getResults(boolean showResultInfo) {
Cursor waitCursor = null;
try {
Display display = getEditor().getSite().getPage().getWorkbenchWindow().getWorkbench().getDisplay();
waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
this.getSite().getShell().setCursor(waitCursor);
TMDMService service = Util.getMDMService(getXObject());
String search = searchText.getText();
List<WSDroppedItemPK> results = null;
if (search != null && search.length() > 0) {
results = service.findAllDroppedItemsPKs(new WSFindAllDroppedItemsPKs(search)).getWsDroppedItemPK();
}
if ((results == null) || (results.isEmpty())) {
if (showResultInfo) {
MessageDialog.openInformation(this.getSite().getShell(), Messages.ItemsTrashBrowserMainPage_15, Messages.ItemsTrashBrowserMainPage_16);
return new LineItem[0];
}
} else {
LineItem[] res = new LineItem[results.size()];
for (int i = 0; i < results.size(); i++) {
WSDroppedItemPK wsDroppedItemPK = results.get(i);
WSItemPK refWSItemPK = wsDroppedItemPK.getWsItemPK();
// if(revison==null||revison.equals(""))revison="head";
res[i] = new LineItem(refWSItemPK.getWsDataClusterPK().getPk(), refWSItemPK.getConceptName(), refWSItemPK.getIds().toArray(new String[0]), null, wsDroppedItemPK.getPartPath());
}
return res;
}
return new LineItem[0];
} catch (Exception e) {
log.error(e.getMessage(), e);
if ((e.getLocalizedMessage() != null) && e.getLocalizedMessage().contains("10000")) {
MessageDialog.openError(this.getSite().getShell(), Messages.ItemsTrashBrowserMainPage_17, Messages.ItemsTrashBrowserMainPage_18);
} else {
if (!Util.handleConnectionException(this, e, null)) {
MessageDialog.openError(this.getSite().getShell(), Messages.ItemsTrashBrowserMainPage_19, e.getLocalizedMessage());
}
}
return null;
} finally {
try {
this.getSite().getShell().setCursor(null);
waitCursor.dispose();
} catch (Exception e) {
}
}
}
use of com.amalto.workbench.webservices.TMDMService in project tmdm-studio-se by Talend.
the class RoutingEngineV2BrowserMainPage method getServerRoutingStatus.
protected WSRoutingEngineV2Status getServerRoutingStatus() throws XtentisException {
TMDMService service = getMDMService();
WSRoutingEngineV2Status status = service.routingEngineV2Action(new WSRoutingEngineV2Action(WSRoutingEngineV2ActionCode.STATUS));
return status;
}
use of com.amalto.workbench.webservices.TMDMService in project tmdm-studio-se by Talend.
the class RoutingEngineV2BrowserMainPage method stopSubscriptionEngine.
private void stopSubscriptionEngine() {
try {
TMDMService service = getMDMService();
service.routingEngineV2Action(new WSRoutingEngineV2Action(WSRoutingEngineV2ActionCode.STOP));
} catch (Exception e) {
log.error(e.getMessage(), e);
if (!Util.handleConnectionException(this.getSite().getShell(), e, null)) {
MessageDialog.openError(this.getSite().getShell(), Messages._Error, Messages.bind(Messages.RoutingEngineV2BrowserMainPage_ErrorMsg8, e.getLocalizedMessage()));
}
}
}
Aggregations