use of org.talend.migration.MigrationReportRecorder in project tesb-studio-se by Talend.
the class UpdateRoutinesLibrariesMigrationTask method migrateCamelCore.
private void migrateCamelCore(RoutineItem routineItem) {
EList imports = routineItem.getImports();
List<ModuleNeeded> importNeedsList = ModulesNeededProvider.getModulesNeededForCamelCore();
for (ModuleNeeded model : importNeedsList) {
IMPORTType importTypeToAdd = ComponentFactory.eINSTANCE.createIMPORTType();
importTypeToAdd.setMODULE(model.getModuleName());
importTypeToAdd.setMESSAGE(model.getInformationMsg());
importTypeToAdd.setREQUIRED(model.isRequired());
importTypeToAdd.setMVN(model.getMavenUri());
if (!imports.contains(importTypeToAdd)) {
String messageAdd = String.format("Adding module needed for Routine: %s", importTypeToAdd.getMODULE());
generateReportRecord(new MigrationReportRecorder(this, MigrationReportRecorder.MigrationOperationType.ADD, routineItem, null, messageAdd, null, null));
imports.add(importTypeToAdd);
} else {
String messageAdd = String.format("Duplicate module found: %s", importTypeToAdd.getMODULE());
generateReportRecord(new MigrationReportRecorder(this, MigrationReportRecorder.MigrationOperationType.ADD, routineItem, null, messageAdd, null, null));
}
}
}
use of org.talend.migration.MigrationReportRecorder in project tesb-studio-se by Talend.
the class UpdateRoutinesLibrariesMigrationTask method upgradeModulesNeededForRoutines.
private boolean upgradeModulesNeededForRoutines(RoutineItem routineItem) {
EList imports = routineItem.getImports();
boolean migrateCamelCore = false;
for (Object imp : imports) {
if (imp instanceof IMPORTType) {
IMPORTType importType = (IMPORTType) imp;
String fullName = importType.getMODULE();
String version = fullName.substring(fullName.lastIndexOf('-') + 1, fullName.lastIndexOf("."));
String prefix = fullName.substring(0, fullName.lastIndexOf('-') + 1);
if (version != null && !version.equals(camelVersion) && (camelModuleListNew.contains(prefix) || camelModuleListOld.contains(prefix))) {
importType.setMODULE(fullName.replaceAll(version, camelVersion));
if (camelModuleListNew.contains(prefix)) {
importType.setMVN(importType.getMVN().replaceAll(groupIdOld, groupIdNew).replaceAll("-" + version + "/6.0.0", "/" + camelVersion));
} else {
importType.setMVN(importType.getMVN().replaceAll(version, camelVersion));
}
String message = String.format("Upgrading camel routine dependency %s version from %s to %s", fullName, version, camelVersion);
generateReportRecord(new MigrationReportRecorder(this, MigrationReportRecorder.MigrationOperationType.MODIFY, routineItem, null, message, null, null));
if (camelCorePrefix.equals(prefix)) {
migrateCamelCore = true;
}
}
}
}
return migrateCamelCore;
}
use of org.talend.migration.MigrationReportRecorder in project tesb-studio-se by Talend.
the class UpdatecKafkaMigrationTask method renameAdvancedParameters.
private boolean renameAdvancedParameters(NodeType currentNode) throws PersistenceException {
boolean needSave = false;
for (Object e : currentNode.getElementParameter()) {
ElementParameterType p = (ElementParameterType) e;
if ("URI_OPTIONS".equals(p.getName())) {
for (Object v : p.getElementValue()) {
ElementValueType ev = (ElementValueType) v;
if ("\"kafkaHeaderSerializer\"".equalsIgnoreCase(ev.getValue()) && "NAME".equalsIgnoreCase(ev.getElementRef())) {
ev.setValue("\"headerSerializer\"");
needSave = true;
generateReportRecord(new MigrationReportRecorder(this, MigrationReportRecorder.MigrationOperationType.MODIFY, getRouteItem(), currentNode, "URI_OPTIONS", "\"kafkaHeaderSerializer\"", "\"headerSerializer\""));
}
if ("\"kafkaHeaderDeserializer\"".equalsIgnoreCase(ev.getValue()) && "NAME".equalsIgnoreCase(ev.getElementRef())) {
ev.setValue("\"headerDeserializer\"");
needSave = true;
generateReportRecord(new MigrationReportRecorder(this, MigrationReportRecorder.MigrationOperationType.MODIFY, getRouteItem(), currentNode, "URI_OPTIONS", "\"kafkaHeaderDeserializer\"", "\"headerDeserializer\""));
}
}
}
}
return needSave;
}
use of org.talend.migration.MigrationReportRecorder 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.migration.MigrationReportRecorder in project tesb-studio-se by Talend.
the class RemoveAWSConnectionDefaultRegionMigrationTask method removeAWSConnectionDefaultRegion.
private boolean removeAWSConnectionDefaultRegion(NodeType nodeType) {
boolean needSave = false;
EList<ElementParameterType> list = nodeType.getElementParameter();
for (ElementParameterType elParameter : list) {
if ("REGION".equals(elParameter.getName()) && "DEFAULT".equals(elParameter.getValue())) {
elParameter.setValue("\"us-east-1\"");
needSave = true;
String message = "Migrating DEFAULT region of cAWSConnection to US East (N. Virginia)";
generateReportRecord(new MigrationReportRecorder(this, MigrationReportRecorder.MigrationOperationType.MODIFY, getRouteItem(), nodeType, message, "", "us-east-1"));
}
}
return needSave;
}
Aggregations