use of org.talend.repository.items.importexport.handlers.model.ImportItem in project tdi-studio-se by Talend.
the class BigDataEeImportTest method importEeDemo.
@Before
public void importEeDemo() throws Exception {
initDemo(BIG_DATA_EE_DEMO_PLUGIN_ID);
Assert.assertNotNull(currentDemo);
initTestPaths();
initTempPro();
eeResManager = DemoImportTestUtil.getResourceManager(currentDemo);
Assert.assertNotNull(eeResManager);
ImportExportHandlersManager importManager = new ImportExportHandlersManager();
List<ImportItem> projectRecords = importManager.populateImportingItems(eeResManager, true, new NullProgressMonitor());
Assert.assertTrue(projectRecords.size() > 0);
importManager.importItemRecords(new NullProgressMonitor(), eeResManager, projectRecords, true, projectRecords.toArray(new ImportItem[0]), null);
}
use of org.talend.repository.items.importexport.handlers.model.ImportItem in project tdi-studio-se by Talend.
the class BigdataCeImportTest method importCeDemo.
@Before
public void importCeDemo() throws Exception {
initDemo(BIG_DATA_CE_DEMO_PLUGIN_ID);
if (currentDemo == null) {
// maybe license problem, the demo plugin is not loaded.
return;
}
initTestPaths();
initTempPro();
Assert.assertNotNull(currentDemo);
ceResManager = DemoImportTestUtil.getResourceManager(currentDemo);
Assert.assertNotNull(ceResManager);
ImportExportHandlersManager importManager = new ImportExportHandlersManager();
List<ImportItem> projectRecords = importManager.populateImportingItems(ceResManager, true, new NullProgressMonitor());
Assert.assertTrue(projectRecords.size() > 0);
importManager.importItemRecords(new NullProgressMonitor(), ceResManager, projectRecords, true, projectRecords.toArray(new ImportItem[0]), null);
}
use of org.talend.repository.items.importexport.handlers.model.ImportItem in project tdi-studio-se by Talend.
the class BuildJobHandlerTest method setUp.
@Before
public void setUp() throws Exception {
// Fix the NPE for org.talend.designer.core.ui.editor.process.Process.createMainParameters(Process.java:401)
bridgeProject = ReponsitoryContextBridge.getProject();
ReponsitoryContextBridge.setProject(ProjectManager.getInstance().getCurrentProject().getEmfProject());
ImportExportHandlersManager importManager = new ImportExportHandlersManager();
// job with tdm and tdq component.
URL testJobURL = FileLocator.find(Platform.getBundle("org.talend.repository.test"), new Path("/resources/testBuildJob.zip"), null);
if (testJobURL != null) {
testJobURL = FileLocator.toFileURL(testJobURL);
}
File srcFile = new File(testJobURL.getFile());
FileResourcesUnityManager fileUnityManager = ResourcesManagerFactory.getInstance().createFileUnityManager(srcFile);
ResourcesManager resManager = fileUnityManager.doUnify();
List<ImportItem> projectRecords = importManager.populateImportingItems(resManager, true, new NullProgressMonitor());
assertTrue(projectRecords.size() > 0);
importManager.importItemRecords(new NullProgressMonitor(), resManager, projectRecords, true, projectRecords.toArray(new ImportItem[0]), null);
IRepositoryViewObject obj = ProxyRepositoryFactory.getInstance().getLastVersion("_bWyBUAYbEeapTZ0aKwL_YA");
Item item = obj.getProperty().getItem();
assertTrue(item instanceof ProcessItem);
processItem = (ProcessItem) item;
}
use of org.talend.repository.items.importexport.handlers.model.ImportItem in project tdi-studio-se by Talend.
the class ImportDemoProjectItemsPage method performFinish.
public boolean performFinish() {
List<DemoProjectBean> checkedElements = getCheckedElements();
final List<ResourcesManager> finalCheckManagers = getResourceManagers(checkedElements);
String warnMessage = populateExistItemRecords(finalCheckManagers);
if (!warnMessage.equals("")) {
MessageDialog dialog = new MessageDialog(getShell(), Messages.getString("ImportDemoProjectPage.overwrite"), null, warnMessage, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
dialog.open();
int result = dialog.getReturnCode();
if (result != MessageDialog.OK) {
return false;
}
}
ProgressDialog progressDialog = new ProgressDialog(getShell()) {
private IProgressMonitor monitorWrap;
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitorWrap = new EventLoopProgressMonitor(monitor);
try {
for (ResourcesManager resManager : finalCheckManagers) {
List<ImportItem> projectRecords = importManager.populateImportingItems(resManager, true, monitorWrap);
// clearOverWriteErrorMessages(projectRecords, overwrite);
importManager.importItemRecords(monitorWrap, resManager, projectRecords, true, projectRecords.toArray(new ImportItem[0]), null);
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
monitorWrap.done();
if (monitor.isCanceled()) {
MessageDialog.openInformation(getShell(), Messages.getString("ImportDemoProjectAction.messageDialogTitle.demoProjectCancel"), Messages.getString("ImportDemoProjectAction.messageDialogContent.demoProjectImportedIncompletely"));
return;
} else {
MessageDialog.openInformation(getShell(), //$NON-NLS-1$
Messages.getString("ImportDemoProjectAction.messageDialogTitle.demoProject"), //$NON-NLS-1$
Messages.getString("ImportDemoProjectAction.messageDialogContent.demoProjectImportedSuccessfully"));
}
}
};
try {
progressDialog.executeProcess();
} catch (InvocationTargetException e) {
MessageBoxExceptionHandler.process(e.getTargetException(), getShell());
} catch (InterruptedException e) {
// Nothing to do
}
return true;
}
use of org.talend.repository.items.importexport.handlers.model.ImportItem in project tdi-studio-se by Talend.
the class RoutineImportHandler method isValidSystemItem.
@Override
public boolean isValidSystemItem(ImportItem importItem) {
boolean valid = super.valid(importItem);
if (!valid) {
return false;
}
Item item = importItem.getItem();
if (isBuiltIn(item)) {
return true;
}
return false;
}
Aggregations