Newer
Older
Sonia Zorba
committed
import it.inaf.ia2.aa.data.User;
import net.ivoa.xml.vospace.v2.Node;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import it.inaf.oats.vospace.persistence.NodeDAO;
import java.util.List;
Sonia Zorba
committed
import org.springframework.web.bind.annotation.PutMapping;
Sonia Zorba
committed
public class CreateNodeController extends BaseNodeController {
Sonia Zorba
committed
@Autowired
private NodeDAO nodeDao;
@PutMapping(value = {"/nodes", "/nodes/**"},
consumes = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE},
Sonia Zorba
committed
produces = {MediaType.APPLICATION_XML_VALUE, MediaType.APPLICATION_JSON_VALUE})
public Node createNode(@RequestBody Node node, User principal) {
String path = getPath();
Sonia Zorba
committed
List<String> userGroups = principal.getGroups();
nodeDao.createNode(node);
return node;