Search in sources :

Example 1 with RevisionInfo

use of org.talend.designer.components.exchange.model.RevisionInfo in project tdi-studio-se by Talend.

the class ComponentSearcher method getImportComponentExtensions.

public static List<ComponentExtension> getImportComponentExtensions(String version, ECodeLanguage language, String type) {
    List<ComponentExtension> extensions = new ArrayList<ComponentExtension>();
    try {
        List<RevisionInfo> revisions = ExchangeUtils.getRevisionList(version, getLanguageId(language), type);
        Map<String, ComponentExtension> extensionsMap = new HashMap<String, ComponentExtension>();
        for (RevisionInfo revision : revisions) {
            ComponentExtension extension = extensionsMap.get(revision.getExtension_id());
            if (extension == null) {
                extension = ExchangeFactory.eINSTANCE.createComponentExtension();
                extension.setIdExtension(revision.getExtension_id() + "");
                extension.setLabel(revision.getExtension_name());
                extension.setAuthor(revision.getAuthor_name());
                extension.setLanguage(Language.get(getLanguageId(language)));
                extension.setDescription(revision.getExtension_description());
                extension.setLinkDownload(revision.getDownload_url());
                extension.setFilename(revision.getFilename());
                extension.setVersionExtension(revision.getRevision_name());
                extensionsMap.put(revision.getExtension_id() + "", extension);
                extensions.add(extension);
            }
        }
    } catch (Exception e) {
        ExceptionHandler.process(e);
    }
    return extensions;
}
Also used : RevisionInfo(org.talend.designer.components.exchange.model.RevisionInfo) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ComponentExtension(org.talend.designer.components.exchange.model.ComponentExtension)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ComponentExtension (org.talend.designer.components.exchange.model.ComponentExtension)1 RevisionInfo (org.talend.designer.components.exchange.model.RevisionInfo)1