springdoc-openapi-ui #7

Merged
michele.artini merged 17 commits from springdoc-openapi-ui into master 2022-09-08 10:40:34 +02:00
70 changed files with 600 additions and 587 deletions
Showing only changes of commit 834c21ffc8 - Show all commits

View File

@ -6,11 +6,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication @SpringBootApplication
@EnableSwagger2 @EnableSwagger2

View File

@ -1,14 +1,19 @@
package eu.dnetlib.broker; package eu.dnetlib.broker;
import java.util.ArrayList;
import java.util.List;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import eu.dnetlib.common.app.AbstractDnetApp; import eu.dnetlib.common.app.AbstractDnetApp;
import springfox.documentation.builders.ApiInfoBuilder; import io.swagger.v3.oas.models.ExternalDocumentation;
import springfox.documentation.builders.RequestHandlerSelectors; import io.swagger.v3.oas.models.OpenAPI;
import springfox.documentation.service.ApiInfo; import io.swagger.v3.oas.models.info.Info;
import springfox.documentation.service.Tag; import io.swagger.v3.oas.models.info.License;
import springfox.documentation.spring.web.plugins.Docket; import io.swagger.v3.oas.models.tags.Tag;
@SpringBootApplication @SpringBootApplication
public class LiteratureBrokerServiceApplication extends AbstractDnetApp { public class LiteratureBrokerServiceApplication extends AbstractDnetApp {
@ -24,22 +29,30 @@ public class LiteratureBrokerServiceApplication extends AbstractDnetApp {
SpringApplication.run(LiteratureBrokerServiceApplication.class, args); SpringApplication.run(LiteratureBrokerServiceApplication.class, args);
} }
@Override @Bean
protected void configSwagger(final Docket docket) { public GroupedOpenApi publicApi() {
docket.select() return GroupedOpenApi.builder()
.apis(RequestHandlerSelectors.any()) .group("Broker APIs")
.paths(p -> p.startsWith("/api/")) .pathsToMatch("/api/**")
.build() .build();
.tags(new Tag(TAG_EVENTS, "Events management"), new Tag(TAG_SUBSCRIPTIONS, "Subscriptions management"), new Tag(TAG_NOTIFICATIONS, }
"Notifications management"), new Tag(TAG_TOPIC_TYPES, "Topic types management"), new Tag(TAG_OPENAIRE, "OpenAIRE use case"))
.apiInfo(new ApiInfoBuilder()
.title("Literature Broker Service")
.description("APIs documentation")
.version("1.1")
.contact(ApiInfo.DEFAULT_CONTACT)
.license("Apache 2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0")
.build());
@Override
protected void configSwagger(final OpenAPI openApi) {
final List<Tag> tags = new ArrayList<>();
tags.add(new Tag().name(TAG_EVENTS).description("Events management"));
tags.add(new Tag().name(TAG_SUBSCRIPTIONS).description("Subscriptions management"));
tags.add(new Tag().name(TAG_NOTIFICATIONS).description("Notifications management"));
tags.add(new Tag().name(TAG_TOPIC_TYPES).description("Topic types management"));
tags.add(new Tag().name(TAG_OPENAIRE).description("OpenAIRE use case"));
openApi.info(new Info().title("Literature Broker Service")
.description("APIs documentation")
.version("1.1")
.license(new License().name("Apache 2.0").url("http://www.apache.org/licenses/LICENSE-2.0")))
.externalDocs(new ExternalDocumentation()
.description("SpringShop Wiki Documentation")
.url("https://springshop.wiki.github.org/docs"))
.tags(tags);
} }
} }

View File

@ -16,10 +16,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
import eu.dnetlib.broker.common.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.broker.common.elasticsearch.Notification; import eu.dnetlib.broker.common.elasticsearch.Notification;
import eu.dnetlib.broker.common.properties.ElasticSearchProperties; import eu.dnetlib.broker.common.properties.ElasticSearchProperties;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration @Configuration
@EnableSwagger2
@EnableCaching @EnableCaching
@EnableScheduling @EnableScheduling
@EnableTransactionManagement @EnableTransactionManagement

View File

@ -31,12 +31,12 @@ import eu.dnetlib.broker.common.elasticsearch.EventStatsManager.BrowseEntry;
import eu.dnetlib.broker.common.subscriptions.Subscription; import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository; import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.common.controller.AbstractDnetController;
import io.swagger.annotations.Api; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.tags.Tag;
@RestController @RestController
@RequestMapping("/api/events") @RequestMapping("/api/events")
@Api(tags = LiteratureBrokerServiceApplication.TAG_EVENTS) @Tag(name = LiteratureBrokerServiceApplication.TAG_EVENTS)
public class EventsController extends AbstractDnetController { public class EventsController extends AbstractDnetController {
private static final Log log = LogFactory.getLog(AbstractDnetController.class); private static final Log log = LogFactory.getLog(AbstractDnetController.class);
@ -50,25 +50,25 @@ public class EventsController extends AbstractDnetController {
@Autowired @Autowired
private EventStatsManager eventStatsManager; private EventStatsManager eventStatsManager;
@ApiOperation("Return an event by ID") @Operation(summary = "Return an event by ID")
@GetMapping("/{id}") @GetMapping("/{id}")
public Event getEvent(@PathVariable final String id) { public Event getEvent(@PathVariable final String id) {
return eventRepository.findById(id).get(); return eventRepository.findById(id).get();
} }
@ApiOperation("Delete an event by ID") @Operation(summary = "Delete an event by ID")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public void deleteEvent(@PathVariable final String id) { public void deleteEvent(@PathVariable final String id) {
eventRepository.deleteById(id); eventRepository.deleteById(id);
} }
@ApiOperation("Save an event by ID") @Operation(summary = "Save an event by ID")
@PostMapping("/{id}") @PostMapping("/{id}")
public Event saveEvent(@RequestBody final Event event) { public Event saveEvent(@RequestBody final Event event) {
return eventRepository.save(event); return eventRepository.save(event);
} }
@ApiOperation("Return a page of events") @Operation(summary = "Return a page of events")
@GetMapping("/list/{page}/{pageSize}") @GetMapping("/list/{page}/{pageSize}")
public List<Event> events( public List<Event> events(
@PathVariable final int page, @PathVariable final int page,
@ -76,7 +76,7 @@ public class EventsController extends AbstractDnetController {
return Lists.newArrayList(eventRepository.findAll(PageRequest.of(page, pageSize))); return Lists.newArrayList(eventRepository.findAll(PageRequest.of(page, pageSize)));
} }
@ApiOperation("Return a page of events by topic") @Operation(summary = "Return a page of events by topic")
@GetMapping("/byTopic/{page}/{pageSize}") @GetMapping("/byTopic/{page}/{pageSize}")
public List<Event> eventsByTopic( public List<Event> eventsByTopic(
@PathVariable final int page, @PathVariable final int page,
@ -85,7 +85,7 @@ public class EventsController extends AbstractDnetController {
return Lists.newArrayList(eventRepository.findByTopic(topic, PageRequest.of(page, pageSize))); return Lists.newArrayList(eventRepository.findByTopic(topic, PageRequest.of(page, pageSize)));
} }
@ApiOperation("Delete all the events") @Operation(summary = "Delete all the events")
@DeleteMapping("/all") @DeleteMapping("/all")
public Map<String, Object> clearEvents() { public Map<String, Object> clearEvents() {
eventRepository.deleteAll(); eventRepository.deleteAll();
@ -94,13 +94,13 @@ public class EventsController extends AbstractDnetController {
return res; return res;
} }
@ApiOperation("Delete the expired events") @Operation(summary = "Delete the expired events")
@DeleteMapping("/expired") @DeleteMapping("/expired")
public Map<String, Object> deleteExpiredEvents() { public Map<String, Object> deleteExpiredEvents() {
return deleteEventsByExpiryDate(0, new Date().getTime()); return deleteEventsByExpiryDate(0, new Date().getTime());
} }
@ApiOperation("Delete the events with the creationDate in a range") @Operation(summary = "Delete the events with the creationDate in a range")
@DeleteMapping("/byCreationDate/{from}/{to}") @DeleteMapping("/byCreationDate/{from}/{to}")
public Map<String, Long> deleteEventsByCreationDate(@PathVariable final long from, @PathVariable final long to) { public Map<String, Long> deleteEventsByCreationDate(@PathVariable final long from, @PathVariable final long to) {
final Map<String, Long> res = new HashMap<>(); final Map<String, Long> res = new HashMap<>();
@ -113,7 +113,7 @@ public class EventsController extends AbstractDnetController {
return res; return res;
} }
@ApiOperation("Delete the events with the expiryDate in a range") @Operation(summary = "Delete the events with the expiryDate in a range")
@DeleteMapping("/byExpiryDate/{from}/{to}") @DeleteMapping("/byExpiryDate/{from}/{to}")
public Map<String, Object> deleteEventsByExpiryDate(@PathVariable final long from, @PathVariable final long to) { public Map<String, Object> deleteEventsByExpiryDate(@PathVariable final long from, @PathVariable final long to) {
new Thread(() -> { new Thread(() -> {
@ -128,13 +128,13 @@ public class EventsController extends AbstractDnetController {
return res; return res;
} }
@ApiOperation("Return the topics of the indexed events (all)") @Operation(summary = "Return the topics of the indexed events (all)")
@GetMapping("/topics/all") @GetMapping("/topics/all")
public List<BrowseEntry> browseTopics() { public List<BrowseEntry> browseTopics() {
return eventStatsManager.browseTopics(); return eventStatsManager.browseTopics();
} }
@ApiOperation("Return the topics of the indexed events (only with subscriptions)") @Operation(summary = "Return the topics of the indexed events (only with subscriptions)")
@GetMapping("/topics/withSubscriptions") @GetMapping("/topics/withSubscriptions")
public List<BrowseEntry> browseTopicsWithSubscriptions() { public List<BrowseEntry> browseTopicsWithSubscriptions() {

View File

@ -14,16 +14,15 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import eu.dnetlib.broker.LiteratureBrokerServiceApplication;
import eu.dnetlib.broker.common.elasticsearch.Notification; import eu.dnetlib.broker.common.elasticsearch.Notification;
import eu.dnetlib.broker.common.elasticsearch.NotificationRepository; import eu.dnetlib.broker.common.elasticsearch.NotificationRepository;
import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.common.controller.AbstractDnetController;
import io.swagger.annotations.Api; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.tags.Tag;
@RestController @RestController
@RequestMapping("/api/notifications") @RequestMapping("/api/notifications")
@Api(tags = LiteratureBrokerServiceApplication.TAG_NOTIFICATIONS) @Tag(name = "LiteratureBrokerServiceApplication.TAG_NOTIFICATIONS")
public class NotificationsController extends AbstractDnetController { public class NotificationsController extends AbstractDnetController {
private static final Log log = LogFactory.getLog(NotificationsController.class); private static final Log log = LogFactory.getLog(NotificationsController.class);
@ -31,31 +30,31 @@ public class NotificationsController extends AbstractDnetController {
@Autowired @Autowired
private NotificationRepository notificationRepository; private NotificationRepository notificationRepository;
@ApiOperation("Return a notification by ID") @Operation(summary = "Return a notification by ID")
@GetMapping("/{id}") @GetMapping("/{id}")
public Notification getNotification(@PathVariable final String id) { public Notification getNotification(@PathVariable final String id) {
return notificationRepository.findById(id).get(); return notificationRepository.findById(id).get();
} }
@ApiOperation("Delete a notification by ID") @Operation(summary = "Delete a notification by ID")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public void deleteNotification(@PathVariable final String id) { public void deleteNotification(@PathVariable final String id) {
notificationRepository.deleteById(id); notificationRepository.deleteById(id);
} }
@ApiOperation("Save a notification by ID") @Operation(summary = "Save a notification by ID")
@PostMapping("/{id}") @PostMapping("/{id}")
public Notification saveNotification(@RequestBody final Notification notification) { public Notification saveNotification(@RequestBody final Notification notification) {
return notificationRepository.save(notification); return notificationRepository.save(notification);
} }
@ApiOperation("Delete all notifications") @Operation(summary = "Delete all notifications")
@DeleteMapping("") @DeleteMapping("")
public void deleteAllNotifications() { public void deleteAllNotifications() {
notificationRepository.deleteAll(); notificationRepository.deleteAll();
} }
@ApiOperation("Delete the notifications with the date in a range") @Operation(summary = "Delete the notifications with the date in a range")
@DeleteMapping("/byDate/{from}/{to}") @DeleteMapping("/byDate/{from}/{to}")
public Map<String, Object> deleteNotificationsByDate(@PathVariable final long from, @PathVariable final long to) { public Map<String, Object> deleteNotificationsByDate(@PathVariable final long from, @PathVariable final long to) {
new Thread(() -> { new Thread(() -> {

View File

@ -16,13 +16,13 @@ import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository; import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.broker.matchers.SubscriptionEventMatcher; import eu.dnetlib.broker.matchers.SubscriptionEventMatcher;
import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.common.controller.AbstractDnetController;
import io.swagger.annotations.Api; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.tags.Tag;
@Profile("!openaire") @Profile("!openaire")
@RestController @RestController
@RequestMapping("/api/matching") @RequestMapping("/api/matching")
@Api(tags = LiteratureBrokerServiceApplication.TAG_MATCHING) @Tag(name = LiteratureBrokerServiceApplication.TAG_MATCHING)
public class StartMatchingController extends AbstractDnetController { public class StartMatchingController extends AbstractDnetController {
@Autowired @Autowired
@ -31,7 +31,7 @@ public class StartMatchingController extends AbstractDnetController {
@Autowired(required = false) @Autowired(required = false)
private SubscriptionEventMatcher subscriptionEventMatcher; private SubscriptionEventMatcher subscriptionEventMatcher;
@ApiOperation("Launch the thread that produces new notifications") @Operation(summary = "Launch the thread that produces new notifications")
@GetMapping("/start") @GetMapping("/start")
public List<String> startMatching() { public List<String> startMatching() {
if (subscriptionEventMatcher != null) { if (subscriptionEventMatcher != null) {
@ -42,7 +42,7 @@ public class StartMatchingController extends AbstractDnetController {
} }
} }
@ApiOperation("Launch the thread that produces new notifications by subscriptuion id") @Operation(summary = "Launch the thread that produces new notifications by subscriptuion id")
@GetMapping("/start/{subscriptionId}") @GetMapping("/start/{subscriptionId}")
public List<String> startMatching(@PathVariable final String subscriptionId) { public List<String> startMatching(@PathVariable final String subscriptionId) {
final Optional<Subscription> s = subscriptionRepo.findById(subscriptionId); final Optional<Subscription> s = subscriptionRepo.findById(subscriptionId);

View File

@ -29,12 +29,12 @@ import eu.dnetlib.broker.common.subscriptions.NotificationMode;
import eu.dnetlib.broker.common.subscriptions.Subscription; import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository; import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.common.controller.AbstractDnetController;
import io.swagger.annotations.Api; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.tags.Tag;
@RestController @RestController
@RequestMapping("/api/subscriptions") @RequestMapping("/api/subscriptions")
@Api(tags = LiteratureBrokerServiceApplication.TAG_SUBSCRIPTIONS) @Tag(name = LiteratureBrokerServiceApplication.TAG_SUBSCRIPTIONS)
public class SubscriptionsController extends AbstractDnetController { public class SubscriptionsController extends AbstractDnetController {
@Autowired @Autowired
@ -53,26 +53,26 @@ public class SubscriptionsController extends AbstractDnetController {
} }
}; };
@ApiOperation("Return the list of subscriptions") @Operation(summary = "Return the list of subscriptions")
@GetMapping("") @GetMapping("")
public Iterable<Subscription> listSubscriptions() { public Iterable<Subscription> listSubscriptions() {
return subscriptionRepo.findAll(); return subscriptionRepo.findAll();
} }
@ApiOperation("Return a subscription by ID") @Operation(summary = "Return a subscription by ID")
@GetMapping("/{id}") @GetMapping("/{id}")
public Subscription getSubscription(@PathVariable final String id) { public Subscription getSubscription(@PathVariable final String id) {
return subscriptionRepo.findById(id).get(); return subscriptionRepo.findById(id).get();
} }
@ApiOperation("Delete a subscription by ID and its notifications") @Operation(summary = "Delete a subscription by ID and its notifications")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public void deleteSubscription(@PathVariable final String id) { public void deleteSubscription(@PathVariable final String id) {
subscriptionRepo.deleteById(id); subscriptionRepo.deleteById(id);
notificationRepo.deleteBySubscriptionId(id); notificationRepo.deleteBySubscriptionId(id);
} }
@ApiOperation("Perform a new subscription") @Operation(summary = "Perform a new subscription")
@PostMapping("") @PostMapping("")
public Subscription registerSubscription(@RequestBody final InSubscription inSub) { public Subscription registerSubscription(@RequestBody final InSubscription inSub) {
final Subscription sub = inSub.asSubscription(); final Subscription sub = inSub.asSubscription();
@ -80,7 +80,7 @@ public class SubscriptionsController extends AbstractDnetController {
return sub; return sub;
} }
@ApiOperation("Delete all subscriptions and notifications") @Operation(summary = "Delete all subscriptions and notifications")
@DeleteMapping("") @DeleteMapping("")
public Map<String, Object> clearSubscriptions() { public Map<String, Object> clearSubscriptions() {
final Map<String, Object> res = new HashMap<>(); final Map<String, Object> res = new HashMap<>();
@ -90,7 +90,7 @@ public class SubscriptionsController extends AbstractDnetController {
return res; return res;
} }
@ApiOperation("Reset the last notification date") @Operation(summary = "Reset the last notification date")
@DeleteMapping("/{id}/date") @DeleteMapping("/{id}/date")
public void deleteNotificationDate(@PathVariable final String id) { public void deleteNotificationDate(@PathVariable final String id) {
final Subscription s = subscriptionRepo.findById(id).get(); final Subscription s = subscriptionRepo.findById(id).get();
@ -98,7 +98,7 @@ public class SubscriptionsController extends AbstractDnetController {
subscriptionRepo.save(s); subscriptionRepo.save(s);
} }
@ApiOperation("Reset all the last notification dates") @Operation(summary = "Reset all the last notification dates")
@GetMapping("/resetLastNotificationDates") @GetMapping("/resetLastNotificationDates")
public void deleteAllNotificationDates() { public void deleteAllNotificationDates() {
for (final Subscription s : subscriptionRepo.findAll()) { for (final Subscription s : subscriptionRepo.findAll()) {

View File

@ -22,12 +22,12 @@ import eu.dnetlib.broker.LiteratureBrokerServiceApplication;
import eu.dnetlib.broker.common.topics.TopicType; import eu.dnetlib.broker.common.topics.TopicType;
import eu.dnetlib.broker.common.topics.TopicTypeRepository; import eu.dnetlib.broker.common.topics.TopicTypeRepository;
import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.common.controller.AbstractDnetController;
import io.swagger.annotations.Api; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.tags.Tag;
@RestController @RestController
@RequestMapping("/api/topic-types") @RequestMapping("/api/topic-types")
@Api(tags = LiteratureBrokerServiceApplication.TAG_TOPIC_TYPES) @Tag(name = LiteratureBrokerServiceApplication.TAG_TOPIC_TYPES)
public class TopicsController extends AbstractDnetController { public class TopicsController extends AbstractDnetController {
@Autowired @Autowired
@ -36,13 +36,13 @@ public class TopicsController extends AbstractDnetController {
private final Predicate<String> verifyExpression = private final Predicate<String> verifyExpression =
Pattern.compile("^([a-zA-Z0-9._-]+|<[a-zA-Z0-9._-]+>)(\\/([a-zA-Z0-9._-]+|<[a-zA-Z0-9._-]+>))+$").asPredicate(); Pattern.compile("^([a-zA-Z0-9._-]+|<[a-zA-Z0-9._-]+>)(\\/([a-zA-Z0-9._-]+|<[a-zA-Z0-9._-]+>))+$").asPredicate();
@ApiOperation("Return the list of topic types") @Operation(summary = "Return the list of topic types")
@GetMapping("") @GetMapping("")
public Iterable<TopicType> listTopicTypes() { public Iterable<TopicType> listTopicTypes() {
return topicTypeRepo.findAll(); return topicTypeRepo.findAll();
} }
@ApiOperation("Register a new topic type") @Operation(summary = "Register a new topic type")
@PostMapping("/add") @PostMapping("/add")
public TopicType registerTopicType(@RequestParam final String name, public TopicType registerTopicType(@RequestParam final String name,
@RequestParam final String expression, @RequestParam final String expression,
@ -61,20 +61,20 @@ public class TopicsController extends AbstractDnetController {
return type; return type;
} }
@ApiOperation("Return a topic type by ID") @Operation(summary = "Return a topic type by ID")
@GetMapping("/{id}") @GetMapping("/{id}")
public TopicType getTopicType(@PathVariable final String id) { public TopicType getTopicType(@PathVariable final String id) {
return topicTypeRepo.findById(id).get(); return topicTypeRepo.findById(id).get();
} }
@ApiOperation("Delete a topic type by ID") @Operation(summary = "Delete a topic type by ID")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
public List<String> deleteTopicType(@PathVariable final String id) { public List<String> deleteTopicType(@PathVariable final String id) {
topicTypeRepo.deleteById(id); topicTypeRepo.deleteById(id);
return Arrays.asList("Done."); return Arrays.asList("Done.");
} }
@ApiOperation("Delete all topic types") @Operation(summary = "Delete all topic types")
@DeleteMapping("") @DeleteMapping("")
public Map<String, Object> clearTopicTypes() { public Map<String, Object> clearTopicTypes() {
final Map<String, Object> res = new HashMap<>(); final Map<String, Object> res = new HashMap<>();

View File

@ -56,13 +56,13 @@ import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.broker.events.output.DispatcherManager; import eu.dnetlib.broker.events.output.DispatcherManager;
import eu.dnetlib.broker.objects.OaBrokerEventPayload; import eu.dnetlib.broker.objects.OaBrokerEventPayload;
import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.common.controller.AbstractDnetController;
import io.swagger.annotations.Api; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.tags.Tag;
@Profile("openaire") @Profile("openaire")
@RestController @RestController
@RequestMapping("/api/openaireBroker") @RequestMapping("/api/openaireBroker")
@Api(tags = LiteratureBrokerServiceApplication.TAG_OPENAIRE) @Tag(name = LiteratureBrokerServiceApplication.TAG_OPENAIRE)
public class OpenaireBrokerController extends AbstractDnetController { public class OpenaireBrokerController extends AbstractDnetController {
@Autowired @Autowired
@ -85,7 +85,7 @@ public class OpenaireBrokerController extends AbstractDnetController {
private static final Log log = LogFactory.getLog(OpenaireBrokerController.class); private static final Log log = LogFactory.getLog(OpenaireBrokerController.class);
@ApiOperation("Return the datasources having events") @Operation(summary = "Return the datasources having events")
@GetMapping("/datasources") @GetMapping("/datasources")
public List<BrowseEntry> findDatasourcesWithEvents(@RequestParam(defaultValue = "false", required = false) final boolean useIndex) { public List<BrowseEntry> findDatasourcesWithEvents(@RequestParam(defaultValue = "false", required = false) final boolean useIndex) {
return useIndex ? findDatasourcesWithEventsUsingIndex() : findDatasourcesWithEventsUsingDb(); return useIndex ? findDatasourcesWithEventsUsingIndex() : findDatasourcesWithEventsUsingDb();
@ -123,7 +123,7 @@ public class OpenaireBrokerController extends AbstractDnetController {
} }
} }
@ApiOperation("Return the topics of the events of a datasource") @Operation(summary = "Return the topics of the events of a datasource")
@GetMapping("/topicsForDatasource") @GetMapping("/topicsForDatasource")
public List<BrowseEntry> findTopicsForDatasource(@RequestParam final String ds, public List<BrowseEntry> findTopicsForDatasource(@RequestParam final String ds,
@RequestParam(defaultValue = "false", required = false) final boolean useIndex) { @RequestParam(defaultValue = "false", required = false) final boolean useIndex) {
@ -163,7 +163,7 @@ public class OpenaireBrokerController extends AbstractDnetController {
} }
} }
@ApiOperation("Return a page of events of a datasource (by topic)") @Operation(summary = "Return a page of events of a datasource (by topic)")
@GetMapping("/events/{nPage}/{size}") @GetMapping("/events/{nPage}/{size}")
public EventsPage showEvents(@RequestParam final String ds, @RequestParam final String topic, @PathVariable final int nPage, @PathVariable final int size) { public EventsPage showEvents(@RequestParam final String ds, @RequestParam final String topic, @PathVariable final int nPage, @PathVariable final int size) {
@ -191,7 +191,7 @@ public class OpenaireBrokerController extends AbstractDnetController {
return new EventsPage(ds, topic, nPage, overrideGetTotalPage(page, size), page.getTotalHits(), list); return new EventsPage(ds, topic, nPage, overrideGetTotalPage(page, size), page.getTotalHits(), list);
} }
@ApiOperation("Return a page of events of a datasource (by query)") @Operation(summary = "Return a page of events of a datasource (by query)")
@PostMapping("/events/{nPage}/{size}") @PostMapping("/events/{nPage}/{size}")
public EventsPage advancedShowEvents(@PathVariable final int nPage, @PathVariable final int size, @RequestBody final AdvQueryObject qObj) { public EventsPage advancedShowEvents(@PathVariable final int nPage, @PathVariable final int size, @RequestBody final AdvQueryObject qObj) {
@ -227,7 +227,7 @@ public class OpenaireBrokerController extends AbstractDnetController {
return new EventsPage(qObj.getDatasource(), qObj.getTopic(), nPage, overrideGetTotalPage(page, size), page.getTotalHits(), list); return new EventsPage(qObj.getDatasource(), qObj.getTopic(), nPage, overrideGetTotalPage(page, size), page.getTotalHits(), list);
} }
@ApiOperation("Perform a subscription") @Operation(summary = "Perform a subscription")
@PostMapping("/subscribe") @PostMapping("/subscribe")
public Subscription registerSubscription(@RequestBody final OpenaireSubscription oSub) { public Subscription registerSubscription(@RequestBody final OpenaireSubscription oSub) {
final Subscription sub = oSub.asSubscription(); final Subscription sub = oSub.asSubscription();
@ -237,7 +237,7 @@ public class OpenaireBrokerController extends AbstractDnetController {
return sub; return sub;
} }
@ApiOperation("Return the subscriptions of an user (by email and datasource (optional))") @Operation(summary = "Return the subscriptions of an user (by email and datasource (optional))")
@GetMapping("/subscriptions") @GetMapping("/subscriptions")
public Map<String, List<SimpleSubscriptionDesc>> subscriptions(@RequestParam final String email, @RequestParam(required = false) final String ds) { public Map<String, List<SimpleSubscriptionDesc>> subscriptions(@RequestParam final String email, @RequestParam(required = false) final String ds) {
final Iterable<Subscription> iter = subscriptionRepo.findBySubscriber(email); final Iterable<Subscription> iter = subscriptionRepo.findBySubscriber(email);
@ -247,7 +247,7 @@ public class OpenaireBrokerController extends AbstractDnetController {
.collect(Collectors.groupingBy(SimpleSubscriptionDesc::getDatasource)); .collect(Collectors.groupingBy(SimpleSubscriptionDesc::getDatasource));
} }
@ApiOperation("Return a page of notifications") @Operation(summary = "Return a page of notifications")
@GetMapping("/notifications/{subscrId}/{nPage}/{size}") @GetMapping("/notifications/{subscrId}/{nPage}/{size}")
public EventsPage notifications(@PathVariable final String subscrId, @PathVariable final int nPage, @PathVariable final int size) { public EventsPage notifications(@PathVariable final String subscrId, @PathVariable final int nPage, @PathVariable final int size) {
@ -279,14 +279,14 @@ public class OpenaireBrokerController extends AbstractDnetController {
} }
@ApiOperation("Send notifications") @Operation(summary = "Send notifications")
@GetMapping("/notifications/send/{date}") @GetMapping("/notifications/send/{date}")
private List<String> sendMailForNotifications(@PathVariable final long date) { private List<String> sendMailForNotifications(@PathVariable final long date) {
new Thread(() -> innerSendMailForNotifications(date)).start(); new Thread(() -> innerSendMailForNotifications(date)).start();
return Arrays.asList("Sending ..."); return Arrays.asList("Sending ...");
} }
@ApiOperation("Update stats") @Operation(summary = "Update stats")
@GetMapping("/stats/update") @GetMapping("/stats/update")
private List<String> updateStats() { private List<String> updateStats() {
new Thread(() -> { new Thread(() -> {

View File

@ -16,10 +16,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
import eu.dnetlib.broker.common.elasticsearch.Event; import eu.dnetlib.broker.common.elasticsearch.Event;
import eu.dnetlib.broker.common.elasticsearch.Notification; import eu.dnetlib.broker.common.elasticsearch.Notification;
import eu.dnetlib.broker.common.properties.ElasticSearchProperties; import eu.dnetlib.broker.common.properties.ElasticSearchProperties;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration @Configuration
@EnableSwagger2
@EnableCaching @EnableCaching
@EnableScheduling @EnableScheduling
@EnableTransactionManagement @EnableTransactionManagement

View File

@ -1,14 +1,19 @@
package eu.dnetlib.broker; package eu.dnetlib.broker;
import java.util.ArrayList;
import java.util.List;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import eu.dnetlib.common.app.AbstractDnetApp; import eu.dnetlib.common.app.AbstractDnetApp;
import springfox.documentation.builders.ApiInfoBuilder; import io.swagger.v3.oas.models.ExternalDocumentation;
import springfox.documentation.builders.RequestHandlerSelectors; import io.swagger.v3.oas.models.OpenAPI;
import springfox.documentation.service.ApiInfo; import io.swagger.v3.oas.models.info.Info;
import springfox.documentation.service.Tag; import io.swagger.v3.oas.models.info.License;
import springfox.documentation.spring.web.plugins.Docket; import io.swagger.v3.oas.models.tags.Tag;
@SpringBootApplication @SpringBootApplication
public class BrokerPublicApplication extends AbstractDnetApp { public class BrokerPublicApplication extends AbstractDnetApp {
@ -19,22 +24,27 @@ public class BrokerPublicApplication extends AbstractDnetApp {
SpringApplication.run(BrokerPublicApplication.class, args); SpringApplication.run(BrokerPublicApplication.class, args);
} }
@Override @Bean
protected void configSwagger(final Docket docket) { public GroupedOpenApi publicApi() {
return GroupedOpenApi.builder()
docket.select() .group("Broker Public APIs")
.apis(RequestHandlerSelectors.any()) .pathsToMatch("/")
.paths(p -> p.startsWith("/")) .build();
.build()
.tags(new Tag(OA_PUBLIC_APIS, OA_PUBLIC_APIS))
.apiInfo(new ApiInfoBuilder()
.title("OpenAIRE Public Broker API")
.description("APIs documentation")
.version("1.1")
.contact(ApiInfo.DEFAULT_CONTACT)
.license("Apache 2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0")
.build());
} }
@Override
protected void configSwagger(final OpenAPI openApi) {
final List<Tag> tags = new ArrayList<>();
tags.add(new Tag().name(OA_PUBLIC_APIS).description(OA_PUBLIC_APIS));
openApi.info(new Info().title("OpenAIRE Public Broker API")
.description("APIs documentation")
.version("1.1")
.license(new License().name("Apache 2.0").url("http://www.apache.org/licenses/LICENSE-2.0")))
.externalDocs(new ExternalDocumentation()
.description("SpringShop Wiki Documentation")
.url("https://springshop.wiki.github.org/docs"))
.tags(tags);
}
} }

View File

@ -63,13 +63,13 @@ import eu.dnetlib.broker.common.subscriptions.Subscription;
import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository; import eu.dnetlib.broker.common.subscriptions.SubscriptionRepository;
import eu.dnetlib.broker.objects.OaBrokerEventPayload; import eu.dnetlib.broker.objects.OaBrokerEventPayload;
import eu.dnetlib.common.controller.AbstractDnetController; import eu.dnetlib.common.controller.AbstractDnetController;
import io.swagger.annotations.Api; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.ApiOperation; import io.swagger.v3.oas.annotations.tags.Tag;
@Profile("openaire") @Profile("openaire")
@RestController @RestController
@RequestMapping("/") @RequestMapping("/")
@Api(tags = BrokerPublicApplication.OA_PUBLIC_APIS) @Tag(name = BrokerPublicApplication.OA_PUBLIC_APIS)
public class OpenairePublicController extends AbstractDnetController { public class OpenairePublicController extends AbstractDnetController {
@Autowired @Autowired
@ -97,7 +97,7 @@ public class OpenairePublicController extends AbstractDnetController {
private static final Log log = LogFactory.getLog(OpenairePublicController.class); private static final Log log = LogFactory.getLog(OpenairePublicController.class);
@ApiOperation("Returns notifications by subscription using scrolls (first page)") @Operation(summary = "Returns notifications by subscription using scrolls (first page)")
@GetMapping("/scroll/notifications/bySubscriptionId/{subscrId}") @GetMapping("/scroll/notifications/bySubscriptionId/{subscrId}")
public ScrollPage<ShortEventMessage> prepareScrollNotificationsBySubscrId(@PathVariable final String subscrId) { public ScrollPage<ShortEventMessage> prepareScrollNotificationsBySubscrId(@PathVariable final String subscrId) {
@ -130,7 +130,7 @@ public class OpenairePublicController extends AbstractDnetController {
} }
} }
@ApiOperation("Returns notifications using scrolls (other pages)") @Operation(summary = "Returns notifications using scrolls (other pages)")
@GetMapping("/scroll/notifications/{scrollId}") @GetMapping("/scroll/notifications/{scrollId}")
public ScrollPage<ShortEventMessage> scrollNotifications(@PathVariable final String scrollId) { public ScrollPage<ShortEventMessage> scrollNotifications(@PathVariable final String scrollId) {
@ -147,7 +147,7 @@ public class OpenairePublicController extends AbstractDnetController {
} }
} }
@ApiOperation("Returns notifications as file") @Operation(summary = "Returns notifications as file")
@GetMapping(value = "/file/notifications/bySubscriptionId/{subscrId}", produces = "application/gzip") @GetMapping(value = "/file/notifications/bySubscriptionId/{subscrId}", produces = "application/gzip")
public void notificationsAsFile(final HttpServletResponse res, @PathVariable final String subscrId) throws Exception { public void notificationsAsFile(final HttpServletResponse res, @PathVariable final String subscrId) throws Exception {
@ -184,7 +184,7 @@ public class OpenairePublicController extends AbstractDnetController {
} }
@ApiOperation("Returns events as file by opendoarId") @Operation(summary = "Returns events as file by opendoarId")
@GetMapping(value = "/file/events/opendoar/{id}", produces = "application/gzip") @GetMapping(value = "/file/events/opendoar/{id}", produces = "application/gzip")
public void opendoarEventsAsFile(final HttpServletResponse res, @PathVariable final String id) { public void opendoarEventsAsFile(final HttpServletResponse res, @PathVariable final String id) {
@ -252,13 +252,13 @@ public class OpenairePublicController extends AbstractDnetController {
return first; return first;
} }
@ApiOperation("Returns the list of subscriptions by user email") @Operation(summary = "Returns the list of subscriptions by user email")
@GetMapping(value = "/subscriptions") @GetMapping(value = "/subscriptions")
private Iterable<Subscription> listSubscriptionsByUser(@RequestParam final String email) { private Iterable<Subscription> listSubscriptionsByUser(@RequestParam final String email) {
return subscriptionRepo.findBySubscriber(email); return subscriptionRepo.findBySubscriber(email);
} }
@ApiOperation("Returns the status of the application") @Operation(summary = "Returns the status of the application")
@GetMapping(value = "/status") @GetMapping(value = "/status")
private Map<String, Long> status() { private Map<String, Long> status() {
final Map<String, Long> res = new LinkedHashMap<>(); final Map<String, Long> res = new LinkedHashMap<>();
@ -269,7 +269,7 @@ public class OpenairePublicController extends AbstractDnetController {
return res; return res;
} }
@ApiOperation("Store the feedback of an event (MOCK)") @Operation(summary = "Store the feedback of an event (MOCK)")
@RequestMapping(value = "/feedback/events", method = { @RequestMapping(value = "/feedback/events", method = {
RequestMethod.POST, RequestMethod.PATCH RequestMethod.POST, RequestMethod.PATCH
}) })

View File

@ -8,11 +8,11 @@ import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import eu.dnetlib.common.app.AbstractDnetApp; import eu.dnetlib.common.app.AbstractDnetApp;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication @SpringBootApplication
@EnableSwagger2 @EnableSwagger2

View File

@ -29,7 +29,7 @@ import io.swagger.annotations.ApiParam;
@RestController @RestController
@RequestMapping("/mdstores") @RequestMapping("/mdstores")
@Api(tags = { @Tag(tags = {
"Metadata Stores" "Metadata Stores"
}) })
public class MDStoreController extends AbstractDnetController { public class MDStoreController extends AbstractDnetController {
@ -42,67 +42,67 @@ public class MDStoreController extends AbstractDnetController {
private static final Logger log = LoggerFactory.getLogger(DatabaseUtils.class); private static final Logger log = LoggerFactory.getLogger(DatabaseUtils.class);
@ApiOperation("Return all the mdstores") @Operation(summary = "Return all the mdstores")
@GetMapping("/") @GetMapping("/")
public Iterable<MDStoreWithInfo> find() { public Iterable<MDStoreWithInfo> find() {
return databaseUtils.listMdStores(); return databaseUtils.listMdStores();
} }
@ApiOperation("Return all the mdstore identifiers") @Operation(summary = "Return all the mdstore identifiers")
@GetMapping("/ids") @GetMapping("/ids")
public List<String> findIdentifiers() { public List<String> findIdentifiers() {
return databaseUtils.listMdStoreIDs(); return databaseUtils.listMdStoreIDs();
} }
@ApiOperation("Return a mdstores by id") @Operation(summary = "Return a mdstores by id")
@GetMapping("/mdstore/{mdId}") @GetMapping("/mdstore/{mdId}")
public MDStoreWithInfo getMdStore(@ApiParam("the mdstore identifier") @PathVariable final String mdId) throws MDStoreManagerException { public MDStoreWithInfo getMdStore(@Parameter("the mdstore identifier") @PathVariable final String mdId) throws MDStoreManagerException {
return databaseUtils.findMdStore(mdId); return databaseUtils.findMdStore(mdId);
} }
@ApiOperation("Increase the read count of the current mdstore") @Operation(summary = "Increase the read count of the current mdstore")
@GetMapping("/mdstore/{mdId}/startReading") @GetMapping("/mdstore/{mdId}/startReading")
public MDStoreVersion startReading(@ApiParam("the mdstore identifier") @PathVariable final String mdId) throws MDStoreManagerException { public MDStoreVersion startReading(@Parameter("the mdstore identifier") @PathVariable final String mdId) throws MDStoreManagerException {
return databaseUtils.startReading(mdId); return databaseUtils.startReading(mdId);
} }
@ApiOperation("Create a new mdstore") @Operation(summary = "Create a new mdstore")
@GetMapping("/new/{format}/{layout}/{interpretation}") @GetMapping("/new/{format}/{layout}/{interpretation}")
public MDStoreWithInfo createMDStore( public MDStoreWithInfo createMDStore(
@ApiParam("mdstore format") @PathVariable final String format, @Parameter("mdstore format") @PathVariable final String format,
@ApiParam("mdstore layout") @PathVariable final String layout, @Parameter("mdstore layout") @PathVariable final String layout,
@ApiParam("mdstore interpretation") @PathVariable final String interpretation, @Parameter("mdstore interpretation") @PathVariable final String interpretation,
@ApiParam("datasource name") @RequestParam(required = true) final String dsName, @Parameter("datasource name") @RequestParam(required = true) final String dsName,
@ApiParam("datasource id") @RequestParam(required = true) final String dsId, @Parameter("datasource id") @RequestParam(required = true) final String dsId,
@ApiParam("api id") @RequestParam(required = true) final String apiId) throws MDStoreManagerException { @Parameter("api id") @RequestParam(required = true) final String apiId) throws MDStoreManagerException {
final String id = databaseUtils.createMDStore(format, layout, interpretation, dsName, dsId, apiId); final String id = databaseUtils.createMDStore(format, layout, interpretation, dsName, dsId, apiId);
return databaseUtils.findMdStore(id); return databaseUtils.findMdStore(id);
} }
@ApiOperation("Delete a mdstore by id") @Operation(summary = "Delete a mdstore by id")
@DeleteMapping("/mdstore/{mdId}") @DeleteMapping("/mdstore/{mdId}")
public StatusResponse delete(@ApiParam("the id of the mdstore that will be deleted") @PathVariable final String mdId) throws MDStoreManagerException { public StatusResponse delete(@Parameter("the id of the mdstore that will be deleted") @PathVariable final String mdId) throws MDStoreManagerException {
final String hdfsPath = databaseUtils.deleteMdStore(mdId); final String hdfsPath = databaseUtils.deleteMdStore(mdId);
hdfsClient.deletePath(hdfsPath); hdfsClient.deletePath(hdfsPath);
return StatusResponse.DELETED; return StatusResponse.DELETED;
} }
@ApiOperation("Return all the versions of a mdstore") @Operation(summary = "Return all the versions of a mdstore")
@GetMapping("/mdstore/{mdId}/versions") @GetMapping("/mdstore/{mdId}/versions")
public Iterable<MDStoreVersion> listVersions(@PathVariable final String mdId) throws MDStoreManagerException { public Iterable<MDStoreVersion> listVersions(@PathVariable final String mdId) throws MDStoreManagerException {
return databaseUtils.listVersions(mdId); return databaseUtils.listVersions(mdId);
} }
@ApiOperation("Create a new preliminary version of a mdstore") @Operation(summary = "Create a new preliminary version of a mdstore")
@GetMapping("/mdstore/{mdId}/newVersion") @GetMapping("/mdstore/{mdId}/newVersion")
public MDStoreVersion prepareNewVersion(@ApiParam("the id of the mdstore for which will be created a new version") @PathVariable final String mdId) { public MDStoreVersion prepareNewVersion(@Parameter("the id of the mdstore for which will be created a new version") @PathVariable final String mdId) {
return databaseUtils.prepareMdStoreVersion(mdId); return databaseUtils.prepareMdStoreVersion(mdId);
} }
@ApiOperation("Promote a preliminary version to current") @Operation(summary = "Promote a preliminary version to current")
@GetMapping("/version/{versionId}/commit/{size}") @GetMapping("/version/{versionId}/commit/{size}")
public MDStoreVersion commitVersion(@ApiParam("the id of the version that will be promoted to the current version") @PathVariable final String versionId, public MDStoreVersion commitVersion(@Parameter("the id of the version that will be promoted to the current version") @PathVariable final String versionId,
@ApiParam("the size of the new current mdstore") @PathVariable final long size) throws MDStoreManagerException { @Parameter("the size of the new current mdstore") @PathVariable final long size) throws MDStoreManagerException {
try { try {
return databaseUtils.commitMdStoreVersion(versionId, size); return databaseUtils.commitMdStoreVersion(versionId, size);
} finally { } finally {
@ -110,46 +110,46 @@ public class MDStoreController extends AbstractDnetController {
} }
} }
@ApiOperation("Abort a preliminary version") @Operation(summary = "Abort a preliminary version")
@GetMapping("/version/{versionId}/abort") @GetMapping("/version/{versionId}/abort")
public StatusResponse commitVersion(@ApiParam("the id of the version to abort") @PathVariable final String versionId) throws MDStoreManagerException { public StatusResponse commitVersion(@Parameter("the id of the version to abort") @PathVariable final String versionId) throws MDStoreManagerException {
final String hdfsPath = databaseUtils.deleteMdStoreVersion(versionId, true); final String hdfsPath = databaseUtils.deleteMdStoreVersion(versionId, true);
hdfsClient.deletePath(hdfsPath); hdfsClient.deletePath(hdfsPath);
return StatusResponse.ABORTED; return StatusResponse.ABORTED;
} }
@ApiOperation("Return an existing mdstore version") @Operation(summary = "Return an existing mdstore version")
@GetMapping("/version/{versionId}") @GetMapping("/version/{versionId}")
public MDStoreVersion getVersion(@ApiParam("the id of the version that has to be deleted") @PathVariable final String versionId) public MDStoreVersion getVersion(@Parameter("the id of the version that has to be deleted") @PathVariable final String versionId)
throws MDStoreManagerException { throws MDStoreManagerException {
return databaseUtils.findVersion(versionId); return databaseUtils.findVersion(versionId);
} }
@ApiOperation("Delete a mdstore version") @Operation(summary = "Delete a mdstore version")
@DeleteMapping("/version/{versionId}") @DeleteMapping("/version/{versionId}")
public StatusResponse deleteVersion(@ApiParam("the id of the version that has to be deleted") @PathVariable final String versionId, public StatusResponse deleteVersion(@Parameter("the id of the version that has to be deleted") @PathVariable final String versionId,
@ApiParam("if true, the controls on writing and readcount values will be skipped") @RequestParam(required = false, defaultValue = "false") final boolean force) @Parameter("if true, the controls on writing and readcount values will be skipped") @RequestParam(required = false, defaultValue = "false") final boolean force)
throws MDStoreManagerException { throws MDStoreManagerException {
final String hdfsPath = databaseUtils.deleteMdStoreVersion(versionId, force); final String hdfsPath = databaseUtils.deleteMdStoreVersion(versionId, force);
hdfsClient.deletePath(hdfsPath); hdfsClient.deletePath(hdfsPath);
return StatusResponse.DELETED; return StatusResponse.DELETED;
} }
@ApiOperation("Decrease the read count of a mdstore version") @Operation(summary = "Decrease the read count of a mdstore version")
@GetMapping("/version/{versionId}/endReading") @GetMapping("/version/{versionId}/endReading")
public MDStoreVersion endReading(@ApiParam("the id of the version that has been completely read") @PathVariable final String versionId) public MDStoreVersion endReading(@Parameter("the id of the version that has been completely read") @PathVariable final String versionId)
throws MDStoreManagerException { throws MDStoreManagerException {
return databaseUtils.endReading(versionId); return databaseUtils.endReading(versionId);
} }
@ApiOperation("Reset the read count of a mdstore version") @Operation(summary = "Reset the read count of a mdstore version")
@GetMapping("/version/{versionId}/resetReading") @GetMapping("/version/{versionId}/resetReading")
public MDStoreVersion resetReading(@ApiParam("the id of the version") @PathVariable final String versionId) public MDStoreVersion resetReading(@Parameter("the id of the version") @PathVariable final String versionId)
throws MDStoreManagerException { throws MDStoreManagerException {
return databaseUtils.resetReading(versionId); return databaseUtils.resetReading(versionId);
} }
@ApiOperation("Delete expired versions") @Operation(summary = "Delete expired versions")
@DeleteMapping("/versions/expired") @DeleteMapping("/versions/expired")
public StatusResponse deleteExpiredVersions() { public StatusResponse deleteExpiredVersions() {
new Thread(this::performDeleteOfExpiredVersions).start(); new Thread(this::performDeleteOfExpiredVersions).start();
@ -169,10 +169,10 @@ public class MDStoreController extends AbstractDnetController {
log.info("Done."); log.info("Done.");
} }
@ApiOperation("Fix the inconsistencies on HDFS") @Operation(summary = "Fix the inconsistencies on HDFS")
@GetMapping("/hdfs/inconsistencies") @GetMapping("/hdfs/inconsistencies")
public Set<String> fixHdfsInconsistencies( public Set<String> fixHdfsInconsistencies(
@ApiParam("force the deletion of hdfs paths") @RequestParam(required = false, defaultValue = "false") final boolean delete) @Parameter("force the deletion of hdfs paths") @RequestParam(required = false, defaultValue = "false") final boolean delete)
throws MDStoreManagerException { throws MDStoreManagerException {
final Set<String> hdfsDirs = hdfsClient.listHadoopDirs(); final Set<String> hdfsDirs = hdfsClient.listHadoopDirs();
@ -189,7 +189,7 @@ public class MDStoreController extends AbstractDnetController {
return toDelete; return toDelete;
} }
@ApiOperation("Show informations") @Operation(summary = "Show informations")
@GetMapping("/info") @GetMapping("/info")
public Map<String, Object> info() { public Map<String, Object> info() {
final Map<String, Object> info = new LinkedHashMap<>(); final Map<String, Object> info = new LinkedHashMap<>();
@ -201,21 +201,21 @@ public class MDStoreController extends AbstractDnetController {
return info; return info;
} }
@ApiOperation("list the file inside the path of a mdstore version") @Operation(summary = "list the file inside the path of a mdstore version")
@GetMapping("/version/{versionId}/parquet/files") @GetMapping("/version/{versionId}/parquet/files")
public Set<String> listVersionFiles(@PathVariable final String versionId) throws MDStoreManagerException { public Set<String> listVersionFiles(@PathVariable final String versionId) throws MDStoreManagerException {
final String path = databaseUtils.findVersion(versionId).getHdfsPath(); final String path = databaseUtils.findVersion(versionId).getHdfsPath();
return hdfsClient.listContent(path + "/store", HdfsClient::isParquetFile); return hdfsClient.listContent(path + "/store", HdfsClient::isParquetFile);
} }
@ApiOperation("read the parquet file of a mdstore version") @Operation(summary = "read the parquet file of a mdstore version")
@GetMapping("/version/{versionId}/parquet/content/{limit}") @GetMapping("/version/{versionId}/parquet/content/{limit}")
public List<Map<String, String>> listVersionParquet(@PathVariable final String versionId, @PathVariable final long limit) throws MDStoreManagerException { public List<Map<String, String>> listVersionParquet(@PathVariable final String versionId, @PathVariable final long limit) throws MDStoreManagerException {
final String path = databaseUtils.findVersion(versionId).getHdfsPath(); final String path = databaseUtils.findVersion(versionId).getHdfsPath();
return hdfsClient.readParquetFiles(path + "/store", limit); return hdfsClient.readParquetFiles(path + "/store", limit);
} }
@ApiOperation("read the parquet file of a mdstore (current version)") @Operation(summary = "read the parquet file of a mdstore (current version)")
@GetMapping("/mdstore/{mdId}/parquet/content/{limit}") @GetMapping("/mdstore/{mdId}/parquet/content/{limit}")
public List<Map<String, String>> listMdstoreParquet(@PathVariable final String mdId, @PathVariable final long limit) throws MDStoreManagerException { public List<Map<String, String>> listMdstoreParquet(@PathVariable final String mdId, @PathVariable final long limit) throws MDStoreManagerException {
final String versionId = databaseUtils.findMdStore(mdId).getCurrentVersion(); final String versionId = databaseUtils.findMdStore(mdId).getCurrentVersion();

View File

@ -21,12 +21,12 @@ import eu.dnetlib.openaire.dsm.DsmApiController;
import eu.dnetlib.openaire.funders.FundersApiController; import eu.dnetlib.openaire.funders.FundersApiController;
import eu.dnetlib.openaire.info.InfoController; import eu.dnetlib.openaire.info.InfoController;
import eu.dnetlib.openaire.project.ProjectsController; import eu.dnetlib.openaire.project.ProjectsController;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableCaching @EnableCaching
@EnableScheduling @EnableScheduling

View File

@ -22,41 +22,41 @@ public class CommunityApiController {
@RequestMapping(value = "/community/communities", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/community/communities", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "get all community profiles", value = "get all community profiles",
notes = "get all community profiles", notes = "get all community profiles",
tags = { C, R }, tags = { C, R },
response = CommunitySummary[].class) response = CommunitySummary[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = CommunitySummary[].class), @ApiResponse(responseCode = "200", description = "OK", response = CommunitySummary[].class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public List<CommunitySummary> listCommunities() throws CommunityException { public List<CommunitySummary> listCommunities() throws CommunityException {
return communityApiCore.listCommunities(); return communityApiCore.listCommunities();
} }
@RequestMapping(value = "/community/{id}", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/community/{id}", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "get community profile", value = "get community profile",
notes = "get community profile", notes = "get community profile",
tags = { C, R }, tags = { C, R },
response = CommunityDetails.class) response = CommunityDetails.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = CommunityDetails.class), @ApiResponse(responseCode = "200", description = "OK", response = CommunityDetails.class),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public CommunityDetails getCommunity(@PathVariable final String id) throws CommunityException, CommunityNotFoundException { public CommunityDetails getCommunity(@PathVariable final String id) throws CommunityException, CommunityNotFoundException {
return communityApiCore.getCommunity(id); return communityApiCore.getCommunity(id);
} }
@RequestMapping(value = "/community/{id}", produces = { "application/json" }, method = RequestMethod.POST) @RequestMapping(value = "/community/{id}", produces = { "application/json" }, method = RequestMethod.POST)
@ApiOperation( @Operation(
value = "update community details", value = "update community details",
notes = "update community details", notes = "update community details",
tags = { C, R }) tags = { C, R })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public void setCommunity( public void setCommunity(
@PathVariable final String id, @PathVariable final String id,
@RequestBody CommunityWritableProperties properties) throws CommunityException, CommunityNotFoundException { @RequestBody CommunityWritableProperties properties) throws CommunityException, CommunityNotFoundException {
@ -65,28 +65,28 @@ public class CommunityApiController {
} }
@RequestMapping(value = "/community/{id}/projects", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/community/{id}/projects", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "get community projects", value = "get community projects",
notes = "get community projects", notes = "get community projects",
tags = { C_PJ, R }, tags = { C_PJ, R },
response = CommunityProject[].class) response = CommunityProject[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = CommunityProject[].class), @ApiResponse(responseCode = "200", description = "OK", response = CommunityProject[].class),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public List<CommunityProject> getCommunityProjects(@PathVariable final String id) throws CommunityException, CommunityNotFoundException { public List<CommunityProject> getCommunityProjects(@PathVariable final String id) throws CommunityException, CommunityNotFoundException {
return communityApiCore.getCommunityProjects(id); return communityApiCore.getCommunityProjects(id);
} }
@RequestMapping(value = "/community/{id}/projects", produces = { "application/json" }, method = RequestMethod.POST) @RequestMapping(value = "/community/{id}/projects", produces = { "application/json" }, method = RequestMethod.POST)
@ApiOperation( @Operation(
value = "associate a project to the community", value = "associate a project to the community",
notes = "associate a project to the community", notes = "associate a project to the community",
tags = { C_PJ, W }) tags = { C_PJ, W })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public CommunityProject addCommunityProject( public CommunityProject addCommunityProject(
@PathVariable final String id, @PathVariable final String id,
@RequestBody final CommunityProject project) throws CommunityException, CommunityNotFoundException { @RequestBody final CommunityProject project) throws CommunityException, CommunityNotFoundException {
@ -95,14 +95,14 @@ public class CommunityApiController {
} }
@RequestMapping(value = "/community/{id}/projects", produces = { "application/json" }, method = RequestMethod.DELETE) @RequestMapping(value = "/community/{id}/projects", produces = { "application/json" }, method = RequestMethod.DELETE)
@ApiOperation( @Operation(
value = "remove a project from the community", value = "remove a project from the community",
notes = "remove a project from the community", notes = "remove a project from the community",
tags = { C_PJ, W }) tags = { C_PJ, W })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public void deleteCommunityProject( public void deleteCommunityProject(
@PathVariable final String id, @PathVariable final String id,
@RequestBody final Integer projectId) throws CommunityException, CommunityNotFoundException { @RequestBody final Integer projectId) throws CommunityException, CommunityNotFoundException {
@ -111,28 +111,28 @@ public class CommunityApiController {
} }
@RequestMapping(value = "/community/{id}/contentproviders", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/community/{id}/contentproviders", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "get the list of content providers associated to a given community", value = "get the list of content providers associated to a given community",
notes = "get the list of content providers associated to a given community", notes = "get the list of content providers associated to a given community",
tags = { C_CP, R }, tags = { C_CP, R },
response = CommunityContentprovider[].class) response = CommunityContentprovider[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = CommunityContentprovider[].class), @ApiResponse(responseCode = "200", description = "OK", response = CommunityContentprovider[].class),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public List<CommunityContentprovider> getCommunityContentproviders(@PathVariable final String id) throws CommunityException, CommunityNotFoundException { public List<CommunityContentprovider> getCommunityContentproviders(@PathVariable final String id) throws CommunityException, CommunityNotFoundException {
return communityApiCore.getCommunityContentproviders(id); return communityApiCore.getCommunityContentproviders(id);
} }
@RequestMapping(value = "/community/{id}/contentproviders", produces = { "application/json" }, method = RequestMethod.POST) @RequestMapping(value = "/community/{id}/contentproviders", produces = { "application/json" }, method = RequestMethod.POST)
@ApiOperation( @Operation(
value = "associate a content provider to the community", value = "associate a content provider to the community",
notes = "associate a content provider to the community", notes = "associate a content provider to the community",
tags = { C_CP, W }) tags = { C_CP, W })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public CommunityContentprovider addCommunityContentprovider( public CommunityContentprovider addCommunityContentprovider(
@PathVariable final String id, @PathVariable final String id,
@RequestBody final CommunityContentprovider contentprovider) throws CommunityException, CommunityNotFoundException { @RequestBody final CommunityContentprovider contentprovider) throws CommunityException, CommunityNotFoundException {
@ -141,14 +141,14 @@ public class CommunityApiController {
} }
@RequestMapping(value = "/community/{id}/contentproviders", produces = { "application/json" }, method = RequestMethod.DELETE) @RequestMapping(value = "/community/{id}/contentproviders", produces = { "application/json" }, method = RequestMethod.DELETE)
@ApiOperation( @Operation(
value = "remove the association between a content provider and the community", value = "remove the association between a content provider and the community",
notes = "remove the association between a content provider and the community", notes = "remove the association between a content provider and the community",
tags = { C_CP, W }) tags = { C_CP, W })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public void removeCommunityContentprovider( public void removeCommunityContentprovider(
@PathVariable final String id, @PathVariable final String id,
@RequestBody final Integer contentproviderId) throws CommunityException, CommunityNotFoundException { @RequestBody final Integer contentproviderId) throws CommunityException, CommunityNotFoundException {
@ -159,28 +159,28 @@ public class CommunityApiController {
//ADDING CODE FOR COMMUNITY ORGANIZATIONS //ADDING CODE FOR COMMUNITY ORGANIZATIONS
@RequestMapping(value = "/community/{id}/organizations", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/community/{id}/organizations", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "get the list of organizations for a given community", value = "get the list of organizations for a given community",
notes = "get the list of organizations for a given community", notes = "get the list of organizations for a given community",
tags = { C_O, R }, tags = { C_O, R },
response = CommunityOrganization[].class) response = CommunityOrganization[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = CommunityContentprovider[].class), @ApiResponse(responseCode = "200", description = "OK", response = CommunityContentprovider[].class),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public List<CommunityOrganization> getCommunityOrganizations(@PathVariable final String id) throws CommunityException, CommunityNotFoundException { public List<CommunityOrganization> getCommunityOrganizations(@PathVariable final String id) throws CommunityException, CommunityNotFoundException {
return communityApiCore.getCommunityOrganizations(id); return communityApiCore.getCommunityOrganizations(id);
} }
@RequestMapping(value = "/community/{id}/organizations", produces = { "application/json" }, method = RequestMethod.POST) @RequestMapping(value = "/community/{id}/organizations", produces = { "application/json" }, method = RequestMethod.POST)
@ApiOperation( @Operation(
value = "associate an organization to the community", value = "associate an organization to the community",
notes = "associate an organization to the community", notes = "associate an organization to the community",
tags = { C_O, W }) tags = { C_O, W })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public CommunityOrganization addCommunityOrganization( public CommunityOrganization addCommunityOrganization(
@PathVariable final String id, @PathVariable final String id,
@RequestBody final CommunityOrganization organization) throws CommunityException, CommunityNotFoundException { @RequestBody final CommunityOrganization organization) throws CommunityException, CommunityNotFoundException {
@ -189,14 +189,14 @@ public class CommunityApiController {
} }
@RequestMapping(value = "/community/{id}/organizations", produces = { "application/json" }, method = RequestMethod.DELETE) @RequestMapping(value = "/community/{id}/organizations", produces = { "application/json" }, method = RequestMethod.DELETE)
@ApiOperation( @Operation(
value = "remove the association between an organization and the community", value = "remove the association between an organization and the community",
notes = "remove the association between an organization and the community", notes = "remove the association between an organization and the community",
tags = { C_O, W }) tags = { C_O, W })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public void removeCommunityOrganization( public void removeCommunityOrganization(
@PathVariable final String id, @PathVariable final String id,
@RequestBody final Integer organizationId) throws CommunityException, CommunityNotFoundException { @RequestBody final Integer organizationId) throws CommunityException, CommunityNotFoundException {
@ -206,14 +206,14 @@ public class CommunityApiController {
//********************** //**********************
@RequestMapping(value = "/community/{id}/subjects", produces = { "application/json" }, method = RequestMethod.POST) @RequestMapping(value = "/community/{id}/subjects", produces = { "application/json" }, method = RequestMethod.POST)
@ApiOperation( @Operation(
value = "associate a subject to the community", value = "associate a subject to the community",
notes = "associate a subject to the community", notes = "associate a subject to the community",
tags = { C, W }) tags = { C, W })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public CommunityDetails addCommunitySubjects( public CommunityDetails addCommunitySubjects(
@PathVariable final String id, @PathVariable final String id,
@RequestBody final List<String> subjects) throws CommunityException, CommunityNotFoundException { @RequestBody final List<String> subjects) throws CommunityException, CommunityNotFoundException {
@ -222,14 +222,14 @@ public class CommunityApiController {
} }
@RequestMapping(value = "/community/{id}/subjects", produces = { "application/json" }, method = RequestMethod.DELETE) @RequestMapping(value = "/community/{id}/subjects", produces = { "application/json" }, method = RequestMethod.DELETE)
@ApiOperation( @Operation(
value = "remove subjects from a community", value = "remove subjects from a community",
notes = "remove subjects from a community", notes = "remove subjects from a community",
tags = { C, W }) tags = { C, W })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public CommunityDetails removeCommunitySubjects( public CommunityDetails removeCommunitySubjects(
@PathVariable final String id, @PathVariable final String id,
@RequestBody final List<String> subjects) throws CommunityException, CommunityNotFoundException { @RequestBody final List<String> subjects) throws CommunityException, CommunityNotFoundException {
@ -238,28 +238,28 @@ public class CommunityApiController {
} }
@RequestMapping(value = "/community/{id}/zenodocommunities", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/community/{id}/zenodocommunities", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "get the list of Zenodo communities associated to a given community", value = "get the list of Zenodo communities associated to a given community",
notes = "get the list of Zenodo communities associated to a given community", notes = "get the list of Zenodo communities associated to a given community",
tags = { C_ZC, R }, tags = { C_ZC, R },
response = CommunityZenodoCommunity[].class) response = CommunityZenodoCommunity[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = CommunityZenodoCommunity[].class), @ApiResponse(responseCode = "200", description = "OK", response = CommunityZenodoCommunity[].class),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public List<CommunityZenodoCommunity> getCommunityZenodoCommunities(@PathVariable final String id) throws CommunityException, CommunityNotFoundException { public List<CommunityZenodoCommunity> getCommunityZenodoCommunities(@PathVariable final String id) throws CommunityException, CommunityNotFoundException {
return communityApiCore.getCommunityZenodoCommunities(id); return communityApiCore.getCommunityZenodoCommunities(id);
} }
@RequestMapping(value = "/community/{id}/zenodocommunities", produces = { "application/json" }, method = RequestMethod.POST) @RequestMapping(value = "/community/{id}/zenodocommunities", produces = { "application/json" }, method = RequestMethod.POST)
@ApiOperation( @Operation(
value = "associate a Zenodo community to the community", value = "associate a Zenodo community to the community",
notes = "associate a Zenodo community to the community", notes = "associate a Zenodo community to the community",
tags = { C_ZC, W }) tags = { C_ZC, W })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public CommunityZenodoCommunity addCommunityZenodoCommunity( public CommunityZenodoCommunity addCommunityZenodoCommunity(
@PathVariable final String id, @PathVariable final String id,
@RequestBody final CommunityZenodoCommunity zenodocommunity) throws CommunityException, CommunityNotFoundException { @RequestBody final CommunityZenodoCommunity zenodocommunity) throws CommunityException, CommunityNotFoundException {
@ -269,14 +269,14 @@ public class CommunityApiController {
} }
@RequestMapping(value = "/community/{id}/zenodocommunities", produces = { "application/json" }, method = RequestMethod.DELETE) @RequestMapping(value = "/community/{id}/zenodocommunities", produces = { "application/json" }, method = RequestMethod.DELETE)
@ApiOperation( @Operation(
value = "remove a Zenodo community from a community", value = "remove a Zenodo community from a community",
notes = "remove a Zenodo community from a community", notes = "remove a Zenodo community from a community",
tags = { C_ZC, W }) tags = { C_ZC, W })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public void removeCommunityZenodoCommunity( public void removeCommunityZenodoCommunity(
@PathVariable final String id, @PathVariable final String id,
@RequestBody final Integer zenodoCommId) throws CommunityException, CommunityNotFoundException { @RequestBody final Integer zenodoCommId) throws CommunityException, CommunityNotFoundException {
@ -287,14 +287,14 @@ public class CommunityApiController {
@RequestMapping(value = "/community/{zenodoId}/openairecommunities", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/community/{zenodoId}/openairecommunities", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "get the list of OpenAIRE communities associated to a given Zenodo community", value = "get the list of OpenAIRE communities associated to a given Zenodo community",
notes = "get the list of OpenAIRE communities associated to a given Zenodo community", notes = "get the list of OpenAIRE communities associated to a given Zenodo community",
tags = { C_ZC, R }) tags = { C_ZC, R })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 404, message = "not found", response = CommunityNotFoundException.class), @ApiResponse(responseCode = "404", description = "not found", response = CommunityNotFoundException.class),
@ApiResponse(code = 500, message = "unexpected error", response = CommunityException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = CommunityException.class) })
public CommunityOpenAIRECommunities getOpenAireCommunities( public CommunityOpenAIRECommunities getOpenAireCommunities(
@PathVariable final String zenodoId) throws CommunityException, CommunityNotFoundException { @PathVariable final String zenodoId) throws CommunityException, CommunityNotFoundException {

View File

@ -11,26 +11,26 @@ import io.swagger.annotations.ApiModelProperty;
@JsonAutoDetect @JsonAutoDetect
public class CommunityContentprovider { public class CommunityContentprovider {
@ApiModelProperty(value = "OpenAIRE identifier for this content provider, if available", required = false) @Schema(value = "OpenAIRE identifier for this content provider, if available", required = false)
private String openaireId; private String openaireId;
@NotNull @NotNull
@ApiModelProperty(value = "the community identifier this content provider belongs to", required = true) @Schema(value = "the community identifier this content provider belongs to", required = true)
private String communityId; private String communityId;
@NotNull @NotNull
@ApiModelProperty(value = "identifies this content provider within the context it belongs to", required = true) @Schema(value = "identifies this content provider within the context it belongs to", required = true)
private String id; private String id;
@ApiModelProperty(value = "content provider name", required = false) @Schema(value = "content provider name", required = false)
private String name; private String name;
@NotNull @NotNull
@ApiModelProperty(value = "content provider official name", required = true) @Schema(value = "content provider official name", required = true)
private String officialname; private String officialname;
// @NotNull // @NotNull
@ApiModelProperty(value = "content provider selection criteria", required = false) @Schema(value = "content provider selection criteria", required = false)
private SelectionCriteria selectioncriteria; private SelectionCriteria selectioncriteria;
public String getOpenaireId() { public String getOpenaireId() {

View File

@ -9,13 +9,13 @@ import io.swagger.annotations.ApiModelProperty;
@JsonAutoDetect @JsonAutoDetect
public class CommunityDetails extends CommunitySummary { public class CommunityDetails extends CommunitySummary {
@ApiModelProperty("date of creation for this community") @Schema("date of creation for this community")
private Date creationDate; private Date creationDate;
@ApiModelProperty("date of the last update for this communityu") @Schema("date of the last update for this communityu")
private Date lastUpdateDate; private Date lastUpdateDate;
@ApiModelProperty("list of subjects (keywords) that characterise this community") @Schema("list of subjects (keywords) that characterise this community")
private List<String> subjects; private List<String> subjects;
public CommunityDetails() { public CommunityDetails() {

View File

@ -9,11 +9,11 @@ import java.util.List;
public class CommunityOpenAIRECommunities { public class CommunityOpenAIRECommunities {
@NotNull @NotNull
@ApiModelProperty(value = "the zenodo community identifier", required = true) @Schema(value = "the zenodo community identifier", required = true)
private String zenodoid; private String zenodoid;
@NotNull @NotNull
@ApiModelProperty(value = "identifies this zenodo community within the context it belongs to", required = true) @Schema(value = "identifies this zenodo community within the context it belongs to", required = true)
private List<String> openAirecommunitylist; private List<String> openAirecommunitylist;
public CommunityOpenAIRECommunities() { public CommunityOpenAIRECommunities() {

View File

@ -8,24 +8,24 @@ import javax.validation.constraints.NotNull;
@JsonAutoDetect @JsonAutoDetect
public class CommunityOrganization { public class CommunityOrganization {
@NotNull @NotNull
@ApiModelProperty(value = "the community identifier this organization belongs to", required = true) @Schema(value = "the community identifier this organization belongs to", required = true)
private String communityId; private String communityId;
@NotNull @NotNull
@ApiModelProperty(value = "name of the organization", required = true) @Schema(value = "name of the organization", required = true)
private String name; private String name;
@NotNull @NotNull
@ApiModelProperty(value = "identifies this organization within the context it belongs to", required = true) @Schema(value = "identifies this organization within the context it belongs to", required = true)
private String id; private String id;
@NotNull @NotNull
@ApiModelProperty(value="url of the logo for this organization", required = true) @Schema(value="url of the logo for this organization", required = true)
private String logo_url; private String logo_url;
@NotNull @NotNull
@ApiModelProperty(value="website url for this organization", required = true) @Schema(value="website url for this organization", required = true)
private String website_url; private String website_url;
public String getCommunityId() { public String getCommunityId() {

View File

@ -6,25 +6,25 @@ import io.swagger.annotations.ApiModelProperty;
@JsonAutoDetect @JsonAutoDetect
public class CommunityProject { public class CommunityProject {
@ApiModelProperty(value = "OpenAIRE identifier for this project, if available", required = false) @Schema(value = "OpenAIRE identifier for this project, if available", required = false)
private String openaireId; private String openaireId;
@ApiModelProperty(value = "the community identifier this project belongs to", required = true) @Schema(value = "the community identifier this project belongs to", required = true)
private String communityId; private String communityId;
@ApiModelProperty(value = "identifies this project within the context it belongs to", required = true) @Schema(value = "identifies this project within the context it belongs to", required = true)
private String id; private String id;
@ApiModelProperty(value = "project name", required = true) @Schema(value = "project name", required = true)
private String name; private String name;
@ApiModelProperty(value = "project acronym", required = false) @Schema(value = "project acronym", required = false)
private String acronym; private String acronym;
@ApiModelProperty(value = "project funder", required = true) @Schema(value = "project funder", required = true)
private String funder; private String funder;
@ApiModelProperty(value = "project grant id", required = true) @Schema(value = "project grant id", required = true)
private String grantId; private String grantId;
public String getOpenaireId() { public String getOpenaireId() {

View File

@ -6,12 +6,12 @@ import io.swagger.annotations.ApiModelProperty;
@JsonAutoDetect @JsonAutoDetect
public enum CommunityStatus { public enum CommunityStatus {
@ApiModelProperty("restricted visibility") @Schema("restricted visibility")
hidden, hidden,
@ApiModelProperty("visible only to RCD managers") @Schema("visible only to RCD managers")
manager, manager,
@ApiModelProperty("visible to RCD managers and to the community users") @Schema("visible to RCD managers and to the community users")
all all
} }

View File

@ -9,37 +9,37 @@ import io.swagger.annotations.ApiModelProperty;
@JsonAutoDetect @JsonAutoDetect
public class CommunitySummary { public class CommunitySummary {
@ApiModelProperty("identifies the community") @Schema("identifies the community")
protected String id; protected String id;
@ApiModelProperty("values for this field reflect the index field _community_ in the index, e.g. 'egi||EGI Federation'") @Schema("values for this field reflect the index field _community_ in the index, e.g. 'egi||EGI Federation'")
protected String queryId; protected String queryId;
@ApiModelProperty("community type") @Schema("community type")
protected String type; protected String type;
@ApiModelProperty("community name") @Schema("community name")
protected String name; protected String name;
@ApiModelProperty("community short name") @Schema("community short name")
protected String shortName; protected String shortName;
@ApiModelProperty("community creation date") @Schema("community creation date")
protected Date creationDate; protected Date creationDate;
@ApiModelProperty("community last update date") @Schema("community last update date")
protected Date lastUpdateDate; protected Date lastUpdateDate;
@ApiModelProperty("community description") @Schema("community description")
protected String description; protected String description;
@ApiModelProperty("http url for the community logo") @Schema("http url for the community logo")
protected String logoUrl; protected String logoUrl;
@ApiModelProperty("status of the community, drives its visibility") @Schema("status of the community, drives its visibility")
protected CommunityStatus status; protected CommunityStatus status;
@ApiModelProperty("Zenodo community associated to this community") @Schema("Zenodo community associated to this community")
protected String zenodoCommunity; protected String zenodoCommunity;
public CommunitySummary() {} public CommunitySummary() {}

View File

@ -8,25 +8,25 @@ import io.swagger.annotations.ApiModelProperty;
@JsonAutoDetect @JsonAutoDetect
public class CommunityWritableProperties { public class CommunityWritableProperties {
@ApiModelProperty("community name") @Schema("community name")
private String name; private String name;
@ApiModelProperty("community short name") @Schema("community short name")
private String shortName; private String shortName;
@ApiModelProperty("community description") @Schema("community description")
private String description; private String description;
@ApiModelProperty("http url for the community logo") @Schema("http url for the community logo")
private String logoUrl; private String logoUrl;
@ApiModelProperty("list of subjects (keywords) that characterise this community") @Schema("list of subjects (keywords) that characterise this community")
private List<String> subjects; private List<String> subjects;
@ApiModelProperty("status of the community, drives its visibility") @Schema("status of the community, drives its visibility")
private CommunityStatus status; private CommunityStatus status;
@ApiModelProperty("id of the main Zenodo community") @Schema("id of the main Zenodo community")
private String mainZenodoCommunity; private String mainZenodoCommunity;

View File

@ -9,15 +9,15 @@ import io.swagger.annotations.ApiModelProperty;
public class CommunityZenodoCommunity { public class CommunityZenodoCommunity {
@NotNull @NotNull
@ApiModelProperty(value = "the community identifier this zenodo Community belongs to", required = true) @Schema(value = "the community identifier this zenodo Community belongs to", required = true)
private String communityId; private String communityId;
@NotNull @NotNull
@ApiModelProperty(value = "Zenodo identifier for this community", required = true) @Schema(value = "Zenodo identifier for this community", required = true)
private String zenodoid; private String zenodoid;
@NotNull @NotNull
@ApiModelProperty(value = "identifies this zenodo community within the context it belongs to", required = true) @Schema(value = "identifies this zenodo community within the context it belongs to", required = true)
private String id; private String id;
public String getZenodoid() { public String getZenodoid() {

View File

@ -20,27 +20,27 @@ public class ContextApiController {
private ContextApiCore contextApiCore; private ContextApiCore contextApiCore;
@RequestMapping(value = "/contexts", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/contexts", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "list brief information about all the context profiles", value = "list brief information about all the context profiles",
notes = "list brief information about all the context profiles.", notes = "list brief information about all the context profiles.",
tags = { }, tags = { },
response = ContextSummary[].class) response = ContextSummary[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = ContextSummary[].class), @ApiResponse(responseCode = "200", description = "OK", response = ContextSummary[].class),
@ApiResponse(code = 500, message = "unexpected error", response = ContextException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = ContextException.class) })
public List<ContextSummary> listContexts(@RequestParam(required = false, defaultValue = "") List<String> type) throws ContextException { public List<ContextSummary> listContexts(@RequestParam(required = false, defaultValue = "") List<String> type) throws ContextException {
return contextApiCore.listContexts(type); return contextApiCore.listContexts(type);
} }
@RequestMapping(value = "/context/{contextId}", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/context/{contextId}", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "list the categories defined within a context", value = "list the categories defined within a context",
notes = "list the categories defined within a context", notes = "list the categories defined within a context",
tags = { }, tags = { },
response = CategorySummary[].class) response = CategorySummary[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = CategorySummary[].class), @ApiResponse(responseCode = "200", description = "OK", response = CategorySummary[].class),
@ApiResponse(code = 500, message = "unexpected error", response = ContextException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = ContextException.class) })
public List<CategorySummary> listCategories( public List<CategorySummary> listCategories(
@PathVariable final String contextId, @PathVariable final String contextId,
@RequestParam(required = false, defaultValue = "false") final Boolean all) throws ContextException { @RequestParam(required = false, defaultValue = "false") final Boolean all) throws ContextException {
@ -50,14 +50,14 @@ public class ContextApiController {
} }
@RequestMapping(value = "/context/category/{categoryId}", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/context/category/{categoryId}", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "list the concepts defined within a category", value = "list the concepts defined within a category",
notes = "list the concepts defined within a category", notes = "list the concepts defined within a category",
tags = { }, tags = { },
response = ConceptSummary[].class) response = ConceptSummary[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = ConceptSummary[].class), @ApiResponse(responseCode = "200", description = "OK", response = ConceptSummary[].class),
@ApiResponse(code = 500, message = "unexpected error", response = ContextException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = ContextException.class) })
public List<ConceptSummary> listConcepts( public List<ConceptSummary> listConcepts(
@PathVariable final String categoryId, @PathVariable final String categoryId,
@RequestParam(required = false, defaultValue = "false") final Boolean all) throws ContextException { @RequestParam(required = false, defaultValue = "false") final Boolean all) throws ContextException {
@ -67,14 +67,14 @@ public class ContextApiController {
} }
@RequestMapping(value = "/context/category/concept/{conceptId}", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/context/category/concept/{conceptId}", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "list the concepts defined within a category", value = "list the concepts defined within a category",
notes = "list the concepts defined within a category", notes = "list the concepts defined within a category",
tags = { }, tags = { },
response = ConceptSummary[].class) response = ConceptSummary[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = ConceptSummary[].class), @ApiResponse(responseCode = "200", description = "OK", response = ConceptSummary[].class),
@ApiResponse(code = 500, message = "unexpected error", response = ContextException.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = ContextException.class) })
public List<ConceptSummary> listSubConcepts( public List<ConceptSummary> listSubConcepts(
@PathVariable final String conceptId, @PathVariable final String conceptId,
@RequestParam(required = false, defaultValue = "false") final Boolean all) throws ContextException { @RequestParam(required = false, defaultValue = "false") final Boolean all) throws ContextException {

View File

@ -61,12 +61,12 @@ public class DsmApiController extends AbstractExporterController {
@RequestMapping(value = "/ds/countries", produces = { @RequestMapping(value = "/ds/countries", produces = {
"application/json" "application/json"
}, method = RequestMethod.GET) }, method = RequestMethod.GET)
@ApiOperation(value = "list the datasource countries", notes = "list the datasource countries", tags = { @Operation(summary = "list the datasource countries", notes = "list the datasource countries", tags = {
DS, R DS, R
}, response = Country[].class) }, response = Country[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = Country[].class), @ApiResponse(responseCode = "200", description = "OK", response = Country[].class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public List<Country> listCountries() throws DsmException { public List<Country> listCountries() throws DsmException {
return dsmCore.listCountries(); return dsmCore.listCountries();
@ -75,12 +75,12 @@ public class DsmApiController extends AbstractExporterController {
@RequestMapping(value = "/ds/searchdetails/{page}/{size}", produces = { @RequestMapping(value = "/ds/searchdetails/{page}/{size}", produces = {
"application/json" "application/json"
}, method = RequestMethod.POST) }, method = RequestMethod.POST)
@ApiOperation(value = "search datasources", notes = "Returns list of Datasource details.", tags = { @Operation(summary = "search datasources", notes = "Returns list of Datasource details.", tags = {
DS, R DS, R
}, response = DatasourceDetailResponse.class) }, response = DatasourceDetailResponse.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = DatasourceDetailResponse.class), @ApiResponse(responseCode = "200", description = "OK", response = DatasourceDetailResponse.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public DatasourceDetailResponse searchDsDetails( public DatasourceDetailResponse searchDsDetails(
@RequestParam final RequestSort requestSortBy, @RequestParam final RequestSort requestSortBy,
@ -96,12 +96,12 @@ public class DsmApiController extends AbstractExporterController {
@RequestMapping(value = "/ds/aggregationhistory/{dsId}", produces = { @RequestMapping(value = "/ds/aggregationhistory/{dsId}", produces = {
"application/json" "application/json"
}, method = RequestMethod.GET) }, method = RequestMethod.GET)
@ApiOperation(value = "search datasources", notes = "Returns list of Datasource details.", tags = { @Operation(summary = "search datasources", notes = "Returns list of Datasource details.", tags = {
DS, R DS, R
}, response = AggregationHistoryResponse.class) }, response = AggregationHistoryResponse.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = AggregationHistoryResponse.class), @ApiResponse(responseCode = "200", description = "OK", response = AggregationHistoryResponse.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public AggregationHistoryResponse aggregationHistory(@PathVariable final String dsId) throws DsmException { public AggregationHistoryResponse aggregationHistory(@PathVariable final String dsId) throws DsmException {
final StopWatch stop = StopWatch.createStarted(); final StopWatch stop = StopWatch.createStarted();
@ -112,12 +112,12 @@ public class DsmApiController extends AbstractExporterController {
@RequestMapping(value = "/ds/searchsnippet/{page}/{size}", produces = { @RequestMapping(value = "/ds/searchsnippet/{page}/{size}", produces = {
"application/json" "application/json"
}, method = RequestMethod.POST) }, method = RequestMethod.POST)
@ApiOperation(value = "search datasources", notes = "Returns list of Datasource basic info.", tags = { @Operation(summary = "search datasources", notes = "Returns list of Datasource basic info.", tags = {
DS, R DS, R
}, response = DatasourceSnippetResponse.class) }, response = DatasourceSnippetResponse.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = DatasourceSnippetResponse.class), @ApiResponse(responseCode = "200", description = "OK", response = DatasourceSnippetResponse.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public DatasourceSnippetResponse searchSnippet( public DatasourceSnippetResponse searchSnippet(
@RequestParam final RequestSort requestSortBy, @RequestParam final RequestSort requestSortBy,
@ -133,13 +133,13 @@ public class DsmApiController extends AbstractExporterController {
@RequestMapping(value = "/ds/searchregistered/{page}/{size}", produces = { @RequestMapping(value = "/ds/searchregistered/{page}/{size}", produces = {
"application/json" "application/json"
}, method = RequestMethod.POST) }, method = RequestMethod.POST)
@ApiOperation(value = "search among registered datasources", notes = "Returns list of Datasource basic info.", tags = { @Operation(summary = "search among registered datasources", notes = "Returns list of Datasource basic info.", tags = {
DS, DS,
R R
}, response = DatasourceSnippetResponse.class) }, response = DatasourceSnippetResponse.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = DatasourceSnippetResponse.class), @ApiResponse(responseCode = "200", description = "OK", response = DatasourceSnippetResponse.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public DatasourceSnippetResponse searchRegistered( public DatasourceSnippetResponse searchRegistered(
@RequestParam final RequestSort requestSortBy, @RequestParam final RequestSort requestSortBy,
@ -155,13 +155,13 @@ public class DsmApiController extends AbstractExporterController {
@RequestMapping(value = "/ds/recentregistered/{size}", produces = { @RequestMapping(value = "/ds/recentregistered/{size}", produces = {
"application/json" "application/json"
}, method = RequestMethod.GET) }, method = RequestMethod.GET)
@ApiOperation(value = "return the latest datasources that were registered through Provide", notes = "Returns list of Datasource basic info.", tags = { @Operation(summary = "return the latest datasources that were registered through Provide", notes = "Returns list of Datasource basic info.", tags = {
DS, DS,
R R
}, response = SimpleResponse.class) }, response = SimpleResponse.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = DatasourceResponse.class), @ApiResponse(responseCode = "200", description = "OK", response = DatasourceResponse.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public SimpleResponse<?> recentRegistered(@PathVariable final int size) throws Throwable { public SimpleResponse<?> recentRegistered(@PathVariable final int size) throws Throwable {
final StopWatch stop = StopWatch.createStarted(); final StopWatch stop = StopWatch.createStarted();
@ -172,13 +172,13 @@ public class DsmApiController extends AbstractExporterController {
@RequestMapping(value = "/ds/countregistered", produces = { @RequestMapping(value = "/ds/countregistered", produces = {
"application/json" "application/json"
}, method = RequestMethod.GET) }, method = RequestMethod.GET)
@ApiOperation(value = "return the number of datasources registered after the given date", notes = "Returns a number.", tags = { @Operation(summary = "return the number of datasources registered after the given date", notes = "Returns a number.", tags = {
DS, DS,
R R
}, response = Long.class) }, response = Long.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = Long.class), @ApiResponse(responseCode = "200", description = "OK", response = Long.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public Long countRegistered(@RequestParam final String fromDate, public Long countRegistered(@RequestParam final String fromDate,
@RequestParam(required = false) final String typologyFilter) throws Throwable { @RequestParam(required = false) final String typologyFilter) throws Throwable {
@ -188,13 +188,13 @@ public class DsmApiController extends AbstractExporterController {
@RequestMapping(value = "/ds/api/{dsId}", produces = { @RequestMapping(value = "/ds/api/{dsId}", produces = {
"application/json" "application/json"
}, method = RequestMethod.GET) }, method = RequestMethod.GET)
@ApiOperation(value = "get the list of API for a given datasource", notes = "Returns the list of API for a given datasource.", tags = { @Operation(summary = "get the list of API for a given datasource", notes = "Returns the list of API for a given datasource.", tags = {
API, API,
R R
}, response = ApiDetailsResponse.class) }, response = ApiDetailsResponse.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = ApiDetailsResponse.class), @ApiResponse(responseCode = "200", description = "OK", response = ApiDetailsResponse.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public ApiDetailsResponse getApi( public ApiDetailsResponse getApi(
@PathVariable final String dsId) throws DsmException { @PathVariable final String dsId) throws DsmException {
@ -207,12 +207,12 @@ public class DsmApiController extends AbstractExporterController {
@RequestMapping(value = "/api/baseurl/{page}/{size}", produces = { @RequestMapping(value = "/api/baseurl/{page}/{size}", produces = {
"application/json" "application/json"
}, method = RequestMethod.POST) }, method = RequestMethod.POST)
@ApiOperation(value = "search for the list of base URLs of Datasource APIs managed by a user", notes = "Returns the list of base URLs of Datasource APIs managed by a user", tags = { @Operation(summary = "search for the list of base URLs of Datasource APIs managed by a user", notes = "Returns the list of base URLs of Datasource APIs managed by a user", tags = {
DS, API, R DS, API, R
}, response = String[].class) }, response = String[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = String[].class), @ApiResponse(responseCode = "200", description = "OK", response = String[].class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public List<String> searchBaseUrls( public List<String> searchBaseUrls(
@RequestBody final RequestFilter requestFilter, @RequestBody final RequestFilter requestFilter,
@ -223,26 +223,26 @@ public class DsmApiController extends AbstractExporterController {
} }
@RequestMapping(value = "/ds/api/{apiId}", method = RequestMethod.DELETE) @RequestMapping(value = "/ds/api/{apiId}", method = RequestMethod.DELETE)
@ApiOperation(value = "delete an API", notes = "delete an API, if removable", tags = { @Operation(summary = "delete an API", notes = "delete an API, if removable", tags = {
API, W API, W
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 400, message = "Api not found", response = ErrorMessage.class), @ApiResponse(responseCode = "400", description = "Api not found", response = ErrorMessage.class),
@ApiResponse(code = 403, message = "Api not removable", response = ErrorMessage.class), @ApiResponse(responseCode = "403", description = "Api not removable", response = ErrorMessage.class),
@ApiResponse(code = 500, message = "DSM Server error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "DSM Server error", response = ErrorMessage.class)
}) })
public void deleteApi(@PathVariable final String apiId) throws DsmForbiddenException, DsmNotFoundException { public void deleteApi(@PathVariable final String apiId) throws DsmForbiddenException, DsmNotFoundException {
dsmCore.deleteApi(apiId); dsmCore.deleteApi(apiId);
} }
@RequestMapping(value = "/ds/manage", method = RequestMethod.POST) @RequestMapping(value = "/ds/manage", method = RequestMethod.POST)
@ApiOperation(value = "set the managed status for a given datasource", notes = "set the managed status for a given datasource", tags = { @Operation(summary = "set the managed status for a given datasource", notes = "set the managed status for a given datasource", tags = {
DS, W DS, W
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public void setManaged( public void setManaged(
@RequestParam final String id, @RequestParam final String id,
@ -252,25 +252,25 @@ public class DsmApiController extends AbstractExporterController {
} }
@RequestMapping(value = "/ds/managed/{id}", method = RequestMethod.GET) @RequestMapping(value = "/ds/managed/{id}", method = RequestMethod.GET)
@ApiOperation(value = "get the datasource managed status", notes = "get the datasource managed status", tags = { @Operation(summary = "get the datasource managed status", notes = "get the datasource managed status", tags = {
DS, R DS, R
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public boolean isManaged(@PathVariable final String id) throws DsmException { public boolean isManaged(@PathVariable final String id) throws DsmException {
return dsmCore.isManaged(id); return dsmCore.isManaged(id);
} }
@RequestMapping(value = "/ds/add", method = RequestMethod.POST) @RequestMapping(value = "/ds/add", method = RequestMethod.POST)
@ApiOperation(value = "add a new Datasource", notes = "add a new Datasource", tags = { @Operation(summary = "add a new Datasource", notes = "add a new Datasource", tags = {
DS, W DS, W
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 400, message = "Malformed request", response = ErrorMessage[].class), @ApiResponse(responseCode = "400", description = "Malformed request", response = ErrorMessage[].class),
@ApiResponse(code = 500, message = "Unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "Unexpected error", response = ErrorMessage.class)
}) })
public void saveDs(@Valid @RequestBody final DatasourceDetails datasource) throws DsmException { public void saveDs(@Valid @RequestBody final DatasourceDetails datasource) throws DsmException {
@ -281,13 +281,13 @@ public class DsmApiController extends AbstractExporterController {
} }
@RequestMapping(value = "/ds/addWithApis", method = RequestMethod.POST) @RequestMapping(value = "/ds/addWithApis", method = RequestMethod.POST)
@ApiOperation(value = "add a new Datasource and its apis", notes = "add a new Datasource and its apis", tags = { @Operation(summary = "add a new Datasource and its apis", notes = "add a new Datasource and its apis", tags = {
DS, W DS, W
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 400, message = "Malformed request", response = ErrorMessage[].class), @ApiResponse(responseCode = "400", description = "Malformed request", response = ErrorMessage[].class),
@ApiResponse(code = 500, message = "Unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "Unexpected error", response = ErrorMessage.class)
}) })
public void saveDsWithApis(@Valid @RequestBody final DatasourceDetailsWithApis d) throws DsmException { public void saveDsWithApis(@Valid @RequestBody final DatasourceDetailsWithApis d) throws DsmException {
if (d.getDatasource() == null) { throw new DsmException(HttpStatus.SC_BAD_REQUEST, "Datasource field is null"); } if (d.getDatasource() == null) { throw new DsmException(HttpStatus.SC_BAD_REQUEST, "Datasource field is null"); }
@ -298,12 +298,12 @@ public class DsmApiController extends AbstractExporterController {
} }
@RequestMapping(value = "/ds/update", method = RequestMethod.POST) @RequestMapping(value = "/ds/update", method = RequestMethod.POST)
@ApiOperation(value = "update Datasource details", notes = "update Datasource details", tags = { @Operation(summary = "update Datasource details", notes = "update Datasource details", tags = {
DS, W DS, W
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public void updateDatasource( public void updateDatasource(
@RequestBody final DatasourceDetailsUpdate ds) throws DsmException, DsmNotFoundException { @RequestBody final DatasourceDetailsUpdate ds) throws DsmException, DsmNotFoundException {
@ -312,12 +312,12 @@ public class DsmApiController extends AbstractExporterController {
} }
@RequestMapping(value = "/ds/api/baseurl", method = RequestMethod.POST) @RequestMapping(value = "/ds/api/baseurl", method = RequestMethod.POST)
@ApiOperation(value = "update the base URL of a datasource interface", notes = "update the base URL of a datasource interface", tags = { @Operation(summary = "update the base URL of a datasource interface", notes = "update the base URL of a datasource interface", tags = {
API, W API, W
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public void updateBaseUrl( public void updateBaseUrl(
@RequestParam final String dsId, @RequestParam final String dsId,
@ -328,12 +328,12 @@ public class DsmApiController extends AbstractExporterController {
} }
@RequestMapping(value = "/ds/api/compliance", method = RequestMethod.POST) @RequestMapping(value = "/ds/api/compliance", method = RequestMethod.POST)
@ApiOperation(value = "update the compatibility of a datasource interface", notes = "update the compatibility of a datasource interface", tags = { @Operation(summary = "update the compatibility of a datasource interface", notes = "update the compatibility of a datasource interface", tags = {
API, W API, W
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public void updateCompliance( public void updateCompliance(
@RequestParam final String dsId, @RequestParam final String dsId,
@ -345,12 +345,12 @@ public class DsmApiController extends AbstractExporterController {
} }
@RequestMapping(value = "/ds/api/oaiset", method = RequestMethod.POST) @RequestMapping(value = "/ds/api/oaiset", method = RequestMethod.POST)
@ApiOperation(value = "update the OAI set of a datasource interface", notes = "update the OAI set of a datasource interface", tags = { @Operation(summary = "update the OAI set of a datasource interface", notes = "update the OAI set of a datasource interface", tags = {
API, W API, W
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public void updateOaiSetl( public void updateOaiSetl(
@RequestParam final String dsId, @RequestParam final String dsId,
@ -361,12 +361,12 @@ public class DsmApiController extends AbstractExporterController {
} }
@RequestMapping(value = "/ds/api/add", method = RequestMethod.POST) @RequestMapping(value = "/ds/api/add", method = RequestMethod.POST)
@ApiOperation(value = "adds a new Interface to one Datasource", notes = "adds an Interface to one Datasource", tags = { @Operation(summary = "adds a new Interface to one Datasource", notes = "adds an Interface to one Datasource", tags = {
API, W API, W
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public void addApi(@RequestBody final ApiDetails api) throws DsmException { public void addApi(@RequestBody final ApiDetails api) throws DsmException {
if (StringUtils.isBlank(api.getDatasource())) { throw new DsmException(HttpStatus.SC_BAD_REQUEST, "missing datasource id"); } if (StringUtils.isBlank(api.getDatasource())) { throw new DsmException(HttpStatus.SC_BAD_REQUEST, "missing datasource id"); }
@ -379,36 +379,36 @@ public class DsmApiController extends AbstractExporterController {
private OperationManager operationManager; private OperationManager operationManager;
@RequestMapping(value = "/dsm/ops", method = RequestMethod.GET) @RequestMapping(value = "/dsm/ops", method = RequestMethod.GET)
@ApiOperation(value = "get the number of pending operations", notes = "get the number of pending operations", tags = { @Operation(summary = "get the number of pending operations", notes = "get the number of pending operations", tags = {
R, M R, M
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public int getOps() throws DsmException { public int getOps() throws DsmException {
return operationManager.getOpSize(); return operationManager.getOpSize();
} }
@RequestMapping(value = "/dsm/killops", method = RequestMethod.POST) @RequestMapping(value = "/dsm/killops", method = RequestMethod.POST)
@ApiOperation(value = "interrupts the pending operations", notes = "return the number of interrupted operations", tags = { @Operation(summary = "interrupts the pending operations", notes = "return the number of interrupted operations", tags = {
W, M W, M
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public int killOps() throws DsmException { public int killOps() throws DsmException {
return operationManager.dropAll(); return operationManager.dropAll();
} }
@RequestMapping(value = "/dsm/dropcache", method = RequestMethod.POST) @RequestMapping(value = "/dsm/dropcache", method = RequestMethod.POST)
@ApiOperation(value = "drop the caches", notes = "drop the internal caches", tags = { @Operation(summary = "drop the caches", notes = "drop the internal caches", tags = {
W, M W, M
}) })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"), @ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public void dropCache() throws DsmException { public void dropCache() throws DsmException {
dsmCore.dropCaches(); dsmCore.dropCaches();

View File

@ -7,11 +7,11 @@ import io.swagger.annotations.ApiModelProperty;
import java.util.List; import java.util.List;
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public class AggregationHistoryResponse extends Response { public class AggregationHistoryResponse extends Response {
@ApiModelProperty(position = 1) @Schema(position = 1)
private List<AggregationInfo> aggregationInfo; private List<AggregationInfo> aggregationInfo;
public AggregationHistoryResponse(List<AggregationInfo> aggregationInfo) { public AggregationHistoryResponse(List<AggregationInfo> aggregationInfo) {

View File

@ -9,61 +9,61 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@JsonAutoDetect @JsonAutoDetect
@ApiModel(value = "Api model", description = "provides information about the datasource API") @Schema(value = "Api model", description = "provides information about the datasource API")
public class ApiDetails extends ApiIgnoredProperties { public class ApiDetails extends ApiIgnoredProperties {
@ApiModelProperty(position = 0) @Schema(position = 0)
private String id = null; private String id = null;
@ApiModelProperty(position = 1) @Schema(position = 1)
private String protocol = null; private String protocol = null;
@ApiModelProperty(position = 2) @Schema(position = 2)
private String datasource = null; private String datasource = null;
@ApiModelProperty(position = 3) @Schema(position = 3)
private String contentdescription = null; private String contentdescription = null;
@ApiModelProperty(position = 4) @Schema(position = 4)
private String eoscDatasourceType = null; private String eoscDatasourceType = null;
@ApiModelProperty(position = 5) @Schema(position = 5)
private String compatibility; private String compatibility;
@ApiModelProperty(position = 7) @Schema(position = 7)
private String compatibilityOverride; private String compatibilityOverride;
@ApiModelProperty(position = 8) @Schema(position = 8)
private Integer lastCollectionTotal; private Integer lastCollectionTotal;
@ApiModelProperty(position = 9) @Schema(position = 9)
private Date lastCollectionDate; private Date lastCollectionDate;
@ApiModelProperty(position = 10) @Schema(position = 10)
private Integer lastAggregationTotal; private Integer lastAggregationTotal;
@ApiModelProperty(position = 11) @Schema(position = 11)
private Date lastAggregationDate; private Date lastAggregationDate;
@ApiModelProperty(position = 12) @Schema(position = 12)
private Integer lastDownloadTotal; private Integer lastDownloadTotal;
@ApiModelProperty(position = 13) @Schema(position = 13)
private Date lastDownloadDate; private Date lastDownloadDate;
@ApiModelProperty(position = 14) @Schema(position = 14)
private String baseurl; private String baseurl;
@ApiModelProperty(position = 15) @Schema(position = 15)
protected Boolean removable = false; protected Boolean removable = false;
@ApiModelProperty(position = 16) @Schema(position = 16)
private Set<ApiParamDetails> apiParams; private Set<ApiParamDetails> apiParams;
@ApiModelProperty(position = 17) @Schema(position = 17)
private String metadataIdentifierPath = ""; private String metadataIdentifierPath = "";
@ApiModelProperty(position = 18) @Schema(position = 18)
private String typology = null; private String typology = null;
public String getId() { public String getId() {

View File

@ -6,11 +6,11 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public class ApiDetailsResponse extends Response { public class ApiDetailsResponse extends Response {
@ApiModelProperty(position = 1) @Schema(position = 1)
private List<ApiDetails> api; private List<ApiDetails> api;
public List<ApiDetails> getApi() { public List<ApiDetails> getApi() {

View File

@ -8,7 +8,7 @@ import io.swagger.annotations.ApiModel;
/** /**
* Created by claudio on 29/11/2016. * Created by claudio on 29/11/2016.
*/ */
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public class CollectionInfo extends AggregationInfo { public class CollectionInfo extends AggregationInfo {

View File

@ -6,7 +6,7 @@ import io.swagger.annotations.ApiModel;
/** /**
* Created by claudio on 12/09/16. * Created by claudio on 12/09/16.
*/ */
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public enum CollectionMode { public enum CollectionMode {
REFRESH, INCREMENTAL REFRESH, INCREMENTAL

View File

@ -6,11 +6,11 @@ import io.swagger.annotations.ApiModelProperty;
import java.util.List; import java.util.List;
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public class DatasourceDetailResponse extends Response { public class DatasourceDetailResponse extends Response {
@ApiModelProperty(position = 1) @Schema(position = 1)
private List<DatasourceDetails> datasourceInfo; private List<DatasourceDetails> datasourceInfo;
public DatasourceDetailResponse(List<DatasourceDetails> datasourceInfo) { public DatasourceDetailResponse(List<DatasourceDetails> datasourceInfo) {

View File

@ -16,121 +16,121 @@ import io.swagger.annotations.ApiModelProperty;
* Created by claudio on 12/09/16. * Created by claudio on 12/09/16.
*/ */
@JsonAutoDetect @JsonAutoDetect
@ApiModel(value = "Datasource model", description = "provides information about the datasource") @Schema(value = "Datasource model", description = "provides information about the datasource")
public class DatasourceDetails extends DatasourceIgnoredProperties { public class DatasourceDetails extends DatasourceIgnoredProperties {
@NotBlank @NotBlank
@ApiModelProperty(position = 0) @Schema(position = 0)
private String id; private String id;
@Transient @Transient
@ApiModelProperty(position = 1) @Schema(position = 1)
private String openaireId; private String openaireId;
@NotBlank @NotBlank
@ApiModelProperty(position = 2) @Schema(position = 2)
private String officialname; private String officialname;
@NotBlank @NotBlank
@ApiModelProperty(position = 3) @Schema(position = 3)
private String englishname; private String englishname;
@ApiModelProperty(position = 4) @Schema(position = 4)
private String websiteurl; private String websiteurl;
@ApiModelProperty(position = 5) @Schema(position = 5)
private String logourl; private String logourl;
@Email @Email
@ApiModelProperty(position = 6) @Schema(position = 6)
private String contactemail; private String contactemail;
@ApiModelProperty(position = 7) @Schema(position = 7)
private Double latitude; private Double latitude;
@ApiModelProperty(position = 8) @Schema(position = 8)
private Double longitude; private Double longitude;
@ApiModelProperty(position = 9) @Schema(position = 9)
private String timezone; private String timezone;
@NotBlank @NotBlank
@ApiModelProperty(position = 10) @Schema(position = 10)
private String namespaceprefix; private String namespaceprefix;
@ApiModelProperty(position = 11) @Schema(position = 11)
private String languages; private String languages;
@ApiModelProperty(position = 12) @Schema(position = 12)
private Date dateofvalidation; private Date dateofvalidation;
@NotBlank @NotBlank
@ApiModelProperty(position = 13) @Schema(position = 13)
private String eoscDatasourceType; private String eoscDatasourceType;
@ApiModelProperty(position = 14) @Schema(position = 14)
private Date dateofcollection; private Date dateofcollection;
@ApiModelProperty(position = 15) @Schema(position = 15)
private String platform; private String platform;
@ApiModelProperty(position = 16) @Schema(position = 16)
private String activationId; private String activationId;
@ApiModelProperty(position = 17) @Schema(position = 17)
private String description; private String description;
@ApiModelProperty(position = 18) @Schema(position = 18)
private String issn; private String issn;
@ApiModelProperty(position = 19) @Schema(position = 19)
private String eissn; private String eissn;
@ApiModelProperty(position = 20) @Schema(position = 20)
private String lissn; private String lissn;
@Email @Email
@ApiModelProperty(position = 21) @Schema(position = 21)
private String registeredby; private String registeredby;
@ApiModelProperty(position = 22) @Schema(position = 22)
private String subjects; private String subjects;
@ApiModelProperty(position = 23) @Schema(position = 23)
protected String aggregator = "OPENAIRE"; protected String aggregator = "OPENAIRE";
@ApiModelProperty(position = 24) @Schema(position = 24)
protected String collectedfrom; protected String collectedfrom;
@ApiModelProperty(position = 25) @Schema(position = 25)
private Boolean managed; private Boolean managed;
@ApiModelProperty(position = 28) @Schema(position = 28)
private Boolean consentTermsOfUse; private Boolean consentTermsOfUse;
@ApiModelProperty(position = 29) @Schema(position = 29)
private Boolean fullTextDownload; private Boolean fullTextDownload;
@ApiModelProperty(position = 30) @Schema(position = 30)
private Date consentTermsOfUseDate; private Date consentTermsOfUseDate;
@ApiModelProperty(position = 31) @Schema(position = 31)
private Date lastConsentTermsOfUseDate; private Date lastConsentTermsOfUseDate;
@ApiModelProperty(position = 26) @Schema(position = 26)
private Set<OrganizationDetails> organizations; private Set<OrganizationDetails> organizations;
@ApiModelProperty(position = 27) @Schema(position = 27)
private Set<IdentitiesDetails> identities; private Set<IdentitiesDetails> identities;
@ApiModelProperty(position = 32) @Schema(position = 32)
private String status; private String status;
@Deprecated @Deprecated
@ApiModelProperty(position = 33) @Schema(position = 33)
private String typology; private String typology;
@ApiModelProperty(position = 34) @Schema(position = 34)
private Date registrationdate; private Date registrationdate;
public String getId() { public String getId() {

View File

@ -15,73 +15,73 @@ import io.swagger.annotations.ApiModelProperty;
* Created by claudio on 12/09/16. * Created by claudio on 12/09/16.
*/ */
@JsonAutoDetect @JsonAutoDetect
@ApiModel(value = "Datasource updatable fields model", description = "provides information about the datasource field that can be updated") @Schema(value = "Datasource updatable fields model", description = "provides information about the datasource field that can be updated")
public class DatasourceDetailsUpdate { public class DatasourceDetailsUpdate {
@NotBlank @NotBlank
@ApiModelProperty(position = 0) @Schema(position = 0)
private String id; private String id;
@NotBlank @NotBlank
@ApiModelProperty(position = 2) @Schema(position = 2)
private String officialname; private String officialname;
@NotBlank @NotBlank
@ApiModelProperty(position = 3) @Schema(position = 3)
private String englishname; private String englishname;
@ApiModelProperty(position = 4) @Schema(position = 4)
private String websiteurl; private String websiteurl;
@ApiModelProperty(position = 5) @Schema(position = 5)
private String logourl; private String logourl;
@Email @Email
@ApiModelProperty(position = 6) @Schema(position = 6)
private String contactemail; private String contactemail;
@ApiModelProperty(position = 7) @Schema(position = 7)
private Double latitude; private Double latitude;
@ApiModelProperty(position = 8) @Schema(position = 8)
private Double longitude; private Double longitude;
@ApiModelProperty(position = 9) @Schema(position = 9)
private String timezone; private String timezone;
@Deprecated @Deprecated
@ApiModelProperty(position = 12) @Schema(position = 12)
private String typology; private String typology;
@ApiModelProperty(position = 13) @Schema(position = 13)
private String eoscDatasourceType; private String eoscDatasourceType;
@ApiModelProperty(position = 15) @Schema(position = 15)
private String platform; private String platform;
@ApiModelProperty(position = 17) @Schema(position = 17)
private String description; private String description;
@Email @Email
@ApiModelProperty(position = 21) @Schema(position = 21)
private String registeredby; private String registeredby;
@ApiModelProperty(position = 25) @Schema(position = 25)
private Boolean managed; private Boolean managed;
@ApiModelProperty(position = 27) @Schema(position = 27)
private Set<IdentitiesDetails> identities; private Set<IdentitiesDetails> identities;
@ApiModelProperty(position = 28) @Schema(position = 28)
private Boolean consentTermsOfUse; private Boolean consentTermsOfUse;
@ApiModelProperty(position = 29) @Schema(position = 29)
private Date consentTermsOfUseDate; private Date consentTermsOfUseDate;
@ApiModelProperty(position = 29) @Schema(position = 29)
private Date lastConsentTermsOfUseDate; private Date lastConsentTermsOfUseDate;
@ApiModelProperty(position = 31) @Schema(position = 31)
private Boolean fullTextDownload; private Boolean fullTextDownload;
public String getId() { public String getId() {

View File

@ -12,10 +12,10 @@ import io.swagger.annotations.ApiModelProperty;
* Created by claudio on 12/09/16. * Created by claudio on 12/09/16.
*/ */
@JsonAutoDetect @JsonAutoDetect
@ApiModel(value = "Datasource model with apis", description = "provides information about the datasource and its apis") @Schema(value = "Datasource model with apis", description = "provides information about the datasource and its apis")
public class DatasourceDetailsWithApis { public class DatasourceDetailsWithApis {
@ApiModelProperty(position = 1) @Schema(position = 1)
private DatasourceDetails datasource; private DatasourceDetails datasource;
public DatasourceDetails getDatasource() { public DatasourceDetails getDatasource() {
@ -26,7 +26,7 @@ public class DatasourceDetailsWithApis {
this.datasource = datasource; this.datasource = datasource;
} }
@ApiModelProperty(position = 2) @Schema(position = 2)
private List<ApiDetails> apis = new ArrayList<>(); private List<ApiDetails> apis = new ArrayList<>();
public List<ApiDetails> getApis() { public List<ApiDetails> getApis() {

View File

@ -8,34 +8,34 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@JsonAutoDetect @JsonAutoDetect
@ApiModel(value = "Datasource info model", description = "provides information about the datasource and its aggregation status") @Schema(value = "Datasource info model", description = "provides information about the datasource and its aggregation status")
public class DatasourceInfo { public class DatasourceInfo {
@ApiModelProperty(position = 0) @Schema(position = 0)
private long indexRecords; private long indexRecords;
@ApiModelProperty(position = 1) @Schema(position = 1)
private long fundedContent; private long fundedContent;
@ApiModelProperty(position = 2) @Schema(position = 2)
private long fulltexts; private long fulltexts;
@ApiModelProperty(position = 3) @Schema(position = 3)
private String lastIndexingDate; private String lastIndexingDate;
@ApiModelProperty(position = 4) @Schema(position = 4)
private String firstHarvestDate; private String firstHarvestDate;
@ApiModelProperty(position = 5) @Schema(position = 5)
private DatasourceDetails datasource; private DatasourceDetails datasource;
@ApiModelProperty(position = 6) @Schema(position = 6)
private AggregationInfo lastCollection; private AggregationInfo lastCollection;
@ApiModelProperty(position = 7) @Schema(position = 7)
private AggregationInfo lastTransformation; private AggregationInfo lastTransformation;
@ApiModelProperty(position = 8) @Schema(position = 8)
private List<AggregationInfo> aggregationHistory; private List<AggregationInfo> aggregationHistory;
public DatasourceInfo() { public DatasourceInfo() {

View File

@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public class DatasourceResponse<T> extends Response { public class DatasourceResponse<T> extends Response {

View File

@ -6,11 +6,11 @@ import io.swagger.annotations.ApiModelProperty;
import java.util.List; import java.util.List;
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public class DatasourceSearchResponse extends Response { public class DatasourceSearchResponse extends Response {
@ApiModelProperty(position = 1) @Schema(position = 1)
private List<DatasourceInfo> datasourceInfo; private List<DatasourceInfo> datasourceInfo;
public DatasourceSearchResponse(List<DatasourceInfo> datasourceInfo) { public DatasourceSearchResponse(List<DatasourceInfo> datasourceInfo) {

View File

@ -8,19 +8,19 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@JsonAutoDetect @JsonAutoDetect
@ApiModel(value = "Datasource model", description = "provides information about the datasource") @Schema(value = "Datasource model", description = "provides information about the datasource")
public class DatasourceSnippet { public class DatasourceSnippet {
@NotBlank @NotBlank
@ApiModelProperty(position = 0) @Schema(position = 0)
private String id; private String id;
@NotBlank @NotBlank
@ApiModelProperty(position = 2) @Schema(position = 2)
private String officialname; private String officialname;
@NotBlank @NotBlank
@ApiModelProperty(position = 3) @Schema(position = 3)
private String englishname; private String englishname;
public String getId() { public String getId() {

View File

@ -12,57 +12,57 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@JsonAutoDetect @JsonAutoDetect
@ApiModel(value = "Datasource model", description = "provides extended information about the datasource") @Schema(value = "Datasource model", description = "provides extended information about the datasource")
public class DatasourceSnippetExtended { public class DatasourceSnippetExtended {
@NotBlank @NotBlank
@ApiModelProperty(position = 0) @Schema(position = 0)
private String id; private String id;
@NotBlank @NotBlank
@ApiModelProperty(position = 2) @Schema(position = 2)
private String officialname; private String officialname;
@NotBlank @NotBlank
@ApiModelProperty(position = 3) @Schema(position = 3)
private String englishname; private String englishname;
@ApiModelProperty(position = 4) @Schema(position = 4)
private String websiteurl; private String websiteurl;
@Email @Email
@ApiModelProperty(position = 5) @Schema(position = 5)
private String registeredby; private String registeredby;
@ApiModelProperty(position = 6) @Schema(position = 6)
private Date registrationdate; private Date registrationdate;
@ApiModelProperty(position = 7) @Schema(position = 7)
private String eoscDatasourceType; private String eoscDatasourceType;
@ApiModelProperty(position = 8) @Schema(position = 8)
private String logoUrl; private String logoUrl;
@ApiModelProperty(position = 9) @Schema(position = 9)
private String description; private String description;
@ApiModelProperty(position = 10) @Schema(position = 10)
private Boolean consentTermsOfUse; private Boolean consentTermsOfUse;
@ApiModelProperty(position = 11) @Schema(position = 11)
private Date consentTermsOfUseDate; private Date consentTermsOfUseDate;
@ApiModelProperty(position = 12) @Schema(position = 12)
private Date lastConsentTermsOfUseDate; private Date lastConsentTermsOfUseDate;
@ApiModelProperty(position = 13) @Schema(position = 13)
private Boolean fullTextDownload; private Boolean fullTextDownload;
@ApiModelProperty(position = 14) @Schema(position = 14)
private Set<OrganizationDetails> organizations; private Set<OrganizationDetails> organizations;
@Deprecated @Deprecated
@ApiModelProperty(position = 15) @Schema(position = 15)
private String typology; private String typology;
public String getId() { public String getId() {

View File

@ -6,11 +6,11 @@ import io.swagger.annotations.ApiModelProperty;
import java.util.List; import java.util.List;
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public class DatasourceSnippetResponse extends Response { public class DatasourceSnippetResponse extends Response {
@ApiModelProperty(position = 1) @Schema(position = 1)
private List<DatasourceSnippetExtended> datasourceInfo; private List<DatasourceSnippetExtended> datasourceInfo;
public DatasourceSnippetResponse(List<DatasourceSnippetExtended> datasourceInfo) { public DatasourceSnippetResponse(List<DatasourceSnippetExtended> datasourceInfo) {

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@JsonAutoDetect @JsonAutoDetect
@ApiModel(value = "Filter name", description = "List of the field names used to filter datasources") @Schema(value = "Filter name", description = "List of the field names used to filter datasources")
public enum FilterName { public enum FilterName {
id, id,

View File

@ -11,26 +11,26 @@ import com.google.gson.GsonBuilder;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public class Header { public class Header {
@ApiModelProperty(position = 0) @Schema(position = 0)
private long total; private long total;
@ApiModelProperty(position = 1) @Schema(position = 1)
private int page; private int page;
@ApiModelProperty(position = 2) @Schema(position = 2)
private int size; private int size;
@ApiModelProperty(position = 3) @Schema(position = 3)
private long time; private long time;
@ApiModelProperty(position = 4) @Schema(position = 4)
private int statusCode; private int statusCode;
@ApiModelProperty(position = 5) @Schema(position = 5)
private List<String> errors = Lists.newArrayList(); private List<String> errors = Lists.newArrayList();
@JsonIgnore @JsonIgnore

View File

@ -3,7 +3,7 @@ package eu.dnetlib.openaire.dsm.domain;
import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonAutoDetect;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public class IdentitiesDetails { public class IdentitiesDetails {

View File

@ -8,24 +8,24 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@JsonAutoDetect @JsonAutoDetect
@ApiModel(value = "Organization info model", description = "provides information about the organization") @Schema(value = "Organization info model", description = "provides information about the organization")
public class OrganizationDetails extends OrganizationIgnoredProperties { public class OrganizationDetails extends OrganizationIgnoredProperties {
@ApiModelProperty(position = 0) @Schema(position = 0)
private String legalshortname; private String legalshortname;
@NotBlank @NotBlank
@ApiModelProperty(position = 1) @Schema(position = 1)
private String legalname; private String legalname;
@ApiModelProperty(position = 2) @Schema(position = 2)
private String websiteurl; private String websiteurl;
@ApiModelProperty(position = 3) @Schema(position = 3)
private String logourl; private String logourl;
@NotBlank @NotBlank
@ApiModelProperty(position = 4) @Schema(position = 4)
private String country; private String country;
public String getLegalshortname() { public String getLegalshortname() {

View File

@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@JsonAutoDetect @JsonAutoDetect
@ApiModel(value = "Request filter", description = "field name and value pairs") @Schema(value = "Request filter", description = "field name and value pairs")
public class RequestFilter extends HashMap<FilterName, Object> { public class RequestFilter extends HashMap<FilterName, Object> {
/** /**

View File

@ -5,12 +5,12 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@JsonAutoDetect @JsonAutoDetect
@ApiModel( @Schema(
value = "Api response model", value = "Api response model",
description = "Api response model, provides a response header") description = "Api response model, provides a response header")
public class Response { public class Response {
@ApiModelProperty(position = 0) @Schema(position = 0)
private Header header; private Header header;
public Response() { public Response() {

View File

@ -7,11 +7,11 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public class SimpleResponse<T> extends Response { public class SimpleResponse<T> extends Response {
@ApiModelProperty(position = 1) @Schema(position = 1)
private List<T> response; private List<T> response;
public List<T> getResponse() { public List<T> getResponse() {

View File

@ -8,7 +8,7 @@ import io.swagger.annotations.ApiModel;
/** /**
* Created by claudio on 29/11/2016. * Created by claudio on 29/11/2016.
*/ */
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public class TransformationInfo extends AggregationInfo { public class TransformationInfo extends AggregationInfo {

View File

@ -15,7 +15,7 @@ import io.swagger.annotations.ApiModel;
@Entity @Entity
@Table(name = "dsm_apiparams") @Table(name = "dsm_apiparams")
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@ApiModel(value = "Datasource Api params model", description = "describes the datasource api params") @Schema(value = "Datasource Api params model", description = "describes the datasource api params")
public class ApiParamDbEntry implements ApiParam { public class ApiParamDbEntry implements ApiParam {
@EmbeddedId @EmbeddedId

View File

@ -14,7 +14,7 @@ import io.swagger.annotations.ApiModel;
*/ */
@Entity @Entity
@Table(name = "browse_countries") @Table(name = "browse_countries")
@ApiModel @Schema
@JsonAutoDetect @JsonAutoDetect
public class CountryTerm implements Comparable<CountryTerm>, BrowseTerm { public class CountryTerm implements Comparable<CountryTerm>, BrowseTerm {

View File

@ -13,7 +13,7 @@ import io.swagger.annotations.ApiModel;
@Entity @Entity
@JsonAutoDetect @JsonAutoDetect
@Table(name = "dsm_datasource_api") @Table(name = "dsm_datasource_api")
@ApiModel(value = "DatasourceApi model", description = "describes a joint view between datasources and their API (1:N)") @Schema(value = "DatasourceApi model", description = "describes a joint view between datasources and their API (1:N)")
public class DatasourceApiDbEntry { public class DatasourceApiDbEntry {
@Id @Id

View File

@ -27,13 +27,13 @@ public class FundersApiController extends AbstractExporterController {
private FunderDao fDao; private FunderDao fDao;
@RequestMapping(value = "/funders", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/funders", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "get basic information about funders", value = "get basic information about funders",
notes = "basic information about funders: id, name, shortname, last update date, registration date", notes = "basic information about funders: id, name, shortname, last update date, registration date",
response = FunderDetails[].class) response = FunderDetails[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = FunderDetails[].class), @ApiResponse(responseCode = "200", description = "OK", response = FunderDetails[].class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class) })
public List<FunderDetails> getFunders( public List<FunderDetails> getFunders(
@PathVariable final int page, @PathVariable final int page,
@PathVariable final int size) throws FundersApiException { @PathVariable final int size) throws FundersApiException {
@ -42,10 +42,10 @@ public class FundersApiController extends AbstractExporterController {
} }
@RequestMapping(value = "/funder/{id}", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/funder/{id}", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation(value = "get the funder details", notes = "complete funder information", response = FunderDbEntry.class) @Operation(summary = "get the funder details", notes = "complete funder information", response = FunderDbEntry.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = FunderDbEntry.class), @ApiResponse(responseCode = "200", description = "OK", response = FunderDbEntry.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class) })
public ExtendedFunderDetails getFunderDetails( public ExtendedFunderDetails getFunderDetails(
@PathVariable final String id) throws FundersApiException { @PathVariable final String id) throws FundersApiException {
@ -53,10 +53,10 @@ public class FundersApiController extends AbstractExporterController {
} }
@RequestMapping(value = "/funder/ids", produces = { "application/json" }, method = RequestMethod.GET) @RequestMapping(value = "/funder/ids", produces = { "application/json" }, method = RequestMethod.GET)
@ApiOperation(value = "get the list of funder ids", notes = "get the list of funder ids", response = String[].class) @Operation(summary = "get the list of funder ids", notes = "get the list of funder ids", response = String[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = String[].class), @ApiResponse(responseCode = "200", description = "OK", response = String[].class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class) })
public List<String> getFunderIds( public List<String> getFunderIds(
@PathVariable final int page, @PathVariable final int page,
@PathVariable final int size @PathVariable final int size

View File

@ -41,12 +41,12 @@ public class InfoController extends AbstractExporterController {
@RequestMapping(value = "/info/{infoKey}", produces = { @RequestMapping(value = "/info/{infoKey}", produces = {
"application/json" "application/json"
}, method = RequestMethod.GET) }, method = RequestMethod.GET)
@ApiOperation(value = "get info date", notes = "get info date", tags = { @Operation(summary = "get info date", notes = "get info date", tags = {
ExporterConstants.R ExporterConstants.R
}, response = LocalDate.class) }, response = LocalDate.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = LocalDate.class), @ApiResponse(responseCode = "200", description = "OK", response = LocalDate.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public LocalDate getDate(@PathVariable final String infoKey) { public LocalDate getDate(@PathVariable final String infoKey) {
final JdbcInfoDao.DATE_INFO info = JdbcInfoDao.DATE_INFO.valueOf(infoKey); final JdbcInfoDao.DATE_INFO info = JdbcInfoDao.DATE_INFO.valueOf(infoKey);
@ -57,12 +57,12 @@ public class InfoController extends AbstractExporterController {
@RequestMapping(value = "/info", produces = { @RequestMapping(value = "/info", produces = {
"application/json" "application/json"
}, method = RequestMethod.GET) }, method = RequestMethod.GET)
@ApiOperation(value = "get all the info date", notes = "get all the info date", tags = { @Operation(summary = "get all the info date", notes = "get all the info date", tags = {
ExporterConstants.R ExporterConstants.R
}, response = Map.class) }, response = Map.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = LocalDate.class), @ApiResponse(responseCode = "200", description = "OK", response = LocalDate.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public Map<String, LocalDate> listInfo() { public Map<String, LocalDate> listInfo() {
final Map<String, LocalDate> map = Maps.newHashMap(); final Map<String, LocalDate> map = Maps.newHashMap();
@ -75,12 +75,12 @@ public class InfoController extends AbstractExporterController {
@RequestMapping(value = "/info/keys", produces = { @RequestMapping(value = "/info/keys", produces = {
"application/json" "application/json"
}, method = RequestMethod.GET) }, method = RequestMethod.GET)
@ApiOperation(value = "get the available keys", notes = "get the available keys", tags = { @Operation(summary = "get the available keys", notes = "get the available keys", tags = {
ExporterConstants.R ExporterConstants.R
}, response = String.class, responseContainer = "List") }, response = String.class, responseContainer = "List")
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = LocalDate.class), @ApiResponse(responseCode = "200", description = "OK", response = LocalDate.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class)
}) })
public List<String> listInfoKeys() { public List<String> listInfoKeys() {
final List<String> keys = Lists.newArrayList(); final List<String> keys = Lists.newArrayList();
@ -93,7 +93,7 @@ public class InfoController extends AbstractExporterController {
@RequestMapping(value = "/info/dropCache", produces = { @RequestMapping(value = "/info/dropCache", produces = {
"application/json" "application/json"
}, method = RequestMethod.GET) }, method = RequestMethod.GET)
@ApiOperation(value = "Drops the info cache", notes = "Drops the info cache", tags = { @Operation(summary = "Drops the info cache", notes = "Drops the info cache", tags = {
ExporterConstants.R ExporterConstants.R
}) })
public void dropCache() { public void dropCache() {

View File

@ -58,14 +58,14 @@ public class ProjectsController extends AbstractExporterController {
private ProjectQueryParamsFactory projectQueryParamsFactory; private ProjectQueryParamsFactory projectQueryParamsFactory;
@RequestMapping(value = "/export/**/project/dspace.do", method = RequestMethod.GET) @RequestMapping(value = "/export/**/project/dspace.do", method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "DSpace", value = "DSpace",
notes = "return project information in compatible with the OpenAIRE plugin for DSpace", notes = "return project information in compatible with the OpenAIRE plugin for DSpace",
tags = { ExporterConstants.DSPACE }, tags = { ExporterConstants.DSPACE },
response = String.class) response = String.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = String.class), @ApiResponse(responseCode = "200", description = "OK", response = String.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class) })
public void processDspace(final HttpServletRequest request, final ServletResponse response, public void processDspace(final HttpServletRequest request, final ServletResponse response,
@RequestParam(value = "startFrom", required = false) final String startFrom, @RequestParam(value = "startFrom", required = false) final String startFrom,
@RequestParam(value = "startUntil", required = false) final String startUntil, @RequestParam(value = "startUntil", required = false) final String startUntil,
@ -86,14 +86,14 @@ public class ProjectsController extends AbstractExporterController {
} }
@RequestMapping(value = "/export/**/project/eprints.do", method = RequestMethod.GET) @RequestMapping(value = "/export/**/project/eprints.do", method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "EPrints", value = "EPrints",
notes = "return project information in compatible with the OpenAIRE plugin for Eprints", notes = "return project information in compatible with the OpenAIRE plugin for Eprints",
tags = { ExporterConstants.EPRINT }, tags = { ExporterConstants.EPRINT },
response = String.class) response = String.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = String.class), @ApiResponse(responseCode = "200", description = "OK", response = String.class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class) })
public void processEprints(final HttpServletRequest request, final ServletResponse response, public void processEprints(final HttpServletRequest request, final ServletResponse response,
@RequestParam(value = "startFrom", required = false) final String startFrom, @RequestParam(value = "startFrom", required = false) final String startFrom,
@RequestParam(value = "startUntil", required = false) final String startUntil, @RequestParam(value = "startUntil", required = false) final String startUntil,
@ -122,14 +122,14 @@ public class ProjectsController extends AbstractExporterController {
} }
@RequestMapping(value = "/noads/project2tsv.do", method = RequestMethod.GET) @RequestMapping(value = "/noads/project2tsv.do", method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "TSV", value = "TSV",
notes = "download project information in TSV format", notes = "download project information in TSV format",
tags = { ExporterConstants.TSV }, tags = { ExporterConstants.TSV },
response = ProjectTsv[].class) response = ProjectTsv[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = ProjectTsv[].class), @ApiResponse(responseCode = "200", description = "OK", response = ProjectTsv[].class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class) })
public void processTsv(final HttpServletResponse response, public void processTsv(final HttpServletResponse response,
@RequestParam(value = "funding", required = true) final String funding, @RequestParam(value = "funding", required = true) final String funding,
@RequestParam(value = "article293", required = false) final Boolean article293) throws Exception { @RequestParam(value = "article293", required = false) final Boolean article293) throws Exception {
@ -148,14 +148,14 @@ public class ProjectsController extends AbstractExporterController {
} }
@RequestMapping(value = "/export/streamProjectDetails.do", method = RequestMethod.GET) @RequestMapping(value = "/export/streamProjectDetails.do", method = RequestMethod.GET)
@ApiOperation( @Operation(
value = "Stream projects", value = "Stream projects",
notes = "stream project information", notes = "stream project information",
tags = { ExporterConstants.STREAMING }, tags = { ExporterConstants.STREAMING },
response = ProjectDetails[].class) response = ProjectDetails[].class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK", response = ProjectDetails[].class), @ApiResponse(responseCode = "200", description = "OK", response = ProjectDetails[].class),
@ApiResponse(code = 500, message = "unexpected error", response = ErrorMessage.class) }) @ApiResponse(responseCode = "500", description = "unexpected error", response = ErrorMessage.class) })
public void streamProjectDetails(final HttpServletResponse response, public void streamProjectDetails(final HttpServletResponse response,
@RequestParam(value = "format", required = true) final String format, @RequestParam(value = "format", required = true) final String format,
@RequestParam(value = "compress", required = false) final Boolean compress) throws IOException, SQLException { @RequestParam(value = "compress", required = false) final Boolean compress) throws IOException, SQLException {

View File

@ -17,7 +17,7 @@ import org.apache.commons.lang3.StringUtils;
*/ */
@Entity @Entity
@Table(name = "projects_api") @Table(name = "projects_api")
@ApiModel(value = "Project api model", description = "Project api model used by DSpace and Eprints exporter") @Schema(value = "Project api model", description = "Project api model used by DSpace and Eprints exporter")
public class ProjectApi { public class ProjectApi {
public static final String INFO_EU_REPO_GRANT_AGREEMENT = "info:eu-repo/grantAgreement/"; public static final String INFO_EU_REPO_GRANT_AGREEMENT = "info:eu-repo/grantAgreement/";

View File

@ -27,7 +27,7 @@ import org.supercsv.util.CsvContext;
*/ */
@Entity @Entity
@Table(name = "project_details") @Table(name = "project_details")
@ApiModel(value = "Project details model", description = "provides project details") @Schema(value = "Project details model", description = "provides project details")
public class ProjectDetails { public class ProjectDetails {
@Transient @Transient

View File

@ -17,7 +17,7 @@ import org.apache.commons.lang3.StringUtils;
*/ */
@Entity @Entity
@Table(name = "projects_tsv") @Table(name = "projects_tsv")
@ApiModel(value = "Project TSV model", description = "project TSV model description") @Schema(value = "Project TSV model", description = "project TSV model description")
public class ProjectTsv { public class ProjectTsv {
@Id @Id

View File

@ -7,11 +7,11 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import eu.dnetlib.common.app.AbstractDnetApp; import eu.dnetlib.common.app.AbstractDnetApp;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication @SpringBootApplication
@EnableSwagger2 @EnableSwagger2

View File

@ -12,12 +12,12 @@ import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.time.Duration; import java.time.Duration;
import java.util.Arrays; import java.util.Arrays;

View File

@ -22,7 +22,7 @@ import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/v1") @RequestMapping("/v1")
@Api(tags = { @Tag(tags = {
"Datasources" "Datasources"
}) })
public class DatasourceV1 extends AbstractDnetController { public class DatasourceV1 extends AbstractDnetController {

View File

@ -19,7 +19,7 @@ import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/v2") @RequestMapping("/v2")
@Api(tags = { @Tag(tags = {
"LinkProvider : Operation related to the Link Provider" "LinkProvider : Operation related to the Link Provider"
}) })
public class LinkProviderV2 { public class LinkProviderV2 {

View File

@ -19,7 +19,7 @@ import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/v2/LinkPublisher") @RequestMapping("/v2/LinkPublisher")
@Api(tags = { @Tag(tags = {
"LinkPublisher : Operation related to the Link Publisher" "LinkPublisher : Operation related to the Link Publisher"
}) })
public class LinkPublisherV2 { public class LinkPublisherV2 {

View File

@ -26,7 +26,7 @@ import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/v1") @RequestMapping("/v1")
@Api(tags = {"Scholix"}) @Tag(tags = {"Scholix"})
public class ScholixControllerV1 extends AbstractDnetController { public class ScholixControllerV1 extends AbstractDnetController {
@Autowired @Autowired

View File

@ -24,7 +24,7 @@ import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/v2") @RequestMapping("/v2")
@Api(tags = { @Tag(tags = {
"Links : Operation related to the Scholix Links" "Links : Operation related to the Scholix Links"
}) })
public class ScholixControllerV2 extends AbstractDnetController { public class ScholixControllerV2 extends AbstractDnetController {
@ -33,7 +33,7 @@ public class ScholixControllerV2 extends AbstractDnetController {
private ScholixIndexManager manager; private ScholixIndexManager manager;
@Timed(value = "scholix.v2.links", description = "Time taken to return links on Version 2.0 of Scholix") @Timed(value = "scholix.v2.links", description = "Time taken to return links on Version 2.0 of Scholix")
@ApiOperation("Get Scholix Links") @Operation(summary = "Get Scholix Links")
@GetMapping("/Links") @GetMapping("/Links")
public PageResultType links( public PageResultType links(
@Parameter(in = ParameterIn.QUERY, @Parameter(in = ParameterIn.QUERY,

View File

@ -41,8 +41,8 @@
<!-- Swagger --> <!-- Swagger -->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>org.springdoc</groupId>
<artifactId>springfox-boot-starter</artifactId> <artifactId>springdoc-openapi-ui</artifactId>
</dependency> </dependency>
<!-- for /metrics and /health controllers --> <!-- for /metrics and /health controllers -->

View File

@ -17,8 +17,7 @@ import org.springframework.core.io.ClassPathResource;
import io.micrometer.core.instrument.ImmutableTag; import io.micrometer.core.instrument.ImmutableTag;
import io.micrometer.core.instrument.Metrics; import io.micrometer.core.instrument.Metrics;
import springfox.documentation.spi.DocumentationType; import io.swagger.v3.oas.models.OpenAPI;
import springfox.documentation.spring.web.plugins.Docket;
public abstract class AbstractDnetApp { public abstract class AbstractDnetApp {
@ -46,16 +45,14 @@ public abstract class AbstractDnetApp {
} }
@Bean @Bean
public Docket newSwaggerDocket() { public OpenAPI newSwaggerDocket() {
log.info("Initializing SWAGGER..."); final OpenAPI openAPI = new OpenAPI();
final Docket docket = new Docket(DocumentationType.SWAGGER_2); configSwagger(openAPI);
configSwagger(docket); return openAPI;
return docket;
} }
protected abstract void configSwagger(final Docket docket); protected abstract void configSwagger(final OpenAPI openAPI);
} }

View File

@ -66,8 +66,8 @@
<!-- Swagger --> <!-- Swagger -->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>org.springdoc</groupId>
<artifactId>springfox-boot-starter</artifactId> <artifactId>springdoc-openapi-ui</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>

10
pom.xml
View File

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>dnet-applications</artifactId> <artifactId>dnet-applications</artifactId>
<version>3.2.10-SNAPSHOT</version> <version>3.2.9-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<licenses> <licenses>
@ -247,12 +247,11 @@
<!-- Swagger --> <!-- Swagger -->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>org.springdoc</groupId>
<artifactId>springfox-boot-starter</artifactId> <artifactId>springdoc-openapi-ui</artifactId>
<version>3.0.0</version> <version>1.6.10</version>
</dependency> </dependency>
<!-- Hadoop --> <!-- Hadoop -->
<dependency> <dependency>
<groupId>org.apache.hadoop</groupId> <groupId>org.apache.hadoop</groupId>
@ -450,7 +449,6 @@
<dhp-schemas-version>2.11.33</dhp-schemas-version> <dhp-schemas-version>2.11.33</dhp-schemas-version>
<apache.solr.version>7.1.0</apache.solr.version> <apache.solr.version>7.1.0</apache.solr.version>
<mongodb.driver.version>3.4.2</mongodb.driver.version> <mongodb.driver.version>3.4.2</mongodb.driver.version>
<springfox-version>2.8.0</springfox-version>
<prometheus.version>0.10.0</prometheus.version> <prometheus.version>0.10.0</prometheus.version>
<javamelody.version>1.71.0</javamelody.version> <javamelody.version>1.71.0</javamelody.version>
<maven.javadoc.failOnError>false</maven.javadoc.failOnError> <maven.javadoc.failOnError>false</maven.javadoc.failOnError>