Search in sources :

Example 1 with WSRouteItemV2

use of com.amalto.workbench.webservices.WSRouteItemV2 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);
    }
}
Also used : WSDataClusterPK(com.amalto.workbench.webservices.WSDataClusterPK) WSItemPK(com.amalto.workbench.webservices.WSItemPK) WSRoutingRulePKArray(com.amalto.workbench.webservices.WSRoutingRulePKArray) WSRoutingRulePK(com.amalto.workbench.webservices.WSRoutingRulePK) WSRouteItemV2(com.amalto.workbench.webservices.WSRouteItemV2)

Aggregations

WSDataClusterPK (com.amalto.workbench.webservices.WSDataClusterPK)1 WSItemPK (com.amalto.workbench.webservices.WSItemPK)1 WSRouteItemV2 (com.amalto.workbench.webservices.WSRouteItemV2)1 WSRoutingRulePK (com.amalto.workbench.webservices.WSRoutingRulePK)1 WSRoutingRulePKArray (com.amalto.workbench.webservices.WSRoutingRulePKArray)1