Search in sources :

Example 1 with IRevision

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

the class ComponentSearcher method convertRevision.

/**
 * Convert the web service returned value to our model object.
 *
 * @param revision The message returned from web service method call.
 * @return
 * @throws ParseException
 */
private static IRevision convertRevision(RevisionInfo revision) throws ParseException {
    IRevision rev = new Revision();
    rev.setDate(formatter.parse(revision.getRevision_date()));
    rev.setName(revision.getRevision_name());
    rev.setUrl(revision.getDownload_url());
    rev.setDescription(revision.getRevision_description());
    rev.setId(revision.getRevision_id());
    rev.setFileName(revision.getFilename());
    return rev;
}
Also used : Revision(org.talend.dataprofiler.ecos.model.impl.Revision) IRevision(org.talend.dataprofiler.ecos.model.IRevision) IRevision(org.talend.dataprofiler.ecos.model.IRevision)

Example 2 with IRevision

use of org.talend.dataprofiler.ecos.model.IRevision 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

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