use of org.talend.designer.core.model.utils.emf.talendfile.ParametersType in project tdi-studio-se by Talend.
the class MigrateOracleJobSettingsParameterMigrationTask method execute.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.migration.AbstractItemMigrationTask#execute(org.talend.core.model.properties.Item)
*/
@SuppressWarnings("unchecked")
@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 (param.getName().equals("DB_TYPE_IMPLICIT_CONTEXT") || param.getName().equals("DB_TYPE")) {
//$NON-NLS-1$ //$NON-NLS-2$
if (ORACLE_INPUT.equals(param.getValue())) {
param.setValue(ORACLE_INPUT + ORACLE_SID);
modified = true;
} else if (ORACLE_OUTPUT.equals(param.getValue())) {
param.setValue(ORACLE_OUTPUT + ORACLE_SID);
modified = true;
}
}
}
}
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;
}
use of org.talend.designer.core.model.utils.emf.talendfile.ParametersType in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method codeSync.
private void codeSync() {
IProcess2 process = getProcess();
if (!(process.getProperty().getItem() instanceof ProcessItem)) {
// shouldn't work for joblet
return;
}
if (jobletEditor == getEditor(oldPageIndex)) {
// added for routines code generated switch editor 0 to 3.
ProcessItem processItem = (ProcessItem) process.getProperty().getItem();
covertJobscriptOnPageChange();
ParametersType parameters = processItem.getProcess().getParameters();
if (parameters != null && parameters.getRoutinesParameter() != null && parameters.getRoutinesParameter().size() == 0) {
try {
List<RoutinesParameterType> dependenciesInPreference = RoutinesUtil.createDependenciesInPreference();
parameters.getRoutinesParameter().addAll(dependenciesInPreference);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
// if some code has been generated already, for the editor we should need only the main job, not the childs.
try {
boolean lastGeneratedWithStats = ProcessorUtilities.getLastGeneratedWithStats(process.getId());
boolean lastGeneratedWithTrace = ProcessorUtilities.getLastGeneratedWithTrace(process.getId());
if (processor.isCodeGenerated()) {
ProcessorUtilities.generateCode(process, process.getContextManager().getDefaultContext(), lastGeneratedWithStats, lastGeneratedWithTrace, true, ProcessorUtilities.GENERATE_MAIN_ONLY);
} else {
ProcessorUtilities.generateCode(process, process.getContextManager().getDefaultContext(), lastGeneratedWithStats, lastGeneratedWithTrace, true, ProcessorUtilities.GENERATE_WITH_FIRST_CHILD);
}
} catch (ProcessorException e) {
ExceptionHandler.process(e);
}
}
use of org.talend.designer.core.model.utils.emf.talendfile.ParametersType in project tdi-studio-se by Talend.
the class ProjectSettingManager method loadImplicitContextLoadPreferenceToProject.
/**
*
* Load ImplicitContextLoad Preference setting to Project only Load Once
*
* @param pro
*/
private static void loadImplicitContextLoadPreferenceToProject(Project pro) {
TalendFileFactory talendF = TalendFileFactory.eINSTANCE;
ImplicitContextSettings implicit = PropertiesFactory.eINSTANCE.createImplicitContextSettings();
pro.getEmfProject().setImplicitContextSettings(implicit);
implicit.setParameters(talendF.createParametersType());
ParametersType pType = implicit.getParameters();
IElement elem = pro.getInitialContextLoad();
if (elem == null) {
elem = new ImplicitContextLoadElement();
ProjectSettingManager.createImplicitContextLoadParameters((ImplicitContextLoadElement) elem);
pro.setInitialContextLoad(elem);
}
ElementParameter2ParameterType.saveElementParameters((Element) elem, pType);
}
use of org.talend.designer.core.model.utils.emf.talendfile.ParametersType in project tdi-studio-se by Talend.
the class ProjectSettingManager method reloadImplicitValuesFromProjectSettings.
public static void reloadImplicitValuesFromProjectSettings(ParametersType processType, Project pro) {
createImplicitContextLoadElement(pro);
ParametersType implicitType = pro.getEmfProject().getImplicitContextSettings().getParameters();
ElementParameter2ParameterType.loadElementParameters(processType, implicitType, EParameterName.IMPLICITCONTEXT_USE_PROJECT_SETTINGS);
}
use of org.talend.designer.core.model.utils.emf.talendfile.ParametersType in project tdi-studio-se by Talend.
the class ProjectSettingManager method saveImplicitValuesToProjectSettings.
public static void saveImplicitValuesToProjectSettings(Element process, Project pro) {
createImplicitContextLoadElement(pro);
ParametersType implicitType = pro.getEmfProject().getImplicitContextSettings().getParameters();
// load the project settings to process
ElementParameter2ParameterType.saveElementParameters(process, implicitType);
saveProject();
}
Aggregations