package rest.entities; import java.util.List; import java.util.UUID; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import dao.entities.DatasetProfileDao; import dao.entities.DatasetProfileRulesetDao; import dao.entities.DatasetProfileViewstyleDao; import helpers.SerializerProvider; import managers.AdminManager; import managers.UserManager; @RestController @CrossOrigin public class DatasetProfileController { @Autowired private DatasetProfileDao datasetProfileDao; @Autowired private DatasetProfileRulesetDao datasetProfileRulesetDao; @Autowired private DatasetProfileViewstyleDao datasetProfileViewstyleDao; @RequestMapping(method = RequestMethod.GET, value = { "/datasetprofile/get/{id}" }, produces="application/json") public ResponseEntity get(@PathVariable String id){ try { entities.DatasetProfile profile = datasetProfileDao.read(UUID.fromString(id)); models.user.composite.DatasetProfile datasetprofile = UserManager.generateDatasetProfileModel(profile); return ResponseEntity.status(HttpStatus.OK).body(datasetprofile); } catch(Exception ex) { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Serialization issue: "+ex.getMessage()); } } }