Search in sources :

Example 1 with WSBoolean

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

the class ViewMainPage method refreshData.

@Override
protected void refreshData() {
    try {
        if (this.comitting) {
            return;
        }
        this.refreshing = true;
        WSView wsObject = getWsViewObject();
        // $NON-NLS-1$
        desAntionComposite.setText(wsObject.getDescription() == null ? "" : wsObject.getDescription());
        btnRunProcess.setSelection(wsObject.getIsTransformerActive().isTrue());
        if (btnRunProcess.getSelection()) {
            cboProcessList.setEnabled(true);
            cboProcessList.setText(wsObject.getTransformerPK());
        } else {
            cboProcessList.setEnabled(false);
            // $NON-NLS-1$
            cboProcessList.setText("");
        }
        // /////////////////////
        combox_sortdirection.add(SORTING_DIRECTION[0]);
        combox_sortdirection.add(SORTING_DIRECTION[1]);
        String sortField = wsObject.getSortField();
        WSBoolean ascOrder = wsObject.getIsAsc();
        if (sortField == null || sortField.trim().isEmpty()) {
            sortField = SORT_FIELD[0];
        }
        lastSortField = sortField;
        String[] policys = { SORT_FIELD[0], SORT_FIELD[1], selectXPath };
        if (sortField.equals(SORT_FIELD[0]) || sortField.equals(SORT_FIELD[1])) {
            combox_sortdirection.setVisible(false);
        } else {
            policys = new String[] { SORT_FIELD[0], SORT_FIELD[1], sortField, selectXPath };
            combox_sortdirection.setVisible(true);
            if (ascOrder == null || ascOrder.isTrue()) {
                combox_sortdirection.setText(SORTING_DIRECTION[0]);
            } else {
                combox_sortdirection.setText(SORTING_DIRECTION[1]);
            }
        }
        combox_policy.setItems(policys);
        combox_policy.setText(sortField);
        if (adapter != null) {
            adapter.refreshData(wsObject);
        }
        // //////////////////
        java.util.List<Line> vlines = new ArrayList<Line>();
        java.util.List<String> vis = wsObject.getViewableBusinessElements();
        if (vis != null) {
            for (String vi : vis) {
                String[] strings = new String[] { vi };
                Line line = new Line(viewableElementColumns, strings);
                vlines.add(line);
            }
        }
        viewableViewer.getViewer().setInput(vlines);
        java.util.List<Line> slines = new ArrayList<Line>();
        java.util.List<String> ses = wsObject.getSearchableBusinessElements();
        if (ses != null) {
            for (String se : ses) {
                String[] strings = new String[] { se };
                Line line = new Line(searchableElementColumns, strings);
                slines.add(line);
            }
        }
        searchableViewer.getViewer().setInput(slines);
        java.util.List<Line> lines = new ArrayList<Line>();
        for (WSWhereCondition wc : wsObject.getWhereConditions()) {
            Line line = new Line(conditionsColumns, Util.convertWhereCondition(wc));
            lines.add(line);
        }
        conditionViewer.getViewer().setInput(lines);
        this.refreshing = false;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(this.getSite().getShell(), Messages.ViewMainPage_ErrorRefreshPage, Messages.bind(Messages.ViewMainPage_ErrorRefreshPageXX, e.getLocalizedMessage()));
    }
}
Also used : Line(com.amalto.workbench.models.Line) WSWhereCondition(com.amalto.workbench.webservices.WSWhereCondition) ArrayList(java.util.ArrayList) WSBoolean(com.amalto.workbench.webservices.WSBoolean) WSView(com.amalto.workbench.webservices.WSView) XtentisException(com.amalto.workbench.utils.XtentisException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 2 with WSBoolean

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

the class ViewMainPage method commit.

@Override
protected void commit() {
    try {
        if (this.refreshing) {
            return;
        }
        this.comitting = true;
        WSView wsObject = getWsViewObject();
        wsObject.setDescription(desAntionComposite.getText());
        wsObject.setIsTransformerActive(new WSBoolean(btnRunProcess.getSelection()));
        wsObject.setTransformerPK(cboProcessList.getText());
        String policy = combox_policy.getText();
        if (policy.equals(SORT_FIELD[0])) {
            policy = null;
        }
        wsObject.setSortField(policy);
        boolean visible = combox_sortdirection.isVisible();
        if (visible) {
            boolean isAscOrder = combox_sortdirection.getText().equals(SORTING_DIRECTION[0]);
            wsObject.setIsAsc(new WSBoolean(isAscOrder));
        } else {
            wsObject.setIsAsc(null);
        }
        if (adapter != null) {
            adapter.saveData(wsObject);
        }
        java.util.List<Line> vlines = (java.util.List<Line>) viewableViewer.getViewer().getInput();
        wsObject.getViewableBusinessElements().clear();
        for (Line item : vlines) {
            wsObject.getViewableBusinessElements().add(item.keyValues.get(0).value);
        }
        java.util.List<Line> slines = (java.util.List<Line>) searchableViewer.getViewer().getInput();
        wsObject.getSearchableBusinessElements().clear();
        for (Line item : slines) {
            wsObject.getSearchableBusinessElements().add(item.keyValues.get(0).value);
        }
        java.util.List<Line> lines = (java.util.List<Line>) conditionViewer.getViewer().getInput();
        java.util.List<WSWhereCondition> wclist = new ArrayList<WSWhereCondition>();
        wsObject.getWhereConditions().clear();
        for (Line item : lines) {
            String[] values = new String[] { item.keyValues.get(0).value, item.keyValues.get(1).value, item.keyValues.get(2).value, item.keyValues.get(3).value };
            WSWhereCondition wc = Util.convertLine(values);
            wsObject.getWhereConditions().add(wc);
        }
        this.comitting = false;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(this.getSite().getShell(), Messages.ViewMainPage_ErrorCommitPage, Messages.bind(Messages.ViewMainPage_ErrorCommitPageXX, e.getLocalizedMessage()));
    }
}
Also used : WSWhereCondition(com.amalto.workbench.webservices.WSWhereCondition) ArrayList(java.util.ArrayList) WSView(com.amalto.workbench.webservices.WSView) XtentisException(com.amalto.workbench.utils.XtentisException) InvocationTargetException(java.lang.reflect.InvocationTargetException) Line(com.amalto.workbench.models.Line) List(org.eclipse.swt.widgets.List) ArrayList(java.util.ArrayList) WSBoolean(com.amalto.workbench.webservices.WSBoolean)

Example 3 with WSBoolean

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

the class AddBrowseItemsWizard method createNewTreeObject.

private TreeObject createNewTreeObject(XSDElementDeclaration decl, String browseItem) {
    WSView view = new WSView();
    view.setIsTransformerActive(new WSBoolean(false));
    // $NON-NLS-1$
    view.setTransformerPK("");
    view.setName(browseItem);
    EList<XSDIdentityConstraintDefinition> idtylist = decl.getIdentityConstraintDefinitions();
    List<String> keys = new ArrayList<String>();
    for (XSDIdentityConstraintDefinition idty : idtylist) {
        EList<XSDXPathDefinition> xpathList = idty.getFields();
        for (XSDXPathDefinition path : xpathList) {
            String key = decl.getName();
            // remove
            // $NON-NLS-1$//$NON-NLS-2$
            key = key.replaceFirst("#.*", "");
            // $NON-NLS-1$
            key += "/" + path.getValue();
            keys.add(key);
        }
    }
    view.getSearchableBusinessElements().addAll(keys);
    view.getViewableBusinessElements().addAll(keys);
    StringBuffer desc = new StringBuffer();
    LinkedHashMap<String, String> labels = new LinkedHashMap<String, String>();
    if (decl.getAnnotation() != null) {
        labels = new XSDAnnotationsStructure(decl.getAnnotation()).getLabels();
    }
    if (labels.size() == 0) {
        // $NON-NLS-1$
        labels.put("EN", decl.getName());
    }
    for (String lan : labels.keySet()) {
        // $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
        desc.append("[" + lan.toUpperCase() + ":" + labels.get(lan) + "]");
    }
    view.setDescription(desc.toString());
    WSPutView wrap = new WSPutView();
    wrap.setWsView(view);
    WSViewPK viewPk = new WSViewPK();
    viewPk.setPk(browseItem);
    WSDeleteView delView = new WSDeleteView();
    delView.setWsViewPK(viewPk);
    WSGetView getView = new WSGetView();
    getView.setWsViewPK(viewPk);
    service.putView(wrap);
    // add node in the root
    TreeParent root = page.getXObject().getServerRoot();
    TreeObject obj = new // no storage to save
    TreeObject(// no storage to save
    browseItem, // no storage to save
    root, // no storage to save
    TreeObject.VIEW, // no storage to save
    viewPk, // no storage to save
    null);
    return obj;
}
Also used : XSDAnnotationsStructure(com.amalto.workbench.utils.XSDAnnotationsStructure) TreeParent(com.amalto.workbench.models.TreeParent) ArrayList(java.util.ArrayList) WSDeleteView(com.amalto.workbench.webservices.WSDeleteView) WSView(com.amalto.workbench.webservices.WSView) LinkedHashMap(java.util.LinkedHashMap) WSPutView(com.amalto.workbench.webservices.WSPutView) XSDIdentityConstraintDefinition(org.eclipse.xsd.XSDIdentityConstraintDefinition) TreeObject(com.amalto.workbench.models.TreeObject) WSBoolean(com.amalto.workbench.webservices.WSBoolean) XSDXPathDefinition(org.eclipse.xsd.XSDXPathDefinition) WSGetView(com.amalto.workbench.webservices.WSGetView) WSViewPK(com.amalto.workbench.webservices.WSViewPK)

Example 4 with WSBoolean

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

the class DataClusterService method isExistDataCluster.

public boolean isExistDataCluster(TMDMService service, String dName) {
    WSExistsDataCluster wsExistsDataCluster = new WSExistsDataCluster(new WSDataClusterPK(dName));
    WSBoolean wsBoolean = service.existsDataCluster(wsExistsDataCluster);
    return wsBoolean.isTrue();
}
Also used : WSDataClusterPK(com.amalto.workbench.webservices.WSDataClusterPK) WSBoolean(com.amalto.workbench.webservices.WSBoolean) WSExistsDataCluster(com.amalto.workbench.webservices.WSExistsDataCluster)

Aggregations

WSBoolean (com.amalto.workbench.webservices.WSBoolean)4 WSView (com.amalto.workbench.webservices.WSView)3 ArrayList (java.util.ArrayList)3 Line (com.amalto.workbench.models.Line)2 XtentisException (com.amalto.workbench.utils.XtentisException)2 WSWhereCondition (com.amalto.workbench.webservices.WSWhereCondition)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 TreeObject (com.amalto.workbench.models.TreeObject)1 TreeParent (com.amalto.workbench.models.TreeParent)1 XSDAnnotationsStructure (com.amalto.workbench.utils.XSDAnnotationsStructure)1 WSDataClusterPK (com.amalto.workbench.webservices.WSDataClusterPK)1 WSDeleteView (com.amalto.workbench.webservices.WSDeleteView)1 WSExistsDataCluster (com.amalto.workbench.webservices.WSExistsDataCluster)1 WSGetView (com.amalto.workbench.webservices.WSGetView)1 WSPutView (com.amalto.workbench.webservices.WSPutView)1 WSViewPK (com.amalto.workbench.webservices.WSViewPK)1 LinkedHashMap (java.util.LinkedHashMap)1 List (org.eclipse.swt.widgets.List)1 XSDIdentityConstraintDefinition (org.eclipse.xsd.XSDIdentityConstraintDefinition)1 XSDXPathDefinition (org.eclipse.xsd.XSDXPathDefinition)1