Loading src/main/java/it/inaf/oats/vospace/CollectionsController.java +8 −6 Original line number Original line Diff line number Diff line Loading @@ -6,6 +6,7 @@ package it.inaf.oats.vospace; package it.inaf.oats.vospace; import it.inaf.ia2.aa.data.User; import it.inaf.ia2.aa.data.User; import it.inaf.oats.vospace.datamodel.collections.NodeCollection; import it.inaf.oats.vospace.datamodel.collections.NodeCollectionsWrapper; import it.inaf.oats.vospace.datamodel.collections.NodeCollectionsWrapper; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.Logger; Loading @@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController; /** /** Loading Loading @@ -47,11 +49,11 @@ public class CollectionsController { // create a new collection with specified title // create a new collection with specified title @PutMapping(value = "/collections") @PutMapping(value = "/collections") public ResponseEntity<String> createCollection( public ResponseEntity<String> createCollection( @RequestBody String collectionName, User principal) { @RequestBody NodeCollection nc, User principal) { LOG.debug("create collection called with name {} called for user {}", LOG.debug("create collection called with name {} called for user {}", collectionName, principal.getName()); nc.getTitle(), principal.getName()); collectionsService.createNewCollection(collectionName, principal.getName()); collectionsService.createNewCollection(nc.getTitle(), principal.getName()); return ResponseEntity.ok("Collection created"); return ResponseEntity.ok("Collection created"); } } Loading @@ -59,11 +61,11 @@ public class CollectionsController { // delete collection by id // delete collection by id @DeleteMapping(value = "/collections") @DeleteMapping(value = "/collections") public ResponseEntity<String> deleteCollection( public ResponseEntity<String> deleteCollection( @RequestBody Long collectionId, User principal) { @RequestParam("id") Long id, User principal) { LOG.debug("delete collection called with id {} for user {}", LOG.debug("delete collection called with id {} for user {}", collectionId, principal.getName()); id, principal.getName()); collectionsService.deleteCollectionById(collectionId, principal.getName()); collectionsService.deleteCollectionById(id, principal.getName()); return ResponseEntity.ok("Collection deleted"); return ResponseEntity.ok("Collection deleted"); Loading Loading
src/main/java/it/inaf/oats/vospace/CollectionsController.java +8 −6 Original line number Original line Diff line number Diff line Loading @@ -6,6 +6,7 @@ package it.inaf.oats.vospace; package it.inaf.oats.vospace; import it.inaf.ia2.aa.data.User; import it.inaf.ia2.aa.data.User; import it.inaf.oats.vospace.datamodel.collections.NodeCollection; import it.inaf.oats.vospace.datamodel.collections.NodeCollectionsWrapper; import it.inaf.oats.vospace.datamodel.collections.NodeCollectionsWrapper; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.Logger; Loading @@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController; /** /** Loading Loading @@ -47,11 +49,11 @@ public class CollectionsController { // create a new collection with specified title // create a new collection with specified title @PutMapping(value = "/collections") @PutMapping(value = "/collections") public ResponseEntity<String> createCollection( public ResponseEntity<String> createCollection( @RequestBody String collectionName, User principal) { @RequestBody NodeCollection nc, User principal) { LOG.debug("create collection called with name {} called for user {}", LOG.debug("create collection called with name {} called for user {}", collectionName, principal.getName()); nc.getTitle(), principal.getName()); collectionsService.createNewCollection(collectionName, principal.getName()); collectionsService.createNewCollection(nc.getTitle(), principal.getName()); return ResponseEntity.ok("Collection created"); return ResponseEntity.ok("Collection created"); } } Loading @@ -59,11 +61,11 @@ public class CollectionsController { // delete collection by id // delete collection by id @DeleteMapping(value = "/collections") @DeleteMapping(value = "/collections") public ResponseEntity<String> deleteCollection( public ResponseEntity<String> deleteCollection( @RequestBody Long collectionId, User principal) { @RequestParam("id") Long id, User principal) { LOG.debug("delete collection called with id {} for user {}", LOG.debug("delete collection called with id {} for user {}", collectionId, principal.getName()); id, principal.getName()); collectionsService.deleteCollectionById(collectionId, principal.getName()); collectionsService.deleteCollectionById(id, principal.getName()); return ResponseEntity.ok("Collection deleted"); return ResponseEntity.ok("Collection deleted"); Loading