Search in sources :

Example 16 with ProxyRepositoryFactory

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;
}
Also used : ElementParameterType(org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType) ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory)

Example 17 with ProxyRepositoryFactory

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);
}
Also used : IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory)

Example 18 with ProxyRepositoryFactory

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;
}
Also used : Project(org.talend.core.model.general.Project) BusinessException(org.talend.commons.exception.BusinessException) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory) PersistenceException(org.talend.commons.exception.PersistenceException)

Example 19 with ProxyRepositoryFactory

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;
}
Also used : ITalendSynchronizer(org.talend.designer.codegen.ITalendSynchronizer) IFile(org.eclipse.core.resources.IFile) RepositoryEditorInput(org.talend.core.repository.ui.editor.RepositoryEditorInput) BusinessProcessItem(org.talend.core.model.properties.BusinessProcessItem) ISQLPatternSynchronizer(org.talend.designer.codegen.ISQLPatternSynchronizer) RoutineItem(org.talend.core.model.properties.RoutineItem) SQLPatternItem(org.talend.core.model.properties.SQLPatternItem) RoutineEditorInput(org.talend.repository.ui.actions.routines.RoutineEditorInput) ProcessEditorInput(org.talend.designer.core.ui.editor.ProcessEditorInput) ICodeGeneratorService(org.talend.designer.codegen.ICodeGeneratorService) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) BusinessProcessItem(org.talend.core.model.properties.BusinessProcessItem) ProcessItem(org.talend.core.model.properties.ProcessItem)

Example 20 with ProxyRepositoryFactory

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;
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) ProxyRepositoryFactory(org.talend.core.repository.model.ProxyRepositoryFactory) ArrayList(java.util.ArrayList) PersistenceException(org.talend.commons.exception.PersistenceException) IComponentConversion(org.talend.core.model.components.conversions.IComponentConversion)

Aggregations

ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)74 PersistenceException (org.talend.commons.exception.PersistenceException)32 ElementParameterType (org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)25 ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)22 NodeType (org.talend.designer.core.model.utils.emf.talendfile.NodeType)18 EList (org.eclipse.emf.common.util.EList)15 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)13 ConnectionType (org.talend.designer.core.model.utils.emf.talendfile.ConnectionType)11 Project (org.talend.core.model.general.Project)10 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)9 BusinessException (org.talend.commons.exception.BusinessException)8 ParametersType (org.talend.designer.core.model.utils.emf.talendfile.ParametersType)8 ArrayList (java.util.ArrayList)7 InvocationTargetException (java.lang.reflect.InvocationTargetException)6 Path (org.eclipse.core.runtime.Path)6 EConnectionType (org.talend.core.model.process.EConnectionType)6 ConnectionItem (org.talend.core.model.properties.ConnectionItem)6 List (java.util.List)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)5 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)5