Search in sources :

Example 36 with PersistenceException

use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.

the class NewSqlpatternWizard method performFinish.

/**
     * @see org.eclipse.jface.wizard.Wizard#performFinish()
     */
@Override
public boolean performFinish() {
    IProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
    try {
        property.setId(repositoryFactory.getNextId());
        repositoryFactory.create(sqlpatternItem, mainPage.getDestinationPath());
    } catch (PersistenceException e) {
        //$NON-NLS-1$//$NON-NLS-2$
        MessageDialog.openError(getShell(), Messages.getString(Messages.getString("NewSqlpatternWizard.failureTitle")), "");
        ExceptionHandler.process(e);
    }
    return sqlpatternItem != null;
}
Also used : PersistenceException(org.talend.commons.exception.PersistenceException) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 37 with PersistenceException

use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.

the class AutoConvertTypesUtils method getTypeFile.

public static File getTypeFile() {
    try {
        IProject project = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject());
        IPath settingPath = new ProjectScope(project).getLocation();
        //$NON-NLS-1$//$NON-NLS-2$;
        return new File(settingPath + "\\" + AUTO_CONVERSION_TYPES_RESOURCES + ".xml");
    } catch (PersistenceException e) {
        e.printStackTrace();
    }
    return null;
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IPath(org.eclipse.core.runtime.IPath) PersistenceException(org.talend.commons.exception.PersistenceException) IFile(org.eclipse.core.resources.IFile) File(java.io.File) IProject(org.eclipse.core.resources.IProject)

Example 38 with PersistenceException

use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.

the class TalendWizardProjectsImportPage method createProjects.

@SuppressWarnings("restriction")
@Override
public boolean createProjects() {
    // TDI-19269
    final boolean created = super.createProjects();
    //
    final Object[] selected = getProjectsList().getCheckedElements();
    XmiResourceManager xmiManager = new XmiResourceManager();
    try {
        for (Object element : selected) {
            final ProjectRecord record = (ProjectRecord) element;
            String projectName = record.getProjectName();
            final IWorkspace workspace = ResourcesPlugin.getWorkspace();
            final IProject project = workspace.getRoot().getProject(projectName);
            try {
                final Project loadProject = xmiManager.loadProject(project);
                loadProject.setLocal(true);
                loadProject.setId(0);
                loadProject.setUrl(null);
                loadProject.setCreationDate(null);
                //loadProject.setDescription(""); //$NON-NLS-1$
                loadProject.setType(null);
                xmiManager.saveResource(loadProject.eResource());
                // FIXME TDI-22786, migrate the project name.
                if (ProjectManager.enableSpecialTechnicalProjectName()) {
                    ChangeProjectTechinicalNameMigrationTask migrationTask = new ChangeProjectTechinicalNameMigrationTask();
                    migrationTask.migrateTalendProject(project, loadProject, xmiManager);
                }
            } catch (PersistenceException e) {
            //
            }
        }
    } finally {
        xmiManager.unloadResources();
    }
    return created;
//
}
Also used : Project(org.talend.core.model.properties.Project) IProject(org.eclipse.core.resources.IProject) ChangeProjectTechinicalNameMigrationTask(org.talend.repository.model.migration.ChangeProjectTechinicalNameMigrationTask) IWorkspace(org.eclipse.core.resources.IWorkspace) PersistenceException(org.talend.commons.exception.PersistenceException) XmiResourceManager(org.talend.core.repository.utils.XmiResourceManager) IProject(org.eclipse.core.resources.IProject)

Example 39 with PersistenceException

use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.

the class NewRoutineWizard method performFinish.

/**
     * @see org.eclipse.jface.wizard.Wizard#performFinish()
     */
@Override
public boolean performFinish() {
    IProxyRepositoryFactory repositoryFactory = ProxyRepositoryFactory.getInstance();
    try {
        updateRoutineContent();
        property.setId(repositoryFactory.getNextId());
        //changed by hqzhang for TDI-19527, label=displayName
        property.setLabel(property.getDisplayName());
        repositoryFactory.create(routineItem, mainPage.getDestinationPath());
    } catch (PersistenceException e) {
        //$NON-NLS-1$ //$NON-NLS-2$
        MessageDialog.openError(getShell(), Messages.getString("NewProcessWizard.failureTitle"), "");
        ExceptionHandler.process(e);
    }
    return routineItem != null;
}
Also used : PersistenceException(org.talend.commons.exception.PersistenceException) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 40 with PersistenceException

use of org.talend.commons.exception.PersistenceException in project tdi-studio-se by Talend.

the class JavaJobScriptsExportWSWizardPage method restoreWidgetValuesForWS.

protected void restoreWidgetValuesForWS() {
    IDialogSettings settings = getDialogSettings();
    if (settings != null) {
        String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
        if (directoryNames != null && directoryNames.length > 0) {
            String fileName = getDefaultFileNameWithType();
            // destination
            for (int i = 0; i < directoryNames.length; i++) {
                if (directoryNames[i].toLowerCase().endsWith(FileConstants.WAR_FILE_SUFFIX) || directoryNames[i].toLowerCase().endsWith(FileConstants.ZIP_FILE_SUFFIX)) {
                    //$NON-NLS-1$
                    directoryNames[i] = (directoryNames[i].charAt(0) + "").toUpperCase() + directoryNames[i].substring(1);
                    addDestinationItem(directoryNames[i]);
                }
            }
            File dest = new File(new File(directoryNames[0]).getParentFile(), fileName);
            setDestinationValue(dest.getAbsolutePath());
        } else {
            setDefaultDestination();
        }
        webXMLButton.setSelection(settings.getBoolean(STORE_WEBXML_ID));
        configFileButton.setSelection(settings.getBoolean(STORE_CONFIGFILE_ID));
        axisLibButton.setSelection(settings.getBoolean(STORE_AXISLIB_ID));
        wsddButton.setSelection(settings.getBoolean(STORE_WSDD_ID));
        wsdlButton.setSelection(settings.getBoolean(STORE_WSDL_ID));
        jobScriptButton.setSelection(settings.getBoolean(STORE_SOURCE_ID));
        contextButton.setSelection(settings.getBoolean(STORE_CONTEXT_ID));
        applyToChildrenButton.setSelection(settings.getBoolean(APPLY_TO_CHILDREN_ID));
        chkButton.setSelection(settings.getBoolean(EXTRACT_ZIP_FILE));
        // TDI-26294:should use getVisible here since the isVisible need the parent's isVisible()
        if (chkButton.getVisible()) {
            zipOption = String.valueOf(chkButton.getSelection());
        } else {
            //$NON-NLS-1$
            zipOption = "false";
        }
    }
    if (getProcessItem() != null && contextCombo != null) {
        try {
            setProcessItem((ProcessItem) ProxyRepositoryFactory.getInstance().getUptodateProperty(getProcessItem().getProperty()).getItem());
        } catch (PersistenceException e) {
            e.printStackTrace();
        }
        List<String> contextNames = ExportJobUtil.getJobContexts(getProcessItem());
        contextCombo.setItems(contextNames.toArray(new String[contextNames.size()]));
        if (contextNames.size() > 0) {
            contextCombo.select(0);
        }
    }
    if (log4jLevelCombo != null) {
        log4jLevelCombo.setItems(Log4jPrefsSettingManager.getLevel());
        if (Log4jPrefsSettingManager.getLevel().length > 0) {
            log4jLevelCombo.select(2);
        }
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) PersistenceException(org.talend.commons.exception.PersistenceException) File(java.io.File)

Aggregations

PersistenceException (org.talend.commons.exception.PersistenceException)571 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)202 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)151 Property (org.talend.core.model.properties.Property)106 ProcessType (org.talend.designer.core.model.utils.emf.talendfile.ProcessType)106 NodeType (org.talend.designer.core.model.utils.emf.talendfile.NodeType)91 Item (org.talend.core.model.properties.Item)90 ElementParameterType (org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType)85 ArrayList (java.util.ArrayList)80 IComponentConversion (org.talend.core.model.components.conversions.IComponentConversion)78 IComponentFilter (org.talend.core.model.components.filters.IComponentFilter)78 NameComponentFilter (org.talend.core.model.components.filters.NameComponentFilter)77 Project (org.talend.core.model.general.Project)68 ConnectionItem (org.talend.core.model.properties.ConnectionItem)61 ProcessItem (org.talend.core.model.properties.ProcessItem)60 IPath (org.eclipse.core.runtime.IPath)58 IProject (org.eclipse.core.resources.IProject)54 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)52 CoreException (org.eclipse.core.runtime.CoreException)50 Path (org.eclipse.core.runtime.Path)50