use of org.talend.designer.core.model.utils.emf.component.IMPORTType in project tdi-studio-se by Talend.
the class ImportModuleManager method getImportTypes.
public List<IMPORTType> getImportTypes(IMPORTSType importsType) {
List<IMPORTType> types = new ArrayList<IMPORTType>();
List<IMPORTType> importTypes = importsType.getIMPORT();
for (IMPORTType importType : importTypes) {
inheritParentProperties(importsType, importType);
types.add(importType);
}
List<IMPORTSType> importsTypes = importsType.getIMPORTS();
for (IMPORTSType imports : importsTypes) {
inheritParentProperties(importsType, imports);
types.addAll(getImportTypes(imports));
}
return types;
}
use of org.talend.designer.core.model.utils.emf.component.IMPORTType in project tdi-studio-se by Talend.
the class WSDL2JAVAController method addWsdlNeedLib.
// gcui:see bug 9733.
private void addWsdlNeedLib(RoutineItem routineItem) {
List<IMPORTType> wsdlNeedImport = new ArrayList<IMPORTType>();
IMPORTType type1 = ComponentFactory.eINSTANCE.createIMPORTType();
type1.setMODULE("axis.jar");
type1.setREQUIRED(true);
type1.setNAME(routineItem.getProperty().getLabel());
wsdlNeedImport.add(type1);
IMPORTType type2 = ComponentFactory.eINSTANCE.createIMPORTType();
type2.setMODULE("jaxrpc.jar");
type2.setREQUIRED(true);
type2.setNAME(routineItem.getProperty().getLabel());
wsdlNeedImport.add(type2);
routineItem.getImports().addAll(wsdlNeedImport);
try {
CorePlugin.getDefault().getProxyRepositoryFactory().save(routineItem);
} catch (Exception e) {
ExceptionHandler.process(e);
}
CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
CorePlugin.getDefault().getRunProcessService().updateLibraries(new HashSet<ModuleNeeded>(), null);
}
use of org.talend.designer.core.model.utils.emf.component.IMPORTType in project tdi-studio-se by Talend.
the class ImportModuleManagerTest method initTestImportsType.
private void initTestImportsType() {
testImportsType = ComponentFactory.eINSTANCE.createIMPORTSType();
IMPORTType importType1 = ComponentFactory.eINSTANCE.createIMPORTType();
//$NON-NLS-1$
importType1.setMODULE("test-jar1.jar");
//$NON-NLS-1$
importType1.setREQUIREDIF("x > 0");
testImportsType.getIMPORT().add(importType1);
IMPORTType importType2 = ComponentFactory.eINSTANCE.createIMPORTType();
//$NON-NLS-1$
importType2.setMODULE("test-jar2.jar");
//$NON-NLS-1$
importType2.setREQUIREDIF("y > 0");
testImportsType.getIMPORT().add(importType2);
IMPORTSType importsType = ComponentFactory.eINSTANCE.createIMPORTSType();
//$NON-NLS-1$
importsType.setREQUIREDIF("z > 0");
IMPORTType importType3 = ComponentFactory.eINSTANCE.createIMPORTType();
//$NON-NLS-1$
importType3.setMODULE("test-jar3.jar");
//$NON-NLS-1$
importType3.setREQUIREDIF("(x > y)");
importsType.getIMPORT().add(importType3);
testImportsType.getIMPORTS().add(importsType);
}
use of org.talend.designer.core.model.utils.emf.component.IMPORTType in project tdi-studio-se by Talend.
the class ImportItemUtil method applyMigrationTasks.
/**
* DOC ycbai Comment method "applyMigrationTasks".
*
* @param itemRecord
* @param monitor
*/
private void applyMigrationTasks(ItemRecord itemRecord, IProgressMonitor monitor) {
Context ctx = CorePlugin.getContext();
RepositoryContext repositoryContext = (RepositoryContext) ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
org.talend.core.model.general.Project project = repositoryContext.getProject();
ERepositoryObjectType repositoryType = itemRecord.getRepositoryType();
Item item = null;
try {
List<IRepositoryViewObject> allVersion = ProxyRepositoryFactory.getInstance().getAllVersion(ProjectManager.getInstance().getCurrentProject(), itemRecord.getItemId(), itemRecord.getImportPath(), repositoryType);
for (IRepositoryViewObject repositoryObject : allVersion) {
if (repositoryObject.getProperty().getVersion().equals(itemRecord.getItemVersion())) {
item = repositoryObject.getProperty().getItem();
}
}
if (item == null) {
return;
}
CorePlugin.getDefault().getMigrationToolService().executeMigrationTasksForImport(project, item, itemRecord.getMigrationTasksToApply(), monitor);
if (item instanceof RoutineItem) {
RoutineItem rItem = (RoutineItem) item;
Set<String> set = routineExtModulesMap.get(rItem.getProperty().getId());
if (set == null) {
set = new HashSet<String>();
routineExtModulesMap.put(rItem.getProperty().getId(), set);
}
for (IMPORTType type : (List<IMPORTType>) rItem.getImports()) {
set.add(type.getMODULE());
}
}
itemRecord.setExistingItemWithSameId(null);
itemRecord.clear();
itemRecord.setProperty(item.getProperty());
} catch (Exception e) {
logError(e);
}
}
use of org.talend.designer.core.model.utils.emf.component.IMPORTType in project tdi-studio-se by Talend.
the class RoutineImportHandler method afterImportingItems.
/*
* (non-Javadoc)
*
* @see org.talend.repository.items.importexport.handlers.imports.ImportRepTypeHandler#afterImportingItemRecords(org
* .eclipse.core.runtime.IProgressMonitor,
* org.talend.repository.items.importexport.ui.wizard.imports.managers.ResourcesManager,
* org.talend.repository.items.importexport.ui.wizard.imports.models.ItemRecord)
*/
@Override
public void afterImportingItems(IProgressMonitor monitor, ResourcesManager resManager, ImportItem selectedItemRecord) {
// deploy routines Jar
final Item item = selectedItemRecord.getItem();
if (validEClass(item) && item instanceof RoutineItem) {
RoutineItem rItem = (RoutineItem) item;
Set<String> extRoutines = new HashSet<String>();
for (IMPORTType type : (List<IMPORTType>) rItem.getImports()) {
extRoutines.add(type.getMODULE());
}
if (resManager instanceof ProviderManager || resManager instanceof ZipFileManager) {
deployJarToDestForArchive(resManager, extRoutines);
} else {
deployJarToDest(resManager, extRoutines);
}
}
super.afterImportingItems(monitor, resManager, selectedItemRecord);
}
Aggregations