Search in sources :

Example 31 with ProcessType

use of org.talend.designer.core.model.utils.emf.talendfile.ProcessType in project tesb-studio-se by Talend.

the class ConsumerFaultResponseMigrationTask method addMoreFaultResponseMessage.

private void addMoreFaultResponseMessage(Item item) throws PersistenceException {
    if (item instanceof ProcessItem) {
        ProcessType processType = ((ProcessItem) item).getProcess();
        for (Object o : processType.getNode()) {
            if (o instanceof NodeType) {
                NodeType currentNode = (NodeType) o;
                if ("tESBConsumer".equals(currentNode.getComponentName())) {
                    Iterator<?> iterator = currentNode.getMetadata().iterator();
                    while (iterator.hasNext()) {
                        MetadataType metadataType = (MetadataType) iterator.next();
                        if ("FAULT".equals(metadataType.getConnector())) {
                            EList<?> column = metadataType.getColumn();
                            addColumn(column, faultActor);
                            addColumn(column, faultCode);
                            addColumn(column, faultNode);
                            addColumn(column, faultRole);
                        }
                    }
                }
            }
        }
        FACTORY.save(item, true);
    }
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) ProcessItem(org.talend.core.model.properties.ProcessItem) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) MetadataType(org.talend.designer.core.model.utils.emf.talendfile.MetadataType)

Example 32 with ProcessType

use of org.talend.designer.core.model.utils.emf.talendfile.ProcessType in project tdi-studio-se by Talend.

the class AbstractStandardJobBuildProviderTest method createJobItem.

protected Item createJobItem() throws PersistenceException {
    final IProxyRepositoryFactory repositoryFactory = DesignerPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
    final String testJobId = repositoryFactory.getNextId();
    final String testJobLabel = StandardJobStandaloneBuildProvider.class.getSimpleName() + System.currentTimeMillis();
    // copied from NewProcessWizard
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
    property.setVersion(VersionUtils.DEFAULT_VERSION);
    property.setStatusCode("");
    property.setId(testJobId);
    property.setDisplayName(testJobLabel);
    property.setLabel(property.getDisplayName());
    ProcessItem processItem = PropertiesFactory.eINSTANCE.createProcessItem();
    processItem.setProperty(property);
    property.setItem(processItem);
    ProcessType process = TalendFileFactory.eINSTANCE.createProcessType();
    ParametersType parameterType = TalendFileFactory.eINSTANCE.createParametersType();
    List<RoutinesParameterType> dependenciesInPreference = RoutinesUtil.createDependenciesInPreference();
    parameterType.getRoutinesParameter().addAll(dependenciesInPreference);
    process.setParameters(parameterType);
    processItem.setProcess(process);
    repositoryFactory.create(processItem, new Path(""));
    return processItem;
}
Also used : Path(org.eclipse.core.runtime.Path) ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) ProcessItem(org.talend.core.model.properties.ProcessItem) RoutinesParameterType(org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType) ParametersType(org.talend.designer.core.model.utils.emf.talendfile.ParametersType) Property(org.talend.core.model.properties.Property) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 33 with ProcessType

use of org.talend.designer.core.model.utils.emf.talendfile.ProcessType in project tdi-studio-se by Talend.

the class JobVersionUtilsTest method createRepositoryObject.

private IRepositoryViewObject createRepositoryObject(String lable) throws PersistenceException {
    // create item
    itemPath = new Path(folderName);
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
    property.setVersion(VersionUtils.DEFAULT_VERSION);
    //$NON-NLS-1$
    property.setStatusCode("");
    ProcessItem processItem = PropertiesFactory.eINSTANCE.createProcessItem();
    processItem.setProperty(property);
    repositoryFactory = RepositoryPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
    property.setId(repositoryFactory.getNextId());
    property.setLabel(lable);
    ProcessType process = TalendFileFactory.eINSTANCE.createProcessType();
    ParametersType parameterType = TalendFileFactory.eINSTANCE.createParametersType();
    // add depended routines.
    List<RoutinesParameterType> dependenciesInPreference = RoutinesUtil.createDependenciesInPreference();
    parameterType.getRoutinesParameter().addAll(dependenciesInPreference);
    process.setParameters(parameterType);
    processItem.setProcess(process);
    repositoryFactory.create(processItem, itemPath);
    return new RepositoryObject(property);
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) ProcessItem(org.talend.core.model.properties.ProcessItem) RepositoryObject(org.talend.core.model.repository.RepositoryObject) RoutinesParameterType(org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType) ParametersType(org.talend.designer.core.model.utils.emf.talendfile.ParametersType) Property(org.talend.core.model.properties.Property)

Example 34 with ProcessType

use of org.talend.designer.core.model.utils.emf.talendfile.ProcessType in project tesb-studio-se by Talend.

the class CamelDesignerUtil method checkRouteInputExistInJob.

public static boolean checkRouteInputExistInJob(ProcessItem pi) {
    if (pi == null) {
        return false;
    }
    EList<?> nodes = pi.getProcess().getNode();
    Iterator<?> iterator = nodes.iterator();
    while (iterator.hasNext()) {
        Object next = iterator.next();
        if (!(next instanceof NodeType)) {
            continue;
        }
        NodeType nt = (NodeType) next;
        if (!EmfModelUtils.isComponentActive(nt) && !EmfModelUtils.computeCheckElementValue("ACTIVATE", nt)) {
            continue;
        }
        String componentName = nt.getComponentName();
        if ("tRouteInput".equals(componentName)) {
            return true;
        } else if (service != null) {
            ProcessType jobletProcess = service.getJobletProcess(nt);
            if (jobletProcess == null) {
                continue;
            }
            if (checkRouteInputExistInJoblet(jobletProcess)) {
                return true;
            }
        }
    }
    return false;
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType)

Example 35 with ProcessType

use of org.talend.designer.core.model.utils.emf.talendfile.ProcessType in project tesb-studio-se by Talend.

the class LocalESBRunContainerServiceTest method testCreateJavaProcessor.

/**
     * Test method for
     * {@link org.talend.designer.esb.runcontainer.core.LocalESBRunContainerService#createJavaProcessor(org.talend.core.model.process.IProcess, Property, boolean)}
     */
@Test
public void testCreateJavaProcessor() {
    IESBRunContainerService service = (IESBRunContainerService) GlobalServiceRegister.getDefault().getService(IESBRunContainerService.class);
    String[] esbComponents = { "tESBProviderRequest", "tRESTClient", "tRESTRequest", "tRESTResponse", "tESBConsumer", "tESBProviderFault", "tESBProviderRequest", "tESBProviderResponse" };
    for (String esbComponent : esbComponents) {
        Property property = PropertiesFactory.eINSTANCE.createProperty();
        property.setVersion("0.1");
        property.setId("property1");
        property.setLabel("ESBArtifact");
        ProcessItem processItem = PropertiesFactory.eINSTANCE.createProcessItem();
        processItem.setProperty(property);
        property.setItem(processItem);
        ProcessType process = TalendFileFactory.eINSTANCE.createProcessType();
        processItem.setProcess(process);
        NodeType node = TalendFileFactory.eINSTANCE.createNodeType();
        process.getNode().add(node);
        node.setComponentName(esbComponent);
        IComponent tESBComponent = ComponentsFactoryProvider.getInstance().get(esbComponent, ComponentCategory.CATEGORY_4_DI.getName());
        Process esbJob = new Process(property);
        Node tESBComponent_1 = new Node(tESBComponent, esbJob);
        esbJob.addNodeContainer(new NodeContainer(tESBComponent_1));
        Assert.assertNotNull(service.createJavaProcessor(esbJob, property, false));
    }
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) IESBRunContainerService(org.talend.designer.runprocess.IESBRunContainerService) ProcessItem(org.talend.core.model.properties.ProcessItem) IComponent(org.talend.core.model.components.IComponent) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) Node(org.talend.designer.core.ui.editor.nodes.Node) Process(org.talend.designer.core.ui.editor.process.Process) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) Property(org.talend.core.model.properties.Property) Test(org.junit.Test)

Aggregations

ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)237 IComponentConversion (org.talend.core.model.components.conversions.IComponentConversion)154 NodeType (org.talend.designer.core.model.utils.emf.talendfile.NodeType)152 IComponentFilter (org.talend.core.model.components.filters.IComponentFilter)151 NameComponentFilter (org.talend.core.model.components.filters.NameComponentFilter)143 ElementParameterType (org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)114 PersistenceException (org.talend.commons.exception.PersistenceException)107 ArrayList (java.util.ArrayList)24 ProcessItem (org.talend.core.model.properties.ProcessItem)24 EList (org.eclipse.emf.common.util.EList)23 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)22 List (java.util.List)18 ElementValueType (org.talend.designer.core.model.utils.emf.talendfile.ElementValueType)16 ConnectionType (org.talend.designer.core.model.utils.emf.talendfile.ConnectionType)14 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)14 RenameComponentConversion (org.talend.core.model.components.conversions.RenameComponentConversion)12 JobletProcessItem (org.talend.core.model.properties.JobletProcessItem)12 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)10 MetadataType (org.talend.designer.core.model.utils.emf.talendfile.MetadataType)10 ParametersType (org.talend.designer.core.model.utils.emf.talendfile.ParametersType)10