use of org.cytoscape.io.DataCategory in project cytoscape-impl by cytoscape.
the class BookmarkDataSourceBuilder method buildDataSource.
private void buildDataSource() {
final BookmarksUtil bookmarksUtil = serviceRegistrar.getService(BookmarksUtil.class);
final Bookmarks bookMarks = (Bookmarks) serviceRegistrar.getService(CyProperty.class, "(cyPropertyName=bookmarks)").getProperties();
final List<Category> categoryList = bookMarks.getCategory();
for (final Category category : categoryList) {
final DataCategory dataType = CONVERSION_MAP.get(category.getName());
if (dataType == null)
continue;
final List<DataSource> theDataSourceList = bookmarksUtil.getDataSourceList(category.getName(), categoryList);
if (theDataSourceList != null) {
for (final DataSource ds : theDataSourceList) {
final String location = ds.getHref();
final String name = ds.getName();
final String description = "From Bookmarks";
final String provider = "Example";
URL url = null;
try {
url = new URL(location);
} catch (MalformedURLException e) {
logger.warn("Bookmark file coniatin invalid URL: " + location);
continue;
}
final org.cytoscape.io.datasource.DataSource dataSource = new DefaultDataSource(name, provider, description, dataType, url);
datasourceSet.add(dataSource);
}
}
}
}
Aggregations