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