use of org.talend.designer.core.model.utils.emf.talendfile.ProcessType in project tdi-studio-se by Talend.
the class UpdateJobSettingsForOracleMigrationTask method execute.
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
if (processType.getParameters() != null) {
@SuppressWarnings("rawtypes") EList elementParameter = processType.getParameters().getElementParameter();
boolean modified = false;
for (int i = 0; i < elementParameter.size(); i++) {
final Object object = elementParameter.get(i);
if (object instanceof ElementParameterTypeImpl) {
ElementParameterTypeImpl parameterType = (ElementParameterTypeImpl) object;
String name = parameterType.getName();
if ("DB_VERSION_IMPLICIT_CONTEXT".equals(name)) {
//$NON-NLS-1$
modified = updateJarValue(parameterType) || modified;
}
if ("DB_VERSION".equals(name)) {
//$NON-NLS-1$
modified = updateJarValue(parameterType) || modified;
}
}
}
if (modified) {
try {
FACTORY.save(item, true);
return ExecutionResult.SUCCESS_NO_ALERT;
} catch (PersistenceException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
}
return ExecutionResult.NOTHING_TO_DO;
}
use of org.talend.designer.core.model.utils.emf.talendfile.ProcessType in project tdi-studio-se by Talend.
the class UnifyParameterOfDatastaxAndHectorForCassandra method execute.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.migration.AbstractItemMigrationTask#execute(org.talend.core.model.properties.Item)
*/
@Override
public ExecutionResult execute(Item item) {
final ProcessType processType = getProcessType(item);
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
String[] compNames = { "tCassandraInput", "tCassandraOutput", "tCassandraRow", "tCassandraLookupInput" };
IComponentConversion conversion = new IComponentConversion() {
@Override
public void transform(NodeType node) {
if (node == null) {
return;
}
//$NON-NLS-1$
ElementParameterType cf = ComponentUtilities.getNodeProperty(node, "TABLE");
if (cf != null) {
if (ComponentUtilities.getNodeProperty(node, "COLUMN_FAMILY") == null) {
//$NON-NLS-1$
//$NON-NLS-1$ //$NON-NLS-2$
ComponentUtilities.addNodeProperty(node, "COLUMN_FAMILY", "TEXT");
}
//$NON-NLS-1$
ComponentUtilities.getNodeProperty(node, "COLUMN_FAMILY").setValue(cf.getValue());
}
//$NON-NLS-1$
ElementParameterType actionForCF = ComponentUtilities.getNodeProperty(node, "TABLE_ACTION");
if (actionForCF != null) {
if (ComponentUtilities.getNodeProperty(node, "ACTION_ON_COLUMN_FAMILY") == null) {
//$NON-NLS-1$
//$NON-NLS-1$ //$NON-NLS-2$
ComponentUtilities.addNodeProperty(node, "ACTION_ON_COLUMN_FAMILY", "TEXT");
}
//$NON-NLS-1$
ComponentUtilities.getNodeProperty(node, "ACTION_ON_COLUMN_FAMILY").setValue(actionForCF.getValue());
}
}
};
for (String name : compNames) {
IComponentFilter filter = new NameComponentFilter(name);
try {
ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays.<IComponentConversion>asList(conversion));
} catch (PersistenceException e) {
// TODO Auto-generated catch block
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
return ExecutionResult.SUCCESS_NO_ALERT;
}
use of org.talend.designer.core.model.utils.emf.talendfile.ProcessType in project tdi-studio-se by Talend.
the class UpdateKakfaInputConsumerTimeoutAndAutoOffsetTask method execute.
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
try {
//$NON-NLS-1$
IComponentFilter filter = new NameComponentFilter("tKafkaInput");
IComponentConversion addOption = new UpdateKakfaInputConversion();
ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays.<IComponentConversion>asList(addOption));
return ExecutionResult.SUCCESS_NO_ALERT;
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.ProcessType in project tdi-studio-se by Talend.
the class StripslachesOnQuotesForTCollectAndCheck method execute.
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
try {
IComponentFilter filter = new NameComponentFilter("tCollectAndCheck");
IComponentConversion addOption = new StripslachesOnQuotesForTCollectAndCheckConversion();
ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays.<IComponentConversion>asList(addOption));
return ExecutionResult.SUCCESS_NO_ALERT;
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.ProcessType in project tdi-studio-se by Talend.
the class UpgradetAdvancedFileOutputXMLMigrationTask method execute.
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
if (getProject().getLanguage() != ECodeLanguage.JAVA || processType == null) {
return ExecutionResult.NOTHING_TO_DO;
}
try {
//$NON-NLS-1$
IComponentFilter filter1 = new NameComponentFilter("tAdvancedFileOutputXML");
//$NON-NLS-1$
IComponentConversion removeQuotes1 = new UpdateMappingFortAdvancedXMLConversion();
ModifyComponentsAction.searchAndModify(item, processType, filter1, Arrays.<IComponentConversion>asList(removeQuotes1));
return ExecutionResult.SUCCESS_NO_ALERT;
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
Aggregations