Search in sources :

Example 31 with IRepositoryNode

use of org.talend.repository.model.IRepositoryNode in project tesb-studio-se by Talend.

the class AssignJobAction method getAllReferenceJobId.

private List<String> getAllReferenceJobId(RepositoryNode repositoryNode) {
    repositoryNode = getTopParent(repositoryNode);
    List<IRepositoryNode> nodeList = repositoryNode.getChildren();
    List<ServiceOperation> operaList = new ArrayList<ServiceOperation>();
    List<String> jobIDList = new ArrayList<String>();
    for (IRepositoryNode node : nodeList) {
        if (node.getObject().getProperty().getItem() instanceof ServiceItem) {
            ServiceItem item = (ServiceItem) node.getObject().getProperty().getItem();
            ServiceConnection conn = (ServiceConnection) item.getConnection();
            EList<ServicePort> portList = conn.getServicePort();
            for (ServicePort port : portList) {
                operaList.addAll(port.getServiceOperation());
            }
        }
    }
    for (ServiceOperation operation : operaList) {
        String jobID = operation.getReferenceJobId();
        if (jobID != null) {
            jobIDList.add(jobID);
        }
    }
    return jobIDList;
}
Also used : ServicePort(org.talend.repository.services.model.services.ServicePort) ServiceConnection(org.talend.repository.services.model.services.ServiceConnection) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) ServiceOperation(org.talend.repository.services.model.services.ServiceOperation) ServiceItem(org.talend.repository.services.model.services.ServiceItem)

Example 32 with IRepositoryNode

use of org.talend.repository.model.IRepositoryNode in project tdi-studio-se by Talend.

the class RepositoryChangeMetadataCommand method setTableRelevantParameterValues.

protected void setTableRelevantParameterValues() {
    Connection conn = connection;
    if (conn == null) {
        if (newPropValue != null && newPropValue instanceof String) {
            String schemaId = (String) newPropValue;
            //$NON-NLS-1$
            String[] values = schemaId.split(" - ");
            String repositoryID = values[0];
            IRepositoryNode repositoryNode = RepositorySeekerManager.getInstance().searchRepoViewNode(repositoryID);
            if (repositoryNode != null && repositoryNode.getObject() != null) {
                Item item = repositoryNode.getObject().getProperty().getItem();
                if (item instanceof ConnectionItem) {
                    ConnectionItem conItem = (ConnectionItem) item;
                    conn = conItem.getConnection();
                }
            }
        }
    }
    for (IDragAndDropServiceHandler handler : DragAndDropManager.getHandlers()) {
        if (handler.canHandle(conn)) {
            handler.handleTableRelevantParameters(conn, node, newOutputMetadata);
        }
    }
}
Also used : ConnectionItem(org.talend.core.model.properties.ConnectionItem) SalesforceSchemaConnectionItem(org.talend.core.model.properties.SalesforceSchemaConnectionItem) Item(org.talend.core.model.properties.Item) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IDragAndDropServiceHandler(org.talend.core.model.utils.IDragAndDropServiceHandler) ConnectionItem(org.talend.core.model.properties.ConnectionItem) SalesforceSchemaConnectionItem(org.talend.core.model.properties.SalesforceSchemaConnectionItem) DatabaseConnection(org.talend.core.model.metadata.builder.connection.DatabaseConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) XmlFileConnection(org.talend.core.model.metadata.builder.connection.XmlFileConnection) SalesforceSchemaConnection(org.talend.core.model.metadata.builder.connection.SalesforceSchemaConnection)

Example 33 with IRepositoryNode

use of org.talend.repository.model.IRepositoryNode in project tdi-studio-se by Talend.

the class AbstractSchemaController method findRepositoryNode.

public RepositoryNode findRepositoryNode(String label, String id, RepositoryNode root) {
    String name = (String) root.getProperties(EProperties.LABEL);
    String rootID = root.getId();
    RepositoryNode toReturn = null;
    if (label.equals(name) && !id.equals(rootID)) {
        toReturn = root;
    } else {
        for (IRepositoryNode node : root.getChildren()) {
            toReturn = findRepositoryNode(label, id, (RepositoryNode) node);
            if (toReturn != null) {
                break;
            }
        }
    }
    return toReturn;
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 34 with IRepositoryNode

use of org.talend.repository.model.IRepositoryNode in project tdi-studio-se by Talend.

the class JSONRepositoryContentHandler method hideAction.

@Override
public boolean hideAction(IRepositoryNode node, Class actionType) {
    boolean canHandle = false;
    ERepositoryObjectType nodeType = (ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE);
    if (JSONRepositoryNodeType.JSON.equals(nodeType)) {
        canHandle = true;
    }
    if (!canHandle) {
        if (ERepositoryObjectType.METADATA_CON_TABLE.equals(nodeType) || ERepositoryObjectType.METADATA_CON_COLUMN.equals(nodeType)) {
            RepositoryNode parentNode = node.getParent();
            if (parentNode != null && JSONRepositoryNodeType.JSON.equals(parentNode.getProperties(EProperties.CONTENT_TYPE))) {
                canHandle = true;
            }
        }
    }
    if (canHandle) {
        if (actionType == CreateTableAction.class) {
            return true;
        }
    }
    return false;
}
Also used : ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 35 with IRepositoryNode

use of org.talend.repository.model.IRepositoryNode in project tdi-studio-se by Talend.

the class UseDynamicJobSelectionDialog method setCheckingNodes.

private void setCheckingNodes() {
    final IContentProvider contentProvider = getItemsTreeViewer().getContentProvider();
    final Object input = getItemsTreeViewer().getInput();
    if (contentProvider instanceof ITreeContentProvider && input instanceof ProjectRepositoryNode && getNeedCheckedjobs() != null && getNeedCheckedjobs().length > 0) {
        ITreeContentProvider cnfContentProvider = (ITreeContentProvider) contentProvider;
        List<IRepositoryNode> checkingNodes = new ArrayList<IRepositoryNode>();
        List<String> needCheckedJobIds = new ArrayList(Arrays.asList(getNeedCheckedjobs()));
        final ProjectRepositoryNode root = (ProjectRepositoryNode) input;
        final RepositoryNode rootRepositoryNode = root.getRootRepositoryNode(getSupportType());
        if (rootRepositoryNode == null) {
            return;
        }
        withReferenceProjects(cnfContentProvider, rootRepositoryNode, needCheckedJobIds, checkingNodes);
        // set check for node
        getItemsTreeViewer().setCheckedElements(checkingNodes.toArray());
        // select and will expand the selected node auto
        getItemsTreeViewer().setSelection(new StructuredSelection(checkingNodes), true);
        // let scroll bar on top
        getItemsTreeViewer().setSelection(new StructuredSelection(rootRepositoryNode));
        getItemsTreeViewer().setSelection(StructuredSelection.EMPTY);
    }
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) IContentProvider(org.eclipse.jface.viewers.IContentProvider) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Aggregations

IRepositoryNode (org.talend.repository.model.IRepositoryNode)73 RepositoryNode (org.talend.repository.model.RepositoryNode)24 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)21 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)13 PersistenceException (org.talend.commons.exception.PersistenceException)13 ArrayList (java.util.ArrayList)12 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)12 WizardDialog (org.eclipse.jface.wizard.WizardDialog)10 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)8 IEditorPart (org.eclipse.ui.IEditorPart)8 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)8 ISelection (org.eclipse.jface.viewers.ISelection)6 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)6 ProcessItem (org.talend.core.model.properties.ProcessItem)6 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)6 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)6 IRepositoryView (org.talend.repository.ui.views.IRepositoryView)6 IPath (org.eclipse.core.runtime.IPath)5 PartInitException (org.eclipse.ui.PartInitException)5 Item (org.talend.core.model.properties.Item)5