[CST-5669] Added OrcidToken entity to store orcid access token

This commit is contained in:
Luca Giamminonni
2022-05-16 18:42:17 +02:00
parent d82c6f9ee8
commit f90359411f
27 changed files with 769 additions and 143 deletions

View File

@@ -26,6 +26,8 @@ import java.util.stream.Stream;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
import org.dspace.app.orcid.OrcidToken;
import org.dspace.app.orcid.service.OrcidTokenService;
import org.dspace.app.util.AuthorizeUtil;
import org.dspace.authorize.AuthorizeConfiguration;
import org.dspace.authorize.AuthorizeException;
@@ -120,6 +122,9 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
@Autowired(required = true)
private RelationshipMetadataService relationshipMetadataService;
@Autowired
private OrcidTokenService orcidTokenService;
protected ItemServiceImpl() {
super();
}
@@ -744,6 +749,11 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
harvestedItemService.delete(context, hi);
}
OrcidToken orcidToken = orcidTokenService.findByProfileItem(context, item);
if (orcidToken != null) {
orcidToken.setProfileItem(null);
}
//Only clear collections after we have removed everything else from the item
item.clearCollections();
item.setOwningCollection(null);