Skip to content

Commit

Permalink
Merge pull request #1580 from alliance-genome/SCRUM-4137_cleanup_fix
Browse files Browse the repository at this point in the history
SCRUM-4137 Fix cleanup error
  • Loading branch information
markquintontulloch authored Jun 24, 2024
2 parents c16e264 + 5da6cb8 commit a25ef92
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Map;

import org.alliancegenome.curation_api.auth.AuthenticatedUser;
import org.alliancegenome.curation_api.dao.PersonDAO;
import org.alliancegenome.curation_api.dao.base.BaseEntityDAO;
import org.alliancegenome.curation_api.dao.base.BaseSQLDAO;
import org.alliancegenome.curation_api.exceptions.ApiErrorException;
Expand All @@ -31,7 +32,8 @@ protected void setSQLDao(BaseSQLDAO<E> dao) {
@Inject
@AuthenticatedUser protected Person authenticatedPerson;
@Inject PersonService personService;

@Inject PersonDAO personDAO;

protected abstract void init();

@Transactional
Expand Down Expand Up @@ -156,11 +158,11 @@ public E deprecateOrDelete(Long id, Boolean throwApiError, String requestSource,
if (deprecate) {
if (!object.getObsolete()) {
object.setObsolete(true);
if (authenticatedPerson.getId() != null) {
object.setUpdatedBy(authenticatedPerson);
} else {
object.setUpdatedBy(personService.fetchByUniqueIdOrCreate(requestSource));
if (authenticatedPerson.getUniqueId() != null) {
requestSource = authenticatedPerson.getUniqueId();
}
Person updatedBy = personService.fetchByUniqueIdOrCreate(requestSource);
object.setUpdatedBy(updatedBy);
object.setDateUpdated(OffsetDateTime.now());
return dao.persist(object);
} else {
Expand Down

0 comments on commit a25ef92

Please sign in to comment.