Search in sources :

Example 1 with WSGetItem

use of com.amalto.workbench.webservices.WSGetItem in project tmdm-studio-se by Talend.

the class DataClusterDialog method showInTextWidget.

private void showInTextWidget(LineItem lineItem) {
    if (lineItem == null) {
        // $NON-NLS-1$
        textViewer.setText("");
        // $NON-NLS-1$
        recordContent = "";
        return;
    }
    try {
        final TMDMService service = Util.getMDMService(model);
        final WSItem wsItem = service.getItem(new WSGetItem(new WSItemPK(lineItem.getConcept().trim(), Arrays.asList(lineItem.getIds()), (WSDataClusterPK) model.getWsKey())));
        recordContent = Util.formatXsdSource(wsItem.getContent());
        textViewer.setText(recordContent);
    } catch (WebServiceException e) {
        log.error(e.getMessage(), e);
    } catch (XtentisException e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(getShell(), Messages._Error, Messages.bind(Messages.DataClusterBrowserMainPage_36, e.getLocalizedMessage()));
    }
}
Also used : WSGetItem(com.amalto.workbench.webservices.WSGetItem) WebServiceException(javax.xml.ws.WebServiceException) TMDMService(com.amalto.workbench.webservices.TMDMService) WSItem(com.amalto.workbench.webservices.WSItem) WSItemPK(com.amalto.workbench.webservices.WSItemPK) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 2 with WSGetItem

use of com.amalto.workbench.webservices.WSGetItem in project tmdm-studio-se by Talend.

the class ExportItemsWizard method exportCluster.

protected TreeObject exportCluster(List<TreeObject> exports, WSDataClusterPK pk, TMDMService service) {
    String encodedID = null;
    try {
        List<String> items1 = new ArrayList<String>();
        List<WSItemPKsByCriteriaResponseResults> results = service.getItemPKsByCriteria(new WSGetItemPKsByCriteria(null, encodedID, (long) -1, encodedID, encodedID, Integer.MAX_VALUE, 0, (long) -1, pk)).getResults();
        if (results == null) {
            return null;
        }
        for (WSItemPKsByCriteriaResponseResults item : results) {
            if (item.getWsItemPK().getIds() == null) {
                continue;
            }
            WSItem wsitem = service.getItem(new WSGetItem(item.getWsItemPK()));
            // Marshal
            StringWriter sw1 = new StringWriter();
            Marshaller.marshal(wsitem, sw1);
            // $NON-NLS-1$
            String uniqueId = pk.getPk() + "." + wsitem.getConceptName();
            for (String id : wsitem.getIds()) {
                // $NON-NLS-1$
                uniqueId = uniqueId + "." + id;
            }
            // $NON-NLS-1$
            encodedID = URLEncoder.encode(uniqueId, "UTF-8");
            // $NON-NLS-1$//$NON-NLS-2$
            writeString(sw1.toString(), TreeObject.DATACONTAINER_COTENTS + "/" + pk.getPk() + "/" + encodedID);
            // $NON-NLS-1$//$NON-NLS-2$
            items1.add(TreeObject.DATACONTAINER_COTENTS + "/" + pk.getPk() + "/" + encodedID);
        }
        TreeObject obj1 = new TreeObject(pk.getPk(), null, TreeObject.DATA_CLUSTER_CONTENTS, null, null);
        obj1.setItems(items1.toArray(new String[items1.size()]));
        exports.add(obj1);
        return obj1;
    } catch (Exception e) {
    }
    return null;
}
Also used : WSGetItem(com.amalto.workbench.webservices.WSGetItem) StringWriter(java.io.StringWriter) WSItem(com.amalto.workbench.webservices.WSItem) ArrayList(java.util.ArrayList) TreeObject(com.amalto.workbench.models.TreeObject) WSGetItemPKsByCriteria(com.amalto.workbench.webservices.WSGetItemPKsByCriteria) WSItemPKsByCriteriaResponseResults(com.amalto.workbench.webservices.WSItemPKsByCriteriaResponseResults)

Aggregations

WSGetItem (com.amalto.workbench.webservices.WSGetItem)2 WSItem (com.amalto.workbench.webservices.WSItem)2 TreeObject (com.amalto.workbench.models.TreeObject)1 XtentisException (com.amalto.workbench.utils.XtentisException)1 TMDMService (com.amalto.workbench.webservices.TMDMService)1 WSGetItemPKsByCriteria (com.amalto.workbench.webservices.WSGetItemPKsByCriteria)1 WSItemPK (com.amalto.workbench.webservices.WSItemPK)1 WSItemPKsByCriteriaResponseResults (com.amalto.workbench.webservices.WSItemPKsByCriteriaResponseResults)1 StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1 WebServiceException (javax.xml.ws.WebServiceException)1