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");
}
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations