2022-06-24 14:34:03 +02:00
|
|
|
package eu.dnetlib.is.context;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
2023-02-06 15:53:07 +01:00
|
|
|
import eu.dnetlib.errors.InformationServiceException;
|
2023-02-06 15:31:21 +01:00
|
|
|
import eu.dnetlib.is.model.context.Category;
|
|
|
|
import eu.dnetlib.is.model.context.Context;
|
|
|
|
import eu.dnetlib.is.model.context.CtxChildInfo;
|
2022-06-24 14:34:03 +02:00
|
|
|
|
|
|
|
@RestController
|
2022-12-05 11:04:54 +01:00
|
|
|
@RequestMapping("/ajax/contexts")
|
|
|
|
public class ContextAjaxController extends AbstractContextController {
|
2022-06-24 14:34:03 +02:00
|
|
|
|
|
|
|
@GetMapping("/{ctxId}")
|
2022-11-28 11:11:13 +01:00
|
|
|
public Context getContext(@PathVariable final String ctxId) throws InformationServiceException {
|
|
|
|
return contextService.getContext(ctxId);
|
2022-06-24 14:34:03 +02:00
|
|
|
}
|
|
|
|
|
2022-06-24 15:44:53 +02:00
|
|
|
@GetMapping("/{parent}/categories")
|
|
|
|
public Iterable<Category> listCategories(@PathVariable final String parent) {
|
2022-11-28 11:11:13 +01:00
|
|
|
return contextService.listCategories(parent);
|
2022-06-24 15:44:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/{level}/{parent}/concepts")
|
2022-11-28 11:11:13 +01:00
|
|
|
public Iterable<? extends CtxChildInfo> listCategories(@PathVariable final int level, @PathVariable final String parent)
|
|
|
|
throws InformationServiceException {
|
2022-11-28 12:12:04 +01:00
|
|
|
return contextService.listConcepts(level, parent);
|
2022-06-24 14:34:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|