use of io.gravitee.management.model.ResourceEntity in project gravitee-management-rest-api by gravitee-io.
the class ResourceServiceImpl method convert.
private ResourceEntity convert(ResourcePlugin resourcePlugin, boolean withPlugin) {
ResourceEntity entity = new ResourceEntity();
entity.setId(resourcePlugin.id());
entity.setDescription(resourcePlugin.manifest().description());
entity.setName(resourcePlugin.manifest().name());
entity.setVersion(resourcePlugin.manifest().version());
if (withPlugin) {
// Plugin information
Plugin plugin = resourcePlugin;
PluginEntity pluginEntity = new PluginEntity();
pluginEntity.setPlugin(plugin.clazz());
pluginEntity.setPath(plugin.path().toString());
pluginEntity.setType(plugin.type().toString().toLowerCase());
pluginEntity.setDependencies(plugin.dependencies());
entity.setPlugin(pluginEntity);
}
return entity;
}
use of io.gravitee.management.model.ResourceEntity in project gravitee-management-rest-api by gravitee-io.
the class ResourceServiceImpl method findAll.
@Override
public Set<ResourceEntity> findAll() {
try {
LOGGER.debug("List all resources");
final Collection<ResourcePlugin> resourceDefinitions = resourcePluginManager.findAll();
return resourceDefinitions.stream().map(resourceDefinition -> convert(resourceDefinition, false)).collect(Collectors.toSet());
} catch (Exception ex) {
LOGGER.error("An error occurs while trying to list all resources", ex);
throw new TechnicalManagementException("An error occurs while trying to list all resources", ex);
}
}
Aggregations