Revision 57130
Added by Michele Artini over 4 years ago
OrganizationController.java | ||
---|---|---|
24 | 24 |
import eu.dnetlib.organizations.repository.readonly.OrganizationSimpleViewRepository; |
25 | 25 |
import eu.dnetlib.organizations.repository.readonly.OrganizationViewRepository; |
26 | 26 |
import eu.dnetlib.organizations.utils.DatabaseUtils; |
27 |
import eu.dnetlib.organizations.utils.RelationType; |
|
27 | 28 |
|
28 | 29 |
@RestController |
29 | 30 |
@RequestMapping("/api/organizations") |
... | ... | |
55 | 56 |
return organizationViewRepository.findRelations(id); |
56 | 57 |
} |
57 | 58 |
|
59 |
@RequestMapping(value = "/relations", method = RequestMethod.PUT) |
|
60 |
public List<RelationByOrg> addRelation(@RequestParam final String from, @RequestParam final String to, @RequestParam final RelationType type) { |
|
61 |
if (from.equals(to)) { throw new IllegalArgumentException("Invalid relation !!!"); } |
|
62 |
|
|
63 |
databaseUtils.addRelation(from, to, type); |
|
64 |
return organizationViewRepository.findRelations(from); |
|
65 |
} |
|
66 |
|
|
67 |
@RequestMapping(value = "/relations", method = RequestMethod.DELETE) |
|
68 |
public List<RelationByOrg> deleteRelation(@RequestParam final String from, @RequestParam final String to, @RequestParam final RelationType type) { |
|
69 |
if (from.equals(to)) { throw new IllegalArgumentException("Invalid relation !!!"); } |
|
70 |
|
|
71 |
databaseUtils.deleteRelation(from, to, type); |
|
72 |
return organizationViewRepository.findRelations(from); |
|
73 |
} |
|
74 |
|
|
58 | 75 |
@RequestMapping(value = "/similarities", method = RequestMethod.GET) |
59 | 76 |
public List<OpenaireSimRel> findSimilaritiesById(@RequestParam final String id) { |
60 | 77 |
return openaireSimRelRepository.findByLocalId(id); |
Also available in: Unified diff