Search in sources :

Example 6 with IMPORTType

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;
}
Also used : IMPORTSType(org.talend.designer.core.model.utils.emf.component.IMPORTSType) ArrayList(java.util.ArrayList) IMPORTType(org.talend.designer.core.model.utils.emf.component.IMPORTType)

Example 7 with IMPORTType

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);
}
Also used : ArrayList(java.util.ArrayList) IMPORTType(org.talend.designer.core.model.utils.emf.component.IMPORTType) ModuleNeeded(org.talend.core.model.general.ModuleNeeded) CoreException(org.eclipse.core.runtime.CoreException) SystemException(org.talend.commons.exception.SystemException) IOException(java.io.IOException) PersistenceException(org.talend.commons.exception.PersistenceException)

Example 8 with IMPORTType

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);
}
Also used : IMPORTSType(org.talend.designer.core.model.utils.emf.component.IMPORTSType) IMPORTType(org.talend.designer.core.model.utils.emf.component.IMPORTType)

Example 9 with IMPORTType

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);
    }
}
Also used : RepositoryContext(org.talend.core.context.RepositoryContext) Context(org.talend.core.context.Context) RepositoryContext(org.talend.core.context.RepositoryContext) RoutineItem(org.talend.core.model.properties.RoutineItem) CoreException(org.eclipse.core.runtime.CoreException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) MalformedURLException(java.net.MalformedURLException) PersistenceException(org.talend.commons.exception.PersistenceException) ReferenceFileItem(org.talend.core.model.properties.ReferenceFileItem) JobletProcessItem(org.talend.core.model.properties.JobletProcessItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) SQLPatternItem(org.talend.core.model.properties.SQLPatternItem) ProcessItem(org.talend.core.model.properties.ProcessItem) ContextItem(org.talend.core.model.properties.ContextItem) SnippetItem(org.talend.core.model.properties.SnippetItem) Item(org.talend.core.model.properties.Item) LinkDocumentationItem(org.talend.core.model.properties.LinkDocumentationItem) FolderItem(org.talend.core.model.properties.FolderItem) RoutineItem(org.talend.core.model.properties.RoutineItem) TDQItem(org.talend.core.model.properties.TDQItem) BusinessProcessItem(org.talend.core.model.properties.BusinessProcessItem) FileItem(org.talend.core.model.properties.FileItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IMPORTType(org.talend.designer.core.model.utils.emf.component.IMPORTType) ArrayList(java.util.ArrayList) List(java.util.List) EList(org.eclipse.emf.common.util.EList) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 10 with IMPORTType

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);
}
Also used : RoutineItem(org.talend.core.model.properties.RoutineItem) Item(org.talend.core.model.properties.Item) ImportItem(org.talend.repository.items.importexport.handlers.model.ImportItem) ProviderManager(org.talend.repository.items.importexport.ui.managers.ProviderManager) IMPORTType(org.talend.designer.core.model.utils.emf.component.IMPORTType) RoutineItem(org.talend.core.model.properties.RoutineItem) List(java.util.List) ZipFileManager(org.talend.repository.items.importexport.ui.managers.ZipFileManager) HashSet(java.util.HashSet)

Aggregations

IMPORTType (org.talend.designer.core.model.utils.emf.component.IMPORTType)11 ArrayList (java.util.ArrayList)7 RoutineItem (org.talend.core.model.properties.RoutineItem)7 PersistenceException (org.talend.commons.exception.PersistenceException)4 Item (org.talend.core.model.properties.Item)4 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)4 CoreException (org.eclipse.core.runtime.CoreException)3 ProcessItem (org.talend.core.model.properties.ProcessItem)3 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 HashSet (java.util.HashSet)2 List (java.util.List)2 EList (org.eclipse.emf.common.util.EList)2 ModuleNeeded (org.talend.core.model.general.ModuleNeeded)2 IMPORTSType (org.talend.designer.core.model.utils.emf.component.IMPORTSType)2 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URI (java.net.URI)1 URL (java.net.URL)1