Search in sources :

Example 6 with TreeObject

use of com.amalto.workbench.models.TreeObject in project tmdm-studio-se by Talend.

the class Util method getForeingKeyInDataModel.

/**
 * set the list with all the foreign concepty name in the parent
 *
 * @author ymli
 * @param list
 * @param parent
 * @throws Exception
 */
public static void getForeingKeyInDataModel(Set<String> list, TreeParent parent, TMDMService service) throws Exception {
    TreeObject[] children = parent.getChildren();
    for (TreeObject object : children) {
        if (object instanceof TreeParent) {
            getForeingKeyInDataModel(list, (TreeParent) object, service);
            continue;
        }
        WSDataModel wsDataModel = service.getDataModel(new WSGetDataModel(new WSDataModelPK(object.getDisplayName())));
        XSDSchema xsd = Util.createXsdSchema(wsDataModel.getXsdSchema(), object);
        getForeingKeyInSchema(list, xsd);
    }
}
Also used : WSDataModel(com.amalto.workbench.webservices.WSDataModel) TreeParent(com.amalto.workbench.models.TreeParent) TreeObject(com.amalto.workbench.models.TreeObject) WSGetDataModel(com.amalto.workbench.webservices.WSGetDataModel) WSDataModelPK(com.amalto.workbench.webservices.WSDataModelPK) XSDSchema(org.eclipse.xsd.XSDSchema)

Example 7 with TreeObject

use of com.amalto.workbench.models.TreeObject in project tmdm-studio-se by Talend.

the class Util method getXSDSchema.

public static XSDSchema getXSDSchema(TreeObject treeObj, String dataModelName) {
    TreeObject dataModelFolder = treeObj.findServerFolder(TreeObject.DATA_MODEL);
    TMDMService port = null;
    try {
        port = Util.getMDMService(dataModelFolder);
    } catch (XtentisException e3) {
        log.error(e3.getMessage(), e3);
    } catch (Exception e3) {
        log.error(e3.getMessage(), e3);
    }
    WSDataModel wsDataModel = null;
    try {
        wsDataModel = port.getDataModel(new WSGetDataModel(new WSDataModelPK(dataModelName)));
        String schema = wsDataModel.getXsdSchema();
        return Util.createXsdSchema(schema, dataModelFolder);
    } catch (Exception e1) {
        log.error(e1.getMessage(), e1);
    }
    return null;
}
Also used : WSDataModel(com.amalto.workbench.webservices.WSDataModel) TMDMService(com.amalto.workbench.webservices.TMDMService) TreeObject(com.amalto.workbench.models.TreeObject) ConnectException(java.net.ConnectException) IOException(java.io.IOException) WebServiceException(javax.xml.ws.WebServiceException) MissingJarsException(com.amalto.workbench.service.MissingJarsException) MalformedURLException(java.net.MalformedURLException) SAXParseException(org.xml.sax.SAXParseException) InaccessibleWSDLException(com.sun.xml.internal.ws.wsdl.parser.InaccessibleWSDLException) WSGetDataModel(com.amalto.workbench.webservices.WSGetDataModel) WSDataModelPK(com.amalto.workbench.webservices.WSDataModelPK)

Example 8 with TreeObject

use of com.amalto.workbench.models.TreeObject in project tmdm-studio-se by Talend.

the class ComplexTableViewerR method creatTextPortion.

@Override
protected void creatTextPortion(Composite textParent, ComplexTableViewerColumn column) {
    Composite righComposite = toolkit.createComposite(textParent, SWT.NONE);
    righComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = 0;
    righComposite.setLayout(layout);
    Button readRecordButton = toolkit.createButton(righComposite, Messages.ComplexTableViewerR_PickRecordFromContainer, SWT.PUSH | SWT.CENTER);
    readRecordButton.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            DataClusterDialog dialog = new DataClusterDialog(site.getShell(), new TreeObject(), site);
            dialog.create();
            Point size = dialog.getShell().getSize();
            Rectangle clientArea = Display.getCurrent().getClientArea();
            int locx = clientArea.x + (clientArea.width - size.x) / 2;
            int locy = clientArea.y + (clientArea.height - size.y) / 2;
            dialog.getShell().setLocation(locx, locy);
            if (dialog.open() == Dialog.OK) {
                String recordContent = dialog.getRecordContent();
                if (recordContent != null && recordContent.trim().length() > 0)
                    text.setText(recordContent);
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        // 
        }
    });
    readRecordButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
    super.creatTextPortion(righComposite, column);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Rectangle(org.eclipse.swt.graphics.Rectangle) TreeObject(com.amalto.workbench.models.TreeObject) Point(org.eclipse.swt.graphics.Point) SelectionListener(org.eclipse.swt.events.SelectionListener) DataClusterDialog(com.amalto.workbench.editors.DataClusterDialog)

Example 9 with TreeObject

use of com.amalto.workbench.models.TreeObject in project tmdm-studio-se by Talend.

the class Util method getCachedXObjectsNameSet.

/**
 * @deprecated using getChildren(TreeParent xObject,int objectType)
 * @param xObject
 * @param objectType
 * @return
 */
@Deprecated
public static List<String> getCachedXObjectsNameSet(TreeObject xObject, int objectType) {
    List<String> xObjectsNameSet = new ArrayList<String>();
    if (xObject != null) {
        TreeParent treeNode = xObject.findServerFolder(objectType);
        TreeObject[] xObjectsSet = treeNode.getChildren();
        for (TreeObject element : xObjectsSet) {
            xObject = element;
            String xObjectName = xObject.getDisplayName();
            xObjectsNameSet.add(xObjectName);
        }
    }
    return xObjectsNameSet;
}
Also used : TreeParent(com.amalto.workbench.models.TreeParent) ArrayList(java.util.ArrayList) TreeObject(com.amalto.workbench.models.TreeObject)

Example 10 with TreeObject

use of com.amalto.workbench.models.TreeObject in project tmdm-studio-se by Talend.

the class Util method getChildren.

public static List<String> getChildren(TreeParent xObject, int objectType) {
    List<String> objs = new ArrayList<String>();
    for (TreeObject obj : xObject.getChildren()) {
        if (obj instanceof TreeParent) {
            TreeParent parent = (TreeParent) obj;
            objs.addAll(getChildren(parent, objectType));
        } else {
            if (obj.getType() == objectType) {
                objs.add(obj.getDisplayName());
            }
        }
    }
    return objs;
}
Also used : TreeParent(com.amalto.workbench.models.TreeParent) ArrayList(java.util.ArrayList) TreeObject(com.amalto.workbench.models.TreeObject)

Aggregations

TreeObject (com.amalto.workbench.models.TreeObject)66 TreeParent (com.amalto.workbench.models.TreeParent)21 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)14 ArrayList (java.util.ArrayList)12 MDMServerObject (org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)12 TMDMService (com.amalto.workbench.webservices.TMDMService)6 WSDataModel (com.amalto.workbench.webservices.WSDataModel)5 WSDataModelPK (com.amalto.workbench.webservices.WSDataModelPK)5 WSGetDataModel (com.amalto.workbench.webservices.WSGetDataModel)5 Document (org.dom4j.Document)5 Element (org.dom4j.Element)5 EObject (org.eclipse.emf.ecore.EObject)5 MDMServerObjectItem (org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)5 WSDataClusterPK (com.amalto.workbench.webservices.WSDataClusterPK)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 IAvailableModel (com.amalto.workbench.availablemodel.IAvailableModel)3 UserInfo (com.amalto.workbench.utils.UserInfo)3 WSDataCluster (com.amalto.workbench.webservices.WSDataCluster)3 WSDigest (com.amalto.workbench.webservices.WSDigest)3 WSDigestKey (com.amalto.workbench.webservices.WSDigestKey)3