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;
}
Aggregations