Search in sources :

Example 1 with WSDataCluster

use of com.amalto.workbench.webservices.WSDataCluster 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()));
        }
    }
}
Also used : WSGetStoredProcedure(com.amalto.workbench.webservices.WSGetStoredProcedure) WSMenuPK(com.amalto.workbench.webservices.WSMenuPK) WSGetTransformerV2(com.amalto.workbench.webservices.WSGetTransformerV2) WSStoredProcedurePK(com.amalto.workbench.webservices.WSStoredProcedurePK) XObjectEditorInput(com.amalto.workbench.providers.XObjectEditorInput) URL(java.net.URL) WSView(com.amalto.workbench.webservices.WSView) WSGetDataModel(com.amalto.workbench.webservices.WSGetDataModel) WSDataCluster(com.amalto.workbench.webservices.WSDataCluster) WSDataClusterPK(com.amalto.workbench.webservices.WSDataClusterPK) TMDMService(com.amalto.workbench.webservices.TMDMService) WSRoutingRule(com.amalto.workbench.webservices.WSRoutingRule) WSStoredProcedure(com.amalto.workbench.webservices.WSStoredProcedure) WSGetView(com.amalto.workbench.webservices.WSGetView) WSGetMenu(com.amalto.workbench.webservices.WSGetMenu) WSRoutingRulePK(com.amalto.workbench.webservices.WSRoutingRulePK) WSGetRoutingRule(com.amalto.workbench.webservices.WSGetRoutingRule) WSMenu(com.amalto.workbench.webservices.WSMenu) WSDataModel(com.amalto.workbench.webservices.WSDataModel) WSGetDataCluster(com.amalto.workbench.webservices.WSGetDataCluster) WSTransformerV2(com.amalto.workbench.webservices.WSTransformerV2) WSTransformerV2PK(com.amalto.workbench.webservices.WSTransformerV2PK) WSDataModelPK(com.amalto.workbench.webservices.WSDataModelPK) WSViewPK(com.amalto.workbench.webservices.WSViewPK)

Example 2 with WSDataCluster

use of com.amalto.workbench.webservices.WSDataCluster 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;
}
Also used : WSStringArray(com.amalto.workbench.webservices.WSStringArray) WSGetDataCluster(com.amalto.workbench.webservices.WSGetDataCluster) WSDataClusterPK(com.amalto.workbench.webservices.WSDataClusterPK) ServerException(java.rmi.ServerException) WSGetConceptsInDataCluster(com.amalto.workbench.webservices.WSGetConceptsInDataCluster) WebServiceException(javax.xml.ws.WebServiceException) TMDMService(com.amalto.workbench.webservices.TMDMService) XtentisException(com.amalto.workbench.utils.XtentisException) ServerException(java.rmi.ServerException) ParseException(java.text.ParseException) InvocationTargetException(java.lang.reflect.InvocationTargetException) WebServiceException(javax.xml.ws.WebServiceException) WSDataCluster(com.amalto.workbench.webservices.WSDataCluster)

Example 3 with WSDataCluster

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

the class DataClusterMainPage method commit.

@Override
protected void commit() {
    try {
        if (this.refreshing) {
            return;
        }
        this.comitting = true;
        WSDataCluster wsObject = (WSDataCluster) (getXObject().getWsObject());
        wsObject.setDescription(descriptionText.getText());
        /*
             * if ("Cache".equals(dataClusterTypeCombo.getText()))
             * wsObject.setWSDataClusterType(WSDataClusterType.CACHE); else
             * wsObject.setWSDataClusterType(WSDataClusterType.ITEMS);
             */
        /*
             * wsObject.setWSDataClusterType(WSDataClusterType.ITEMS);
             * 
             * wsObject.setWSSpellerRefreshPeriodInSeconds(0); if (!useStemming.getSelection())
             * wsObject.setStemmer("0100"); else { String s=languageCombo.getText(); int i=0; if
             * (singleRoot.getSelection()) i+=1; if (partOfSpeechSingleWord.getSelection()) i+=2; if
             * (rootConsistency.getSelection()) i+=4; if (accentedWords.getSelection()) i+=8; if
             * (compoundWords.getSelection()) i+=16; if (spellingCorrection.getSelection()) i+=32; if
             * (phoneticCorrection.getSelection()) i+=64; if (partOfSpeechCompoundWords.getSelection()) i+=256; if
             * (synonymInformation.getSelection()) i+=512; if (stopWords.getSelection()) i+=1024; if
             * (typingErrors.getSelection()) i+=2048; if (optimizeQueryResult.getSelection()) i+=4096; s+=""+i;
             * wsObject.setStemmer(s); }
             */
        this.comitting = false;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(this.getSite().getShell(), Messages.DataClusterMainPage_ErrorCommitingPage, Messages.DataClusterMainPage_ErrorCommitingPageXX + e.getLocalizedMessage());
    }
}
Also used : WSDataCluster(com.amalto.workbench.webservices.WSDataCluster)

Example 4 with WSDataCluster

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

the class DataClusterDialog method getAllDataContainers.

private boolean getAllDataContainers(List<TreeObject> dataContainers) {
    MDMServerDef serverDef = getSelectedMdmServerDef();
    String username = serverDef.getUser();
    String password = serverDef.getPasswd();
    String serverName = serverDef.getName();
    String endpointaddress = serverDef.getUrl();
    boolean canConnect = checkConnection(endpointaddress, username, password);
    if (!canConnect) {
        MessageDialog.openError(site.getShell(), Messages.DataClusterDialog_7, Messages.DataClusterDialog_8);
        return false;
    }
    List<WSDataClusterPK> xdcPKs = null;
    try {
        TMDMService service = Util.getMDMService(new URL(endpointaddress), username, password);
        TreeParent serverRoot = new TreeParent(serverName, null, TreeObject._SERVER_, endpointaddress, username + ":" + // $NON-NLS-1$//$NON-NLS-2$
        (password == null ? "" : password));
        // $NON-NLS-1$
        xdcPKs = service.getDataClusterPKs(new WSRegexDataClusterPKs("*")).getWsDataClusterPKs();
        for (WSDataClusterPK pk : xdcPKs) {
            String name = pk.getPk();
            if (!("CACHE".equals(name))) {
                // $NON-NLS-1$
                WSDataCluster wsObject = null;
                boolean retriveWSObject = false;
                try {
                    if (retriveWSObject) {
                        wsObject = service.getDataCluster(new WSGetDataCluster(pk));
                    }
                    TreeObject obj = new TreeObject(name, serverRoot, TreeObject.DATA_CLUSTER, pk, wsObject);
                    dataContainers.add(obj);
                } catch (Exception e) {
                    log.error(e.getMessage(), e);
                }
            }
        }
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        return false;
    }
    return true;
}
Also used : TreeParent(com.amalto.workbench.models.TreeParent) URL(java.net.URL) XtentisException(com.amalto.workbench.utils.XtentisException) MalformedURLException(java.net.MalformedURLException) WebServiceException(javax.xml.ws.WebServiceException) WSDataCluster(com.amalto.workbench.webservices.WSDataCluster) WSGetDataCluster(com.amalto.workbench.webservices.WSGetDataCluster) WSDataClusterPK(com.amalto.workbench.webservices.WSDataClusterPK) TMDMService(com.amalto.workbench.webservices.TMDMService) TreeObject(com.amalto.workbench.models.TreeObject) MDMServerDef(com.amalto.workbench.utils.MDMServerDef) WSRegexDataClusterPKs(com.amalto.workbench.webservices.WSRegexDataClusterPKs)

Example 5 with WSDataCluster

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

the class DataClusterMainPage method refreshData.

// createCharacteristicsContent
@Override
protected void refreshData() {
    try {
        if (this.comitting) {
            return;
        }
        this.refreshing = true;
        WSDataCluster wsObject = (WSDataCluster) (getXObject().getWsObject());
        // $NON-NLS-1$
        descriptionText.setText(wsObject.getDescription() == null ? "" : wsObject.getDescription());
        /*
             * if (wsObject.getWSDataClusterType().equals(WSDataClusterType.CACHE)) dataClusterTypeCombo.select(1); else
             * dataClusterTypeCombo.select(0);
             */
        /*
             * boolean doStemming = ! ("0100".equals(wsObject.getStemmer())); useStemming.setSelection(doStemming); if
             * (doStemming) { useStemming.setText("Stemming Enabled"); } else {
             * useStemming.setText("Stemming Disabled"); } stemmerGroup.setEnabled(doStemming);
             * ((Section)DataClusterMainPage.this.stemmerGroup.getParent()).setExpanded(doStemming);
             * 
             * String language = wsObject.getStemmer().substring(0,2); if ("fr".equals(language))
             * languageCombo.select(1); else languageCombo.select(0);
             * 
             * if (useStemming.getSelection()){ String vals =
             * wsObject.getStemmer().substring(2,wsObject.getStemmer().length()); int val = Integer.parseInt(vals);
             * singleRoot.setSelection((val & (1 << 0)) == (1 << 0)); partOfSpeechSingleWord.setSelection((val & (1 <<
             * 1)) == (1 << 1)); rootConsistency.setSelection((val & (1 << 2)) == (1 << 2));
             * accentedWords.setSelection((val & (1 << 3)) == (1 << 3)); compoundWords.setSelection((val & (1 << 4)) ==
             * (1 << 4)); spellingCorrection.setSelection((val & (1 << 5)) == (1 << 5));
             * phoneticCorrection.setSelection((val & (1 << 6)) == (1 << 6));
             * partOfSpeechCompoundWords.setSelection((val & (1 << 8)) == (1 << 8));
             * synonymInformation.setSelection((val & (1 << 9)) == (1 << 9)); stopWords.setSelection((val & (1 << 10))
             * == (1 << 10)); typingErrors.setSelection((val & (1 << 11)) == (1 << 11));
             * optimizeQueryResult.setSelection((val & (1 << 12)) == (1 << 12));
             * 
             * }
             */
        this.refreshing = false;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(this.getSite().getShell(), Messages.DataClusterMainPage_ErrorRefreshingPage, Messages.DataClusterMainPage_ErrorRefreshingPageXX + e.getLocalizedMessage());
    }
}
Also used : WSDataCluster(com.amalto.workbench.webservices.WSDataCluster)

Aggregations

WSDataCluster (com.amalto.workbench.webservices.WSDataCluster)8 TMDMService (com.amalto.workbench.webservices.TMDMService)5 WSDataClusterPK (com.amalto.workbench.webservices.WSDataClusterPK)5 WSGetDataCluster (com.amalto.workbench.webservices.WSGetDataCluster)5 TreeObject (com.amalto.workbench.models.TreeObject)3 WSDataModel (com.amalto.workbench.webservices.WSDataModel)3 WSDataModelPK (com.amalto.workbench.webservices.WSDataModelPK)3 WSGetDataModel (com.amalto.workbench.webservices.WSGetDataModel)3 WSGetMenu (com.amalto.workbench.webservices.WSGetMenu)3 WSGetRoutingRule (com.amalto.workbench.webservices.WSGetRoutingRule)3 WSGetStoredProcedure (com.amalto.workbench.webservices.WSGetStoredProcedure)3 WSGetTransformerV2 (com.amalto.workbench.webservices.WSGetTransformerV2)3 WSGetView (com.amalto.workbench.webservices.WSGetView)3 WSMenu (com.amalto.workbench.webservices.WSMenu)3 WSMenuPK (com.amalto.workbench.webservices.WSMenuPK)3 WSRoutingRule (com.amalto.workbench.webservices.WSRoutingRule)3 WSRoutingRulePK (com.amalto.workbench.webservices.WSRoutingRulePK)3 WSStoredProcedure (com.amalto.workbench.webservices.WSStoredProcedure)3 WSStoredProcedurePK (com.amalto.workbench.webservices.WSStoredProcedurePK)3 WSTransformerV2 (com.amalto.workbench.webservices.WSTransformerV2)3