Search in sources :

Example 91 with ElementParameterType

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

the class NewComponentFrameworkMigrationTask method execute.

@Override
public ExecutionResult execute(final Item item) {
    final ProcessType processType = getProcessType(item);
    ComponentCategory category = ComponentCategory.getComponentCategoryFromItem(item);
    Properties props = getPropertiesFromFile();
    IComponentConversion conversion = new IComponentConversion() {

        @Override
        public void transform(NodeType nodeType) {
            if (nodeType == null || props == null) {
                return;
            }
            boolean modified = false;
            Map<String, String> schemaParamMap = new HashMap<>();
            String currComponentName = nodeType.getComponentName();
            String newComponentName = props.getProperty(currComponentName);
            nodeType.setComponentName(newComponentName);
            IComponent component = ComponentsFactoryProvider.getInstance().get(newComponentName, category.getName());
            ComponentProperties compProperties = ComponentsUtils.getComponentProperties(newComponentName);
            FakeNode fNode = new FakeNode(component);
            for (IElementParameter param : fNode.getElementParameters()) {
                if (param instanceof GenericElementParameter) {
                    String paramName = param.getName();
                    NamedThing currNamedThing = ComponentsUtils.getGenericSchemaElement(compProperties, paramName);
                    String oldParamName = props.getProperty(currComponentName + IGenericConstants.EXP_SEPARATOR + paramName);
                    if (oldParamName != null && !(oldParamName = oldParamName.trim()).isEmpty()) {
                        if (currNamedThing instanceof Property && (GenericTypeUtils.isSchemaType((Property<?>) currNamedThing))) {
                            schemaParamMap.put(paramName, props.getProperty(currComponentName + IGenericConstants.EXP_SEPARATOR + paramName + IGenericConstants.EXP_SEPARATOR + "connector"));
                        }
                        ElementParameterType paramType = getParameterType(nodeType, oldParamName);
                        if (paramType != null) {
                            if (currNamedThing instanceof ComponentReferenceProperties) {
                                ComponentReferenceProperties refProps = (ComponentReferenceProperties) currNamedThing;
                                refProps.referenceType.setValue(ComponentReferenceProperties.ReferenceType.COMPONENT_INSTANCE);
                                refProps.componentInstanceId.setStoredValue(ParameterUtilTool.convertParameterValue(paramType));
                                refProps.componentInstanceId.setTaggedValue(IGenericConstants.ADD_QUOTES, true);
                            } else {
                                processMappedElementParameter(props, nodeType, (GenericElementParameter) param, paramType, currNamedThing);
                            }
                            ParameterUtilTool.removeParameterType(nodeType, paramType);
                            modified = true;
                        }
                        if (EParameterFieldType.SCHEMA_REFERENCE.equals(param.getFieldType())) {
                            //$NON-NLS-1$
                            String schemaTypeName = ":" + EParameterName.SCHEMA_TYPE.getName();
                            //$NON-NLS-1$
                            String repSchemaTypeName = ":" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName();
                            paramType = getParameterType(nodeType, oldParamName + schemaTypeName);
                            if (paramType != null) {
                                paramType.setName(param.getName() + schemaTypeName);
                            }
                            paramType = getParameterType(nodeType, oldParamName + repSchemaTypeName);
                            if (paramType != null) {
                                paramType.setName(param.getName() + repSchemaTypeName);
                            }
                        }
                    } else {
                        processUnmappedElementParameter(props, nodeType, (GenericElementParameter) param, currNamedThing);
                    }
                } else {
                    if (EParameterFieldType.SCHEMA_REFERENCE.equals(param.getFieldType())) {
                        String paramName = param.getName();
                        schemaParamMap.put(paramName, props.getProperty(currComponentName + IGenericConstants.EXP_SEPARATOR + paramName + IGenericConstants.EXP_SEPARATOR + "connector"));
                        String oldParamName = props.getProperty(currComponentName + IGenericConstants.EXP_SEPARATOR + paramName);
                        //$NON-NLS-1$
                        String schemaTypeName = ":" + EParameterName.SCHEMA_TYPE.getName();
                        //$NON-NLS-1$
                        String repSchemaTypeName = ":" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName();
                        ElementParameterType paramType = getParameterType(nodeType, oldParamName + schemaTypeName);
                        if (paramType != null) {
                            paramType.setName(param.getName() + schemaTypeName);
                        }
                        paramType = getParameterType(nodeType, oldParamName + repSchemaTypeName);
                        if (paramType != null) {
                            paramType.setName(param.getName() + repSchemaTypeName);
                        }
                    }
                }
            }
            // Migrate schemas
            Map<String, MetadataType> metadatasMap = new HashMap<>();
            EList<MetadataType> metadatas = nodeType.getMetadata();
            for (MetadataType metadataType : metadatas) {
                metadatasMap.put(metadataType.getConnector(), metadataType);
            }
            Iterator<Entry<String, String>> schemaParamIter = schemaParamMap.entrySet().iterator();
            //$NON-NLS-1$
            String uniqueName = ParameterUtilTool.getParameterValue(nodeType, "UNIQUE_NAME");
            while (schemaParamIter.hasNext()) {
                Entry<String, String> schemaParamEntry = schemaParamIter.next();
                String newParamName = schemaParamEntry.getKey();
                String connectorMapping = schemaParamEntry.getValue();
                //$NON-NLS-1$
                String oldConnector = connectorMapping.split("->")[0];
                //$NON-NLS-1$
                String newConnector = connectorMapping.split("->")[1];
                MetadataType metadataType = metadatasMap.get(oldConnector);
                if (metadataType != null) {
                    metadataType.setConnector(newConnector);
                    MetadataEmfFactory factory = new MetadataEmfFactory();
                    factory.setMetadataType(metadataType);
                    IMetadataTable metadataTable = factory.getMetadataTable();
                    Schema schema = SchemaUtils.convertTalendSchemaIntoComponentSchema(ConvertionHelper.convert(metadataTable));
                    compProperties.setValue(newParamName, schema);
                }
                if (!oldConnector.equals(newConnector)) {
                    // if connector was changed, we should update the connections
                    for (Object connectionObj : processType.getConnection()) {
                        if (connectionObj instanceof ConnectionType) {
                            ConnectionType connectionType = (ConnectionType) connectionObj;
                            if (connectionType.getSource().equals(uniqueName) && connectionType.getConnectorName().equals(oldConnector)) {
                                connectionType.setConnectorName(newConnector);
                            }
                        }
                    }
                }
            }
            for (Object connectionObj : processType.getConnection()) {
                ConnectionType connection = (ConnectionType) connectionObj;
                if (connection.getSource() != null && connection.getSource().equals(uniqueName)) {
                    if (EConnectionType.FLOW_MAIN.getName().equals(connection.getConnectorName())) {
                        connection.setConnectorName(Connector.MAIN_NAME);
                    }
                }
            }
            if (modified) {
                String serializedProperties = compProperties.toSerialized();
                if (serializedProperties != null) {
                    ElementParameterType pType = //$NON-NLS-1$
                    ParameterUtilTool.createParameterType(//$NON-NLS-1$
                    null, //$NON-NLS-1$
                    "PROPERTIES", serializedProperties);
                    nodeType.getElementParameter().add(pType);
                }
            }
        }
    };
    if (processType != null) {
        boolean modified = false;
        for (Object obj : processType.getNode()) {
            if (obj != null && obj instanceof NodeType) {
                String componentName = ((NodeType) obj).getComponentName();
                String newComponentName = props.getProperty(componentName);
                if (newComponentName == null) {
                    continue;
                }
                IComponentFilter filter = new NameComponentFilter(componentName);
                modified = ModifyComponentsAction.searchAndModify((NodeType) obj, filter, Arrays.<IComponentConversion>asList(conversion)) || modified;
            }
        }
        if (modified) {
            try {
                ProxyRepositoryFactory.getInstance().save(item, true);
                return ExecutionResult.SUCCESS_NO_ALERT;
            } catch (PersistenceException e) {
                ExceptionHandler.process(e);
                return ExecutionResult.FAILURE;
            }
        }
    }
    return ExecutionResult.NOTHING_TO_DO;
}
Also used : MetadataEmfFactory(org.talend.designer.core.model.metadata.MetadataEmfFactory) ComponentProperties(org.talend.components.api.properties.ComponentProperties) HashMap(java.util.HashMap) IComponent(org.talend.core.model.components.IComponent) Schema(org.apache.avro.Schema) NameComponentFilter(org.talend.core.model.components.filters.NameComponentFilter) Properties(java.util.Properties) ComponentProperties(org.talend.components.api.properties.ComponentProperties) ComponentReferenceProperties(org.talend.components.api.properties.ComponentReferenceProperties) ComponentCategory(org.talend.core.model.components.ComponentCategory) ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) Entry(java.util.Map.Entry) GenericElementParameter(org.talend.designer.core.generic.model.GenericElementParameter) IElementParameter(org.talend.core.model.process.IElementParameter) Property(org.talend.daikon.properties.property.Property) ConnectionType(org.talend.designer.core.model.utils.emf.talendfile.ConnectionType) EConnectionType(org.talend.core.model.process.EConnectionType) IComponentFilter(org.talend.core.model.components.filters.IComponentFilter) MetadataType(org.talend.designer.core.model.utils.emf.talendfile.MetadataType) NamedThing(org.talend.daikon.NamedThing) ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) PersistenceException(org.talend.commons.exception.PersistenceException) ComponentReferenceProperties(org.talend.components.api.properties.ComponentReferenceProperties) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Example 92 with ElementParameterType

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

the class NewMarketoMigrationTask method getParameterType.

@Override
protected ElementParameterType getParameterType(NodeType node, String paramName) {
    ElementParameterType paramType = ParameterUtilTool.findParameterType(node, paramName);
    //
    if ("USE_SOAP_API".equals(paramName) && paramType == null) {
        ParameterUtilTool.addParameterType(node, "RADIO", "USE_SOAP_API", "true");
        paramType = ParameterUtilTool.findParameterType(node, paramName);
    }
    if (node != null && paramType != null) {
        String componentName = node.getComponentName();
        Object value = ParameterUtilTool.convertParameterValue(paramType);
        if ("USE_SOAP_API".equals(paramName)) {
            if ("true".equals(String.valueOf(value))) {
                paramType.setValue("SOAP");
            } else {
                paramType.setValue("REST");
            }
        }
        // Correct typo in tMarketoInput's operation since 563
        if ("OPERATION".equals(paramName) && "getMutipleLeads".equals(String.valueOf(value))) {
            paramType.setValue("getMultipleLeads");
        }
        // Correct ListOperation value
        if ("OPERATION".equals(paramName) && "tMarketoListOperation".equals(componentName)) {
            switch(String.valueOf(value)) {
                case "ADDTOLIST":
                    paramType.setValue("addTo");
                    break;
                case "ISMEMBEROFLIST":
                    paramType.setValue("isMemberOf");
                    break;
                case "REMOVEFROMLIST":
                    paramType.setValue("removeFrom");
                    break;
            }
        }
        // Otherwise, we feed the value with BATCH_SIZE.
        if ("MAX_RETURN".equals(paramName) && "tMarketoInput".equals(componentName)) {
            ElementParameterType operation = ParameterUtilTool.findParameterType(node, "OPERATION");
            ElementParameterType leadSelector = ParameterUtilTool.findParameterType(node, "LEAD_SELECTOR");
            ElementParameterType batchSize = ParameterUtilTool.findParameterType(node, "BATCH_SIZE");
            ElementParameterType maxReturn = ParameterUtilTool.findParameterType(node, "MAX_RETURN");
            Object batchSizeValue = ParameterUtilTool.convertParameterValue(batchSize);
            if (operation != null && leadSelector != null) {
                Object operationValue = ParameterUtilTool.convertParameterValue(operation);
                Object leadSelectorValue = ParameterUtilTool.convertParameterValue(leadSelector);
                Object maxReturnValue = ParameterUtilTool.convertParameterValue(maxReturn);
                if ("getMutipleLeads".equals(String.valueOf(operationValue)) && "LeadKeySelector".equals(String.valueOf(leadSelectorValue)) && maxReturnValue != null) {
                    paramType.setValue(String.valueOf(maxReturnValue));
                } else {
                    paramType.setValue(String.valueOf(batchSizeValue));
                }
            } else {
                paramType.setValue(String.valueOf(batchSizeValue));
            }
        }
    }
    return paramType;
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)

Example 93 with ElementParameterType

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

the class ChangeModelForRoutineParameterMigrationTask2 method execute.

@SuppressWarnings("unchecked")
@Override
public ExecutionResult execute(Item item) {
    try {
        List<String> possibleRoutines = new ArrayList<String>();
        List<String> routinesToAdd = new ArrayList<String>();
        String additionalString = LanguageManager.getCurrentLanguage() == ECodeLanguage.JAVA ? "." : "";
        IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
        List<IRepositoryViewObject> routines = factory.getAll(ProjectManager.getInstance().getCurrentProject(), ERepositoryObjectType.ROUTINES);
        // always add the system, others must be checked
        for (IRepositoryViewObject object : routines) {
            if (((RoutineItem) object.getProperty().getItem()).isBuiltIn()) {
                routinesToAdd.add(object.getLabel());
            } else {
                possibleRoutines.add(object.getLabel());
            }
        }
        for (Project project : ProjectManager.getInstance().getAllReferencedProjects()) {
            List<IRepositoryViewObject> refRoutines = factory.getAll(project, ERepositoryObjectType.ROUTINES);
            for (IRepositoryViewObject object : refRoutines) {
                if (!((RoutineItem) object.getProperty().getItem()).isBuiltIn()) {
                    if (!possibleRoutines.contains(object.getLabel())) {
                        possibleRoutines.add(object.getLabel());
                        routines.add(object);
                    }
                }
            }
        }
        List<RoutinesParameterType> oldList = Collections.EMPTY_LIST;
        ProcessType processType = getProcessType(item);
        if (null != processType) {
            if (processType.getParameters() != null && processType.getParameters().getRoutinesParameter() == null) {
                ParametersType parameterType = TalendFileFactory.eINSTANCE.createParametersType();
                processType.setParameters(parameterType);
                if (item instanceof ProcessItem) {
                    routinesToAdd.addAll(possibleRoutines);
                    possibleRoutines.clear();
                }
            } else {
                if (processType.getParameters() == null) {
                    processType.setParameters(TalendFileFactory.eINSTANCE.createParametersType());
                }
                oldList = new ArrayList<RoutinesParameterType>(processType.getParameters().getRoutinesParameter());
                if (oldList.isEmpty() && item instanceof ProcessItem) {
                    routinesToAdd.addAll(possibleRoutines);
                    possibleRoutines.clear();
                }
                processType.getParameters().getRoutinesParameter().clear();
            }
            if (processType.getRoutinesDependencies() != null && !processType.getRoutinesDependencies().isEmpty()) {
                processType.getRoutinesDependencies().clear();
            }
            List<RoutinesParameterType> routinesDependencies = (List<RoutinesParameterType>) processType.getParameters().getRoutinesParameter();
            if (!possibleRoutines.isEmpty()) {
                // check possible routines to setup in process
                for (ElementParameterType param : (List<ElementParameterType>) processType.getParameters().getElementParameter()) {
                    for (String routine : possibleRoutines) {
                        if (!routinesToAdd.contains(routine) && param.getValue() != null && param.getValue().contains(routine + additionalString)) {
                            routinesToAdd.add(routine);
                        }
                        for (ElementValueType elementValue : (List<ElementValueType>) param.getElementValue()) {
                            if (!routinesToAdd.contains(routine) && elementValue.getValue() != null && elementValue.getValue().contains(routine + additionalString)) {
                                routinesToAdd.add(routine);
                            }
                        }
                    }
                }
                // check possible routines to setup in nodes
                for (NodeType node : ((List<NodeType>) processType.getNode())) {
                    for (ElementParameterType param : (List<ElementParameterType>) node.getElementParameter()) {
                        for (String routine : possibleRoutines) {
                            if (!routinesToAdd.contains(routine) && param.getValue() != null && param.getValue().contains(routine + additionalString)) {
                                routinesToAdd.add(routine);
                            }
                            for (ElementValueType elementValue : (List<ElementValueType>) param.getElementValue()) {
                                if (!routinesToAdd.contains(routine) && elementValue.getValue() != null && elementValue.getValue().contains(routine + additionalString)) {
                                    routinesToAdd.add(routine);
                                }
                            }
                        }
                    }
                }
                // check possible routines to setup in connections
                for (ConnectionType connection : ((List<ConnectionType>) processType.getConnection())) {
                    for (ElementParameterType param : (List<ElementParameterType>) connection.getElementParameter()) {
                        for (String routine : possibleRoutines) {
                            if (!routinesToAdd.contains(routine) && param.getValue() != null && param.getValue().contains(routine + additionalString)) {
                                routinesToAdd.add(routine);
                            }
                            for (ElementValueType elementValue : (List<ElementValueType>) param.getElementValue()) {
                                if (!routinesToAdd.contains(routine) && elementValue.getValue() != null && elementValue.getValue().contains(routine + additionalString)) {
                                    routinesToAdd.add(routine);
                                }
                            }
                        }
                    }
                }
            }
            // just in case some routine dependencies exist before but are lost... (migration from 4.1.1 or 4.1.2)
            for (RoutinesParameterType routine : oldList) {
                if (!routinesToAdd.contains(routine.getName())) {
                    routinesDependencies.add(routine);
                }
            }
            for (IRepositoryViewObject object : routines) {
                if (routinesToAdd.contains(object.getLabel())) {
                    RoutinesParameterType routinesParameterType = TalendFileFactory.eINSTANCE.createRoutinesParameterType();
                    routinesParameterType.setId(object.getId());
                    routinesParameterType.setName(object.getLabel());
                    routinesDependencies.add(routinesParameterType);
                }
            }
            factory.save(item, true);
        }
        return ExecutionResult.SUCCESS_NO_ALERT;
    } catch (Exception e) {
        ExceptionHandler.process(e);
        return ExecutionResult.FAILURE;
    }
}
Also used : ConnectionType(org.talend.designer.core.model.utils.emf.talendfile.ConnectionType) RoutinesParameterType(org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType) ArrayList(java.util.ArrayList) RoutineItem(org.talend.core.model.properties.RoutineItem) ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) Project(org.talend.core.model.general.Project) ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) ElementValueType(org.talend.designer.core.model.utils.emf.talendfile.ElementValueType) ProcessItem(org.talend.core.model.properties.ProcessItem) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ArrayList(java.util.ArrayList) List(java.util.List) ParametersType(org.talend.designer.core.model.utils.emf.talendfile.ParametersType) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 94 with ElementParameterType

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

the class ChangeReturnTypeOfServerAliveResult method convertItem.

private boolean convertItem(Item item, ProcessType processType) throws PersistenceException {
    ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    boolean modified = false;
    ECodeLanguage language = getProject().getLanguage();
    EList node = processType.getNode();
    EList connections = processType.getConnection();
    for (Object n : node) {
        NodeType type = (NodeType) n;
        EList elementParameterList = type.getElementParameter();
        for (Object elem : elementParameterList) {
            ElementParameterType elemType = (ElementParameterType) elem;
            if (language.equals(ECodeLanguage.JAVA)) {
                if (elemType.getValue() != null && elemType.getValue().contains("tServerAlive")) {
                    //$NON-NLS-1$
                    Matcher match = PATTERN_GET.matcher(elemType.getValue());
                    String replace = getReplaceValue(match);
                    if (replace != null && replace.length() > 0) {
                        elemType.setValue(replace);
                        modified = true;
                    }
                }
            }
            // for table
            EList elemValue = elemType.getElementValue();
            for (Object elemV : elemValue) {
                ElementValueType elemVal = (ElementValueType) elemV;
                if (language.equals(ECodeLanguage.JAVA)) {
                    if (elemVal.getValue() != null && elemVal.getValue().contains("tServerAlive")) {
                        //$NON-NLS-1$
                        Matcher match = PATTERN_GET.matcher(elemVal.getValue());
                        String replace = getReplaceValue(match);
                        if (replace != null && replace.length() > 0) {
                            elemVal.setValue(replace);
                            modified = true;
                        }
                    }
                }
            }
        }
    }
    // the links
    for (Object n : connections) {
        ConnectionType type = (ConnectionType) n;
        EList elementParameterList = type.getElementParameter();
        for (Object elem : elementParameterList) {
            ElementParameterType elemType = (ElementParameterType) elem;
            if (language.equals(ECodeLanguage.JAVA)) {
                if (elemType.getValue() != null && elemType.getValue().contains("tServerAlive")) {
                    //$NON-NLS-1$
                    Matcher match = PATTERN_GET.matcher(elemType.getValue());
                    String replace = getReplaceValue(match);
                    if (replace != null && replace.length() > 0) {
                        elemType.setValue(replace);
                        modified = true;
                    }
                }
            }
        }
    }
    if (modified) {
        factory.save(item, true);
    }
    return modified;
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory) EList(org.eclipse.emf.common.util.EList) ElementValueType(org.talend.designer.core.model.utils.emf.talendfile.ElementValueType) ConnectionType(org.talend.designer.core.model.utils.emf.talendfile.ConnectionType) Matcher(java.util.regex.Matcher) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) ECodeLanguage(org.talend.core.language.ECodeLanguage)

Example 95 with ElementParameterType

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

the class ChangeSalesForceComponetsCustomerModuleName method execute.

@Override
public ExecutionResult execute(Item item) {
    ProcessType processType = getProcessType(item);
    if (getProject().getLanguage() != ECodeLanguage.JAVA || processType == null) {
        return ExecutionResult.NOTHING_TO_DO;
    }
    String[] componentsName = new String[] { "tSalesforceBulkExec", "tSalesforceGetDeleted", "tSalesforceGetUpdated", "tSalesforceInput", "tSalesforceOutput", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    "tSalesforceOutputBulkExec" };
    IComponentConversion changeJDBCDriverJarType = new IComponentConversion() {

        public void transform(NodeType node) {
            ElementParameterType module = ComponentUtilities.getNodeProperty(node, "MODULENAME");
            if (module != null && "CustomModule".equals(module.getValue())) {
                ElementParameterType customModule = ComponentUtilities.getNodeProperty(node, "CUSTOM_MODULE");
                if (customModule == null) {
                    customModule = ComponentUtilities.getNodeProperty(node, "CUSTOM_MODULE_NAME");
                }
                if (customModule != null) {
                    String customModuleName = customModule.getValue();
                    if (customModuleName != null) {
                        if (!customModuleName.startsWith("\"")) {
                            customModuleName = "\"" + customModuleName;
                        }
                        if (!customModuleName.endsWith("\"")) {
                            customModuleName = customModuleName + "\"";
                        }
                        customModule.setValue(customModuleName);
                    }
                }
            }
        }
    };
    for (String name : componentsName) {
        //$NON-NLS-1$
        IComponentFilter filter = new NameComponentFilter(name);
        try {
            ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays.<IComponentConversion>asList(changeJDBCDriverJarType));
        } catch (PersistenceException e) {
            ExceptionHandler.process(e);
            return ExecutionResult.FAILURE;
        }
    }
    return ExecutionResult.SUCCESS_WITH_ALERT;
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) IComponentFilter(org.talend.core.model.components.filters.IComponentFilter) PersistenceException(org.talend.commons.exception.PersistenceException) NameComponentFilter(org.talend.core.model.components.filters.NameComponentFilter) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Aggregations

ElementParameterType (org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)197 NodeType (org.talend.designer.core.model.utils.emf.talendfile.NodeType)126 ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)114 PersistenceException (org.talend.commons.exception.PersistenceException)86 IComponentConversion (org.talend.core.model.components.conversions.IComponentConversion)85 IComponentFilter (org.talend.core.model.components.filters.IComponentFilter)83 NameComponentFilter (org.talend.core.model.components.filters.NameComponentFilter)83 EList (org.eclipse.emf.common.util.EList)40 ElementValueType (org.talend.designer.core.model.utils.emf.talendfile.ElementValueType)28 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)25 List (java.util.List)22 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)19 ArrayList (java.util.ArrayList)16 ProcessItem (org.talend.core.model.properties.ProcessItem)16 ParametersType (org.talend.designer.core.model.utils.emf.talendfile.ParametersType)15 ConnectionType (org.talend.designer.core.model.utils.emf.talendfile.ConnectionType)13 JobletProcessItem (org.talend.core.model.properties.JobletProcessItem)9 HashMap (java.util.HashMap)7 IOException (java.io.IOException)6 IElementParameter (org.talend.core.model.process.IElementParameter)6