use of org.talend.designer.core.model.utils.emf.talendfile.NodeType in project tdi-studio-se by Talend.
the class RenamePasswordParaForLdapMigrationTask method renamePasswordName.
private void renamePasswordName(Item item) {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
boolean modified = false;
ProcessType processType = getProcessType(item);
for (Object object : processType.getNode()) {
if (object instanceof NodeType) {
NodeType currentNode = (NodeType) object;
if (currentNode.getComponentName().startsWith("tLDAP")) {
//$NON-NLS-1$
for (Object o : currentNode.getElementParameter()) {
ElementParameterType para = (ElementParameterType) o;
if ("PASSWD".equals(para.getName())) {
//$NON-NLS-1$
//$NON-NLS-1$
para.setName("PASS");
modified = true;
break;
}
}
}
}
}
if (modified) {
try {
factory.save(item, true);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.NodeType in project tdi-studio-se by Talend.
the class RenameSchemaParameterForMSSqlConnectionMigrationTask method renamePasswordName.
private void renamePasswordName(Item item) {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
boolean modified = false;
ProcessType processType = getProcessType(item);
for (Object object : processType.getNode()) {
if (object instanceof NodeType) {
NodeType currentNode = (NodeType) object;
if (currentNode.getComponentName().startsWith("tMSSqlConnection")) {
//$NON-NLS-1$
for (Object o : currentNode.getElementParameter()) {
ElementParameterType para = (ElementParameterType) o;
if ("DB_SCHEMA".equals(para.getName())) {
//$NON-NLS-1$
//$NON-NLS-1$
para.setName("SCHEMA_DB");
modified = true;
break;
}
}
}
}
}
if (modified) {
try {
factory.save(item, true);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.NodeType in project tesb-studio-se by Talend.
the class AbstractRouteItemMigrationTask method findComponentNodes.
private List<NodeType> findComponentNodes(CamelProcessItem item, String search, boolean isRegex) {
if (search == null) {
throw new RuntimeException("Can't search component node by \"null\" in " + this.getClass());
}
ProcessType processType = item.getProcess();
if (processType == null) {
return Collections.emptyList();
}
List<NodeType> returnList = new ArrayList<NodeType>();
for (Object o : processType.getNode()) {
if (o instanceof NodeType) {
NodeType currentNode = (NodeType) o;
String componentName = currentNode.getComponentName();
if (isRegex) {
if (componentName.matches(search)) {
returnList.add(currentNode);
}
} else {
if (componentName.equals(search)) {
returnList.add(currentNode);
}
}
}
}
return returnList;
}
use of org.talend.designer.core.model.utils.emf.talendfile.NodeType in project tesb-studio-se by Talend.
the class DisconnectErroHandlerMigrationTask method findAllErrorHandlerIds.
private List<String> findAllErrorHandlerIds(ProcessType pt) {
List<String> errorHandlers = new ArrayList<String>();
for (Object o : pt.getNode()) {
if (!(o instanceof NodeType)) {
continue;
}
NodeType nt = (NodeType) o;
if (!"cErrorHandler".equals(nt.getComponentName())) {
continue;
}
EList elementParameter = nt.getElementParameter();
for (Object e : elementParameter) {
if (!(e instanceof ElementParameterType)) {
continue;
}
ElementParameterType ept = (ElementParameterType) e;
if ("UNIQUE_NAME".equals(ept.getName())) {
errorHandlers.add(ept.getValue());
}
}
}
return errorHandlers;
}
use of org.talend.designer.core.model.utils.emf.talendfile.NodeType 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);
}
}
Aggregations