Search in sources :

Example 1 with RevisionInfo

use of org.talend.dataprofiler.ecos.model.RevisionInfo in project tdq-studio-se by Talend.

the class ComponentSearcher method getAvailableComponentExtensions.

/**
 * get Available Component Extensions depend on isOnFilter.
 *
 * @param version
 * @param categry
 * @param isOnFilter
 * @return
 */
public static List<IEcosComponent> getAvailableComponentExtensions(String version, IEcosCategory categry, boolean isOnFilter) {
    List<IEcosComponent> extensions = new ArrayList<IEcosComponent>();
    // when on filter, do not get component from internet
    if (isOnFilter) {
        return extensions;
    }
    try {
        List<RevisionInfo> revisions = EcosystemService.getRevisionList(categry.getId(), version);
        Map<String, IEcosComponent> extensionsMap = new HashMap<String, IEcosComponent>();
        for (RevisionInfo revision : revisions) {
            IEcosComponent extension = extensionsMap.get(revision.getExtenson_name());
            if (extension == null) {
                extension = new EcosComponent();
                extension.setName(revision.getExtenson_name());
                extension.setAuthor(revision.getAuthor_name());
                extension.setCategry(categry);
                extension.setDescription(revision.getExtension_description());
                extensionsMap.put(extension.getName(), extension);
                extensions.add(extension);
            }
            IRevision rev = convertRevision(revision);
            extension.getRevisions().add(rev);
            if (extension.getLatestRevision() == null || extension.getLatestRevision().getDate().before(rev.getDate())) {
                // assumes that the revision with latest release date is the newest one.
                extension.setLatestRevision(rev);
            }
        }
    } catch (Exception e) {
        log.error(e, e);
    }
    return extensions;
}
Also used : RevisionInfo(org.talend.dataprofiler.ecos.model.RevisionInfo) HashMap(java.util.HashMap) IRevision(org.talend.dataprofiler.ecos.model.IRevision) IEcosComponent(org.talend.dataprofiler.ecos.model.IEcosComponent) EcosComponent(org.talend.dataprofiler.ecos.model.impl.EcosComponent) IEcosComponent(org.talend.dataprofiler.ecos.model.IEcosComponent) ArrayList(java.util.ArrayList) ParseException(java.text.ParseException)

Aggregations

ParseException (java.text.ParseException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 IEcosComponent (org.talend.dataprofiler.ecos.model.IEcosComponent)1 IRevision (org.talend.dataprofiler.ecos.model.IRevision)1 RevisionInfo (org.talend.dataprofiler.ecos.model.RevisionInfo)1 EcosComponent (org.talend.dataprofiler.ecos.model.impl.EcosComponent)1