Removes obsolete services Grant direct create or update and Grant delete.

This commit is contained in:
gkolokythas 2019-10-04 11:57:43 +03:00
parent 5fab3fb9d1
commit cf16779010
2 changed files with 8 additions and 8 deletions

View File

@ -60,21 +60,21 @@ public class Grants extends BaseController {
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.models.data.grant.Grant>().payload(grant).status(ApiMessageCode.NO_MESSAGE)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.models.data.grant.Grant>().payload(grant).status(ApiMessageCode.NO_MESSAGE));
} }
@Transactional /*@Transactional
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
public @ResponseBody public @ResponseBody
ResponseEntity<ResponseItem<Grant>> addGrant(@Valid @RequestBody eu.eudat.models.data.grant.Grant grant, Principal principal) throws IOException, ParseException { ResponseEntity<ResponseItem<Grant>> addGrant(@Valid @RequestBody eu.eudat.models.data.grant.Grant grant, Principal principal) throws IOException, ParseException {
this.grantManager.createOrUpdate(grant, principal); this.grantManager.createOrUpdate(grant, principal);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.data.entities.Grant>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created")); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.data.entities.Grant>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created"));
} }*/
@Transactional /*@Transactional
@RequestMapping(method = RequestMethod.DELETE, value = {"{id}"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.DELETE, value = {"{id}"}, consumes = "application/json", produces = "application/json")
public @ResponseBody public @ResponseBody
ResponseEntity<ResponseItem<Grant>> inactivate(@PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException { ResponseEntity<ResponseItem<Grant>> inactivate(@PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException {
this.grantManager.inactivate(id); this.grantManager.inactivate(id);
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.data.entities.Grant>().status(ApiMessageCode.SUCCESS_MESSAGE)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.data.entities.Grant>().status(ApiMessageCode.SUCCESS_MESSAGE));
} }*/
@RequestMapping(method = RequestMethod.POST, value = {"/external"}, consumes = "application/json", produces = "application/json") @RequestMapping(method = RequestMethod.POST, value = {"/external"}, consumes = "application/json", produces = "application/json")
public @ResponseBody public @ResponseBody

View File

@ -102,13 +102,13 @@ public class GrantManager {
return grant; return grant;
} }
public eu.eudat.data.entities.Grant inactivate(String id) throws InstantiationException, IllegalAccessException { /*public eu.eudat.data.entities.Grant inactivate(String id) throws InstantiationException, IllegalAccessException {
GrantDao grantRepository = databaseRepository.getGrantDao(); GrantDao grantRepository = databaseRepository.getGrantDao();
eu.eudat.data.entities.Grant grant = grantRepository.find(UUID.fromString(id)); eu.eudat.data.entities.Grant grant = grantRepository.find(UUID.fromString(id));
grant.setStatus(eu.eudat.data.entities.Grant.Status.DELETED.getValue()); grant.setStatus(eu.eudat.data.entities.Grant.Status.DELETED.getValue());
grant = grantRepository.createOrUpdate(grant); grant = grantRepository.createOrUpdate(grant);
return grant; return grant;
} }*/
public List<eu.eudat.models.data.grant.Grant> getCriteriaWithExternal(GrantCriteriaRequest grantCriteria, Principal principal) throws IllegalAccessException, InstantiationException, HugeResultSet, NoURLFound { public List<eu.eudat.models.data.grant.Grant> getCriteriaWithExternal(GrantCriteriaRequest grantCriteria, Principal principal) throws IllegalAccessException, InstantiationException, HugeResultSet, NoURLFound {
eu.eudat.data.entities.UserInfo userInfo = new eu.eudat.data.entities.UserInfo(); eu.eudat.data.entities.UserInfo userInfo = new eu.eudat.data.entities.UserInfo();
@ -155,7 +155,7 @@ public class GrantManager {
return grants; return grants;
} }
public void createOrUpdate(eu.eudat.models.data.grant.Grant grant, Principal principal) throws ParseException, IOException { /*public void createOrUpdate(eu.eudat.models.data.grant.Grant grant, Principal principal) throws ParseException, IOException {
eu.eudat.data.entities.Grant grantEntity = grant.toDataModel(); eu.eudat.data.entities.Grant grantEntity = grant.toDataModel();
if (grant.getFiles() != null) { if (grant.getFiles() != null) {
for (ContentFile file : grant.getFiles()) { for (ContentFile file : grant.getFiles()) {
@ -176,7 +176,7 @@ public class GrantManager {
grantEntity.setType(eu.eudat.data.entities.Grant.GrantType.INTERNAL.getValue()); grantEntity.setType(eu.eudat.data.entities.Grant.GrantType.INTERNAL.getValue());
grantEntity.setCreationUser(databaseRepository.getUserInfoDao().find(principal.getId())); grantEntity.setCreationUser(databaseRepository.getUserInfoDao().find(principal.getId()));
databaseRepository.getGrantDao().createOrUpdate(grantEntity); databaseRepository.getGrantDao().createOrUpdate(grantEntity);
} }*/
public void delete(UUID uuid) { public void delete(UUID uuid) {
eu.eudat.data.entities.Grant oldGrant = apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().find(uuid); eu.eudat.data.entities.Grant oldGrant = apiContext.getOperationsContext().getDatabaseRepository().getGrantDao().find(uuid);