use of org.talend.repository.model.migration.ChangeProjectTechinicalNameMigrationTask 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;
//
}
Aggregations