Search in sources :

Example 26 with ElementParameterType

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

the class NewJMSComponentMigrationTask method adapteJMS.

/**
	 * Switch cActiveMQ to cJMS and adjust some parameters for cJMS.
	 * 
	 * @param item
	 * @throws PersistenceException
	 */
private void adapteJMS(NodeType currentNode) throws PersistenceException {
    if ("cActiveMQ".equals(currentNode.getComponentName())) {
        currentNode.setComponentName("cJMS");
        // Set schema name
        String name = computeTextElementValue("UNIQUE_NAME", currentNode.getElementParameter());
        if (name != null) {
            name = name.replace("_", "");
        } else {
            name = "name";
        }
        ElementParameterType paramType = createParamType("TEXT", "NAME", "\"" + name + "\"");
        currentNode.getElementParameter().add(paramType);
        ElementParameterType brokerType = createParamType("CLOSED_LIST", "MQ_TYPE", "ActiveMQ");
        currentNode.getElementParameter().add(brokerType);
        ElementParameterType param = findElementParameterByName("BROKER_URI", currentNode.getElementParameter());
        if (param != null) {
            param.setName("AMQ_BROKER_URI");
        }
    } else if ("cJMS".equals(currentNode.getComponentName())) {
        ElementParameterType param = createParamType("CLOSED_LIST", "MQ_TYPE", "Other");
        currentNode.getElementParameter().add(param);
        param = findElementParameterByName("CODE", currentNode.getElementParameter());
        if (param != null) {
            param.setName("OTHER_CODE");
        }
        param = findElementParameterByName("DRIVER_JAR", currentNode.getElementParameter());
        if (param != null) {
            param.setName("OTHER_DRIVER_JAR");
        }
    }
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)

Example 27 with ElementParameterType

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

the class NewJMSComponentMigrationTask method createParamType.

/**
	 * 
	 * Create a parameter of a node.
	 * 
	 * @param elemParams
	 * @param field
	 * @param name
	 * @param value
	 */
protected ElementParameterType createParamType(String field, String name, String value) {
    ElementParameterType paramType = TalendFileFactory.eINSTANCE.createElementParameterType();
    paramType.setField(field);
    paramType.setName(name);
    paramType.setValue(value);
    return paramType;
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)

Example 28 with ElementParameterType

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

the class RemoveRouteComponentIdMigrationTask method execute.

@Override
protected boolean execute(NodeType node) throws Exception {
    final ElementParameterType newParam = findParameterTypeByField(node, EParameterName.ROUTE_COMPONENT_TYPE.getName());
    if (newParam == null) {
        return false;
    }
    ElementParameterType oldParam = UtilTool.findParameterType(node, newParam.getName() + ":ROUTE_COMPONENT_TYPE_ID");
    if (oldParam == null) {
        return false;
    }
    newParam.setValue(oldParam.getValue());
    UtilTool.removeParameterType(node, oldParam);
    return true;
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)

Example 29 with ElementParameterType

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

the class RenameToCMQConnectionFactoryMigrationTask method handleRenameNode.

/**
	 * Rename node cJMSConnectionFactory to cMQConnectionFactory 
	 * @param node cJMSConnectionFactory node.
	 *
	 * @return true, if handle rename node
	 */
private boolean handleRenameNode(NodeType node) {
    node.setComponentName(C_MQ_CONNECTION_FACTORY);
    ElementParameterType param = UtilTool.findParameterType(node, "UNIQUE_NAME");
    UtilTool.replaceValueSubSequence(param, C_JMS_CONNECTION_FACTORY, C_MQ_CONNECTION_FACTORY);
    return true;
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)

Example 30 with ElementParameterType

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

the class UpdateRouteResourceTypeMigrationTask method execute.

@Override
protected boolean execute(NodeType node) throws Exception {
    final ElementParameterType newParam = findParameterTypeByField(node, EParameterName.ROUTE_RESOURCE_TYPE.getName());
    if (newParam == null) {
        return false;
    }
    ElementParameterType oldParam = UtilTool.findParameterType(node, newParam.getName() + ":ROUTE_RESOURCE_TYPE_ID");
    if (oldParam == null) {
        return false;
    }
    newParam.setValue(oldParam.getValue());
    UtilTool.removeParameterType(node, oldParam);
    oldParam = UtilTool.findParameterType(node, newParam.getName() + ":ROUTE_RESOURCE_TYPE_RES_URI");
    if (oldParam == null) {
        return false;
    }
    UtilTool.removeParameterType(node, oldParam);
    return true;
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)

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