use of org.talend.core.repository.model.ProxyRepositoryFactory in project tdi-studio-se by Talend.
the class EncryptPasswordInJobSettingsMigrationTask method execute.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.migration.AbstractItemMigrationTask#execute(org.talend.core.model.properties.Item)
*/
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
try {
boolean modified = false;
if (processType.getParameters() != null) {
for (Object oElemParam : processType.getParameters().getElementParameter()) {
ElementParameterType param = (ElementParameterType) oElemParam;
// variable name used for Stat&Logs
if ("PASS".equals(param.getName())) {
//$NON-NLS-1$
modified = encryptValueIfNeeded(param);
}
// variable name used for implicit context
if ("PASS_IMPLICIT_CONTEXT".equals(param.getName())) {
//$NON-NLS-1$
modified = encryptValueIfNeeded(param);
}
}
}
if (modified) {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
factory.save(item, true);
}
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
return ExecutionResult.SUCCESS_NO_ALERT;
}
use of org.talend.core.repository.model.ProxyRepositoryFactory in project tdi-studio-se by Talend.
the class LoginFirstTimeStartupActionPage method setRepositoryContextInContext.
protected void setRepositoryContextInContext() {
ProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
repositoryFactory.setRepositoryFactoryFromProvider(RepositoryFactoryProvider.getRepositoriyById(defaultConnectionBean.getRepositoryId()));
LoginHelper.setRepositoryContextInContext(defaultConnectionBean, LoginHelper.getUser(defaultConnectionBean), null, null);
}
use of org.talend.core.repository.model.ProxyRepositoryFactory in project tdi-studio-se by Talend.
the class LoginDialog method readProject.
private Project[] readProject() {
ProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
Project[] projects = null;
try {
projects = repositoryFactory.readProject();
} catch (PersistenceException e1) {
e1.printStackTrace();
} catch (BusinessException e1) {
e1.printStackTrace();
}
return projects;
}
use of org.talend.core.repository.model.ProxyRepositoryFactory in project tdi-studio-se by Talend.
the class OpenExistVersionProcessWizard method getEditorInput.
protected RepositoryEditorInput getEditorInput(final Item item, final boolean readonly, final IWorkbenchPage page) throws SystemException {
if (item instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) item;
return new ProcessEditorInput(processItem, true, false, readonly);
} else if (item instanceof BusinessProcessItem) {
BusinessProcessItem businessProcessItem = (BusinessProcessItem) item;
IFile file = CorePlugin.getDefault().getDiagramModelService().getDiagramFileAndUpdateResource(page, businessProcessItem);
return new RepositoryEditorInput(file, businessProcessItem);
} else if (item instanceof RoutineItem) {
final RoutineItem routineItem = (RoutineItem) item;
final ICodeGeneratorService codeGenService = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(ICodeGeneratorService.class);
ITalendSynchronizer routineSynchronizer = codeGenService.createRoutineSynchronizer();
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
String lastVersion = factory.getLastVersion(routineItem.getProperty().getId()).getVersion();
String curVersion = routineItem.getProperty().getVersion();
routineSynchronizer.syncRoutine(routineItem, true, true);
final IFile file;
if (curVersion != null && curVersion.equals(lastVersion)) {
file = routineSynchronizer.getFile(routineItem);
} else {
file = routineSynchronizer.getRoutinesFile(routineItem);
}
if (file != null) {
return new RoutineEditorInput(file, routineItem);
}
} else if (item instanceof SQLPatternItem) {
SQLPatternItem patternItem = (SQLPatternItem) item;
final ICodeGeneratorService codeGenService = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(ICodeGeneratorService.class);
ISQLPatternSynchronizer SQLPatternSynchronizer = codeGenService.getSQLPatternSynchronizer();
SQLPatternSynchronizer.syncSQLPattern(patternItem, true);
IFile file = SQLPatternSynchronizer.getSQLPatternFile(patternItem);
if (file != null) {
return new RepositoryEditorInput(file, patternItem);
}
}
return null;
}
use of org.talend.core.repository.model.ProxyRepositoryFactory in project tdi-studio-se by Talend.
the class ChangeSqlPatternValueMigrationTask method execute.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.migration.AbstractJobMigrationTask#executeOnProcess(org.talend.core.model.properties.ProcessItem)
*/
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
if (processType == null) {
return ExecutionResult.NOTHING_TO_DO;
}
List<IComponentConversion> list = new ArrayList<IComponentConversion>();
list.add(new PropertyConversion());
try {
ModifyComponentsAction.searchAndModify(item, processType, filter, list);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
if (modified) {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
try {
factory.save(item, new boolean[] { true });
return ExecutionResult.SUCCESS_NO_ALERT;
} catch (PersistenceException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
return ExecutionResult.NOTHING_TO_DO;
}
Aggregations