Search in sources :

Example 1 with WSDeleteView

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

the class ViewInteractiveHandler method doRemove.

@Override
public boolean doRemove(TMDMService service, AbstractDeployCommand cmd) throws XtentisException {
    WSViewPK pk = new WSViewPK();
    String name = cmd.getObjName();
    pk.setPk(name);
    service.deleteView(new WSDeleteView(pk));
    TreeObjectUtil.deleteSpecificationFromAttachedRole(service, name, EXtentisObjects.View.getName());
    return true;
}
Also used : WSDeleteView(com.amalto.workbench.webservices.WSDeleteView) WSViewPK(com.amalto.workbench.webservices.WSViewPK)

Example 2 with WSDeleteView

use of com.amalto.workbench.webservices.WSDeleteView 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)

Aggregations

WSDeleteView (com.amalto.workbench.webservices.WSDeleteView)2 WSViewPK (com.amalto.workbench.webservices.WSViewPK)2 TreeObject (com.amalto.workbench.models.TreeObject)1 TreeParent (com.amalto.workbench.models.TreeParent)1 XSDAnnotationsStructure (com.amalto.workbench.utils.XSDAnnotationsStructure)1 WSBoolean (com.amalto.workbench.webservices.WSBoolean)1 WSGetView (com.amalto.workbench.webservices.WSGetView)1 WSPutView (com.amalto.workbench.webservices.WSPutView)1 WSView (com.amalto.workbench.webservices.WSView)1 ArrayList (java.util.ArrayList)1 LinkedHashMap (java.util.LinkedHashMap)1 XSDIdentityConstraintDefinition (org.eclipse.xsd.XSDIdentityConstraintDefinition)1 XSDXPathDefinition (org.eclipse.xsd.XSDXPathDefinition)1