use of io.apiman.manager.api.beans.summary.PluginSummaryBean in project apiman by apiman.
the class EsMarshalling method unmarshallPluginSummary.
/**
* Unmarshals the given map source into a bean.
* @param map the search hit map
* @return the plugin summary
*/
public static PluginSummaryBean unmarshallPluginSummary(Map<String, Object> map) {
PluginSummaryBean bean = new PluginSummaryBean();
bean.setId(asLong(map.get("id")));
bean.setName(asString(map.get("name")));
if (map.containsKey("description")) {
bean.setDescription(asString(map.get("description")));
}
bean.setGroupId(asString(map.get("groupId")));
bean.setArtifactId(asString(map.get("artifactId")));
bean.setVersion(asString(map.get("version")));
if (map.containsKey("type")) {
bean.setType(asString(map.get("type")));
}
if (map.containsKey("classifier")) {
bean.setClassifier(asString(map.get("classifier")));
}
bean.setCreatedBy(asString(map.get("createdBy")));
bean.setCreatedOn(asDate(map.get("createdOn")));
postMarshall(bean);
return bean;
}
use of io.apiman.manager.api.beans.summary.PluginSummaryBean in project apiman by apiman.
the class EsStorage method listPlugins.
/**
* @see io.apiman.manager.api.core.IStorageQuery#listPlugins()
*/
@Override
@SuppressWarnings("nls")
public List<PluginSummaryBean> listPlugins() throws StorageException {
String[] fields = { "id", "artifactId", "groupId", "version", "classifier", "type", "name", "description", "createdBy", "createdOn" };
QueryBuilder query = QueryBuilders.boolQuery().filter(QueryBuilders.termQuery("deleted", false));
SearchSourceBuilder builder = new SearchSourceBuilder().fetchSource(fields, null).query(query).sort(new FieldSortBuilder("name.keyword").order(SortOrder.ASC)).size(200);
List<SearchHit> hits = listEntities(INDEX_MANAGER_POSTFIX_PLUGIN, builder);
List<PluginSummaryBean> rval = new ArrayList<>(hits.size());
for (SearchHit hit : hits) {
PluginSummaryBean bean = EsMarshalling.unmarshallPluginSummary(hit.getSourceAsMap());
rval.add(bean);
}
return rval;
}
use of io.apiman.manager.api.beans.summary.PluginSummaryBean in project apiman by apiman.
the class PluginResourceImpl method getAvailablePlugins.
/**
* @see IPluginResource#getAvailablePlugins()
*/
@Override
public List<PluginSummaryBean> getAvailablePlugins() throws NotAuthorizedException {
securityContext.checkAdminPermissions();
List<PluginSummaryBean> rval = new ArrayList<>();
Set<URI> registries = config.getPluginRegistries();
for (URI registryUrl : registries) {
PluginRegistryBean registry = loadRegistry(registryUrl);
if (registry == null) {
// $NON-NLS-1$
LOGGER.warn("Plugin registry failed to load: {0}", registryUrl);
} else {
rval.addAll(registry.getPlugins());
}
}
// Sort before returning
rval.sort((o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName()));
return rval;
}
Aggregations