2019-08-02 10:27:12 +02:00
|
|
|
package eu.eudat.controllers;
|
|
|
|
|
|
|
|
import eu.eudat.data.query.items.item.project.ProjectCriteriaRequest;
|
|
|
|
import eu.eudat.logic.managers.ProjectManager;
|
|
|
|
import eu.eudat.logic.proxy.config.exceptions.HugeResultSet;
|
|
|
|
import eu.eudat.logic.proxy.config.exceptions.NoURLFound;
|
|
|
|
import eu.eudat.logic.services.ApiContext;
|
|
|
|
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
|
|
|
import eu.eudat.models.data.project.Project;
|
|
|
|
import eu.eudat.models.data.security.Principal;
|
|
|
|
import eu.eudat.types.ApiMessageCode;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@CrossOrigin
|
|
|
|
@RequestMapping(value = {"/api/projects/"})
|
2019-08-02 17:21:00 +02:00
|
|
|
public class Projects extends BaseController {
|
2019-08-02 10:27:12 +02:00
|
|
|
private ProjectManager projectManager;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
public Projects(ApiContext apiContext, ProjectManager projectManager) {
|
|
|
|
super(apiContext);
|
|
|
|
this.projectManager = projectManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(method = RequestMethod.POST, value = {"/external"}, consumes = "application/json", produces = "application/json")
|
|
|
|
public @ResponseBody
|
2019-08-02 17:21:00 +02:00
|
|
|
ResponseEntity<ResponseItem<List<Project>>> getWithExternal(@RequestBody ProjectCriteriaRequest projectCriteria, Principal principal) throws NoURLFound, InstantiationException, HugeResultSet, IllegalAccessException {
|
|
|
|
List<Project> dataTable = this.projectManager.getCriteriaWithExternal(projectCriteria, principal);
|
2019-08-02 10:27:12 +02:00
|
|
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<eu.eudat.models.data.project.Project>>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE));
|
|
|
|
}
|
|
|
|
}
|