use of org.talend.designer.core.model.utils.emf.talendfile.NodeType in project tesb-studio-se by Talend.
the class UpdateCJMSProjectMigrationTask method updateJMSComponent.
/**
* Update cJMS, add cMQConnectionFactory.
*
* @param item
* @throws PersistenceException
*/
@SuppressWarnings("unchecked")
private void updateJMSComponent(Item item) throws PersistenceException {
ProcessType processType = getProcessType(item);
if (processType == null) {
return;
}
boolean modified = false;
List<NodeType> nodes = new ArrayList<NodeType>();
for (Object o : processType.getNode()) {
if (o instanceof NodeType) {
NodeType currentNode = (NodeType) o;
if ("cJMS".equals(currentNode.getComponentName())) {
modified = true;
NodeType cfNode = createConnectionFactoryNode(currentNode);
nodes.add(cfNode);
}
}
}
if (modified) {
locateNodes(processType, nodes);
processType.getNode().addAll(nodes);
REPO_FACTORY.save(item, true);
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.NodeType in project tesb-studio-se by Talend.
the class UpdateCJMSProjectMigrationTask method locateNodes.
/**
* Compute the location of cMQConnectionFactory Node
*
* @param processType
* @param nodes
*/
private void locateNodes(ProcessType processType, List<NodeType> nodes) {
int maxY = getMaxY(processType);
int index = 1;
for (NodeType node : nodes) {
node.setPosX(100 * index);
node.setPosY(maxY + 100);
index++;
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.NodeType in project tesb-studio-se by Talend.
the class NormalizeDataServiceJobBuildTypeMigrationTask method execute.
/*
* (non-Javadoc)
*
* @see
* org.talend.core.model.migration.AbstractDataserviceMigrationTask#execute(org
* .talend.core.model.properties.Item)
*/
@SuppressWarnings("unchecked")
@Override
public ExecutionResult execute(Item item) {
final ProcessType processType = getProcessType(item);
boolean modified = false;
for (String name : ESB_COMPONENTS) {
IComponentFilter filter = new NameComponentFilter(name);
List<NodeType> c = searchComponent(processType, filter);
if (!c.isEmpty()) {
Object buildType = item.getProperty().getAdditionalProperties().get(BUILD_TYPE_PROPERTY);
if (BUILD_TYPE_ROUTE.equals(buildType)) {
item.getProperty().getAdditionalProperties().put(BUILD_TYPE_PROPERTY, BUILD_TYPE_OSGI);
try {
save(item);
modified |= true;
generateReportRecord(new MigrationReportRecorder(this, MigrationReportRecorder.MigrationOperationType.MODIFY, item, null, "Build Type", BUILD_TYPE_ROUTE, BUILD_TYPE_OSGI));
} catch (PersistenceException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
return ExecutionResult.SUCCESS_NO_ALERT;
}
}
}
if (modified) {
return ExecutionResult.SUCCESS_NO_ALERT;
} else {
return ExecutionResult.NOTHING_TO_DO;
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.NodeType in project tesb-studio-se by Talend.
the class AbstractRouteItemComponentMigrationTask method execute.
/*
*
*/
/* (non-Javadoc)
* @see org.talend.camel.designer.migration.AbstractRouteItemMigrationTask#execute(org.talend.camel.core.model.camelProperties.CamelProcessItem)
*/
@Override
public final ExecutionResult execute(CamelProcessItem item) {
this.routeItem = item;
List<NodeType> nodes = findComponentNodesRegex(item, getComponentNameRegex());
if (nodes.isEmpty()) {
return ExecutionResult.NOTHING_TO_DO;
}
try {
boolean needSave = false;
for (NodeType node : nodes) {
needSave |= execute(node);
}
if (needSave) {
saveItem(item);
return ExecutionResult.SUCCESS_NO_ALERT;
} else {
return ExecutionResult.NOTHING_TO_DO;
}
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
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;
}
Aggregations