use of org.talend.designer.core.model.utils.emf.talendfile.ParametersType in project tdi-studio-se by Talend.
the class MigrateDeprecatedHadoopDistribution1 method changeMRConfiguration.
private void changeMRConfiguration(ProcessType processType, Item item) throws PersistenceException {
boolean modified = false;
final ParametersType parameters = processType.getParameters();
if (parameters != null) {
EList elementParameters = parameters.getElementParameter();
for (int i = 0; i < elementParameters.size(); i++) {
ElementParameterType param = (ElementParameterType) elementParameters.get(i);
if ("MR_VERSION".equals(param.getName())) {
//$NON-NLS-1$
if (values.containsKey(param.getValue())) {
param.setValue(values.get(param.getValue()));
modified = true;
}
break;
}
}
}
if (modified) {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
factory.save(item, true);
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.ParametersType in project tdi-studio-se by Talend.
the class RenameSparkVersions method execute.
@Override
public ExecutionResult execute(Item item) {
try {
ProcessType processType = getProcessType(item);
if (processType != null) {
final ParametersType parameters = processType.getParameters();
if (parameters != null) {
boolean modified = false;
EList<ElementParameterType> elementParameters = parameters.getElementParameter();
for (int i = 0; i < elementParameters.size(); i++) {
ElementParameterType param = elementParameters.get(i);
if ("SPARK_VERSION".equals(param.getName())) {
//$NON-NLS-1$
if ("Cloudera_CDH51".equals(param.getValue())) {
//$NON-NLS-1$
//$NON-NLS-1$
param.setValue("Cloudera_CDH5_1");
modified = true;
}
if ("MAPR_410".equals(param.getValue())) {
//$NON-NLS-1$
//$NON-NLS-1$
param.setValue("MAPR410");
modified = true;
}
break;
}
}
if (modified) {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
factory.save(item, true);
return ExecutionResult.SUCCESS_NO_ALERT;
}
}
}
} catch (PersistenceException e) {
return ExecutionResult.FAILURE;
}
return ExecutionResult.NOTHING_TO_DO;
}
use of org.talend.designer.core.model.utils.emf.talendfile.ParametersType in project tdi-studio-se by Talend.
the class ChangeDefaultSparkSerializer method changeSparkConfiguration.
private void changeSparkConfiguration(ProcessType processType, Item item) throws PersistenceException {
boolean modified = false;
final ParametersType parameters = processType.getParameters();
if (parameters != null) {
EList elementParameters = parameters.getElementParameter();
ElementParameterType property = TalendFileFactory.eINSTANCE.createElementParameterType();
//$NON-NLS-1$
property.setName("CUSTOMIZE_SPARK_SERIALIZER");
//$NON-NLS-1$
property.setField("CHECK");
//$NON-NLS-1$
property.setValue("true");
elementParameters.add(property);
property = TalendFileFactory.eINSTANCE.createElementParameterType();
//$NON-NLS-1$
property.setName("SPARK_SERIALIZER");
//$NON-NLS-1$
property.setField("TEXT");
//$NON-NLS-1$
property.setValue("\"org.apache.spark.serializer.JavaSerializer\"");
elementParameters.add(property);
for (int i = 0; i < elementParameters.size(); i++) {
ElementParameterType param = (ElementParameterType) elementParameters.get(i);
if ("ADVANCED_SETTINGS_CHECK".equals(param.getName())) {
//$NON-NLS-1$
//$NON-NLS-1$
param.setValue("true");
modified = true;
break;
}
}
}
if (modified) {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
factory.save(item, true);
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.ParametersType in project tdi-studio-se by Talend.
the class UnifyPasswordEncryption4ParametersInJobMigrationTask method checkJobsettintsParameter.
protected boolean checkJobsettintsParameter(Item item, ProcessType processType) throws Exception {
boolean modified = false;
ParametersType parameters = processType.getParameters();
for (Object p : parameters.getElementParameter()) {
if (p instanceof ElementParameterType) {
ElementParameterType param = (ElementParameterType) p;
// variable name used for Stat&Logs
if ("PASS".equals(param.getName())) {
//$NON-NLS-1$
param.setField(EParameterFieldType.PASSWORD.getName());
if (reencryptValueIfNeeded(param)) {
modified = true;
}
}
// variable name used for implicit context
if ("PASS_IMPLICIT_CONTEXT".equals(param.getName())) {
//$NON-NLS-1$
param.setField(EParameterFieldType.PASSWORD.getName());
if (reencryptValueIfNeeded(param)) {
modified = true;
}
}
}
}
return modified;
}
use of org.talend.designer.core.model.utils.emf.talendfile.ParametersType in project tdi-studio-se by Talend.
the class RemoveUseHadoopPropertiesFortMRConfiguration method execute.
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
if (processType != null) {
boolean modified = false;
final ParametersType parameters = processType.getParameters();
if (parameters != null) {
EList elementParameters = parameters.getElementParameter();
for (int i = 0; i < elementParameters.size(); i++) {
ElementParameterType param = (ElementParameterType) elementParameters.get(i);
if ("USE_HADOOP_PROPERTIES".equals(param.getName())) {
//$NON-NLS-1$ //$NON-NLS-2$
if ("false".equalsIgnoreCase(param.getValue())) {
for (int j = 0; j < elementParameters.size(); j++) {
ElementParameterType hadoopProps = (ElementParameterType) elementParameters.get(j);
if ("HADOOP_ADVANCED_PROPERTIES".equalsIgnoreCase(hadoopProps.getName())) {
hadoopProps.getElementValue().clear();
}
}
}
elementParameters.remove(param);
modified = true;
break;
}
}
}
if (modified) {
try {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
factory.save(item, true);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
return ExecutionResult.SUCCESS_NO_ALERT;
}
}
return ExecutionResult.NOTHING_TO_DO;
}
Aggregations