mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 22:13:08 +00:00
Merge remote-tracking branch '4science-bitbucket/main' into CST-5587
This commit is contained in:
@@ -49,6 +49,7 @@ import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.BundleService;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
import org.dspace.content.service.EntityTypeService;
|
||||
import org.dspace.content.service.InstallItemService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.content.service.MetadataSchemaService;
|
||||
@@ -129,6 +130,9 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
@Autowired(required = true)
|
||||
private RelationshipMetadataService relationshipMetadataService;
|
||||
|
||||
@Autowired(required = true)
|
||||
private EntityTypeService entityTypeService;
|
||||
|
||||
@Autowired
|
||||
private OrcidTokenService orcidTokenService;
|
||||
|
||||
@@ -265,6 +269,10 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
return itemDAO.findAll(context, true, true);
|
||||
}
|
||||
|
||||
public Iterator<Item> findAllRegularItems(Context context) throws SQLException {
|
||||
return itemDAO.findAllRegularItems(context);
|
||||
};
|
||||
|
||||
@Override
|
||||
public Iterator<Item> findBySubmitter(Context context, EPerson eperson) throws SQLException {
|
||||
return itemDAO.findBySubmitter(context, eperson);
|
||||
@@ -748,7 +756,7 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
|
||||
+ item.getID()));
|
||||
|
||||
// Remove relationships
|
||||
for (Relationship relationship : relationshipService.findByItem(context, item)) {
|
||||
for (Relationship relationship : relationshipService.findByItem(context, item, -1, -1, false, false)) {
|
||||
relationshipService.forceDelete(context, relationship, false, false);
|
||||
}
|
||||
|
||||
@@ -1611,8 +1619,36 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEntityType(Item item) {
|
||||
return getMetadataFirstValue(item, new MetadataFieldName("dspace.entity.type"), Item.ANY);
|
||||
public String getEntityTypeLabel(Item item) {
|
||||
List<MetadataValue> mdvs = getMetadata(item, "dspace", "entity", "type", Item.ANY, false);
|
||||
if (mdvs.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mdvs.size() > 1) {
|
||||
log.warn(
|
||||
"Item with uuid {}, handle {} has {} entity types ({}), expected 1 entity type",
|
||||
item.getID(), item.getHandle(), mdvs.size(),
|
||||
mdvs.stream().map(MetadataValue::getValue).collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
|
||||
String entityType = mdvs.get(0).getValue();
|
||||
if (StringUtils.isBlank(entityType)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return entityType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType getEntityType(Context context, Item item) throws SQLException {
|
||||
String entityTypeString = getEntityTypeLabel(item);
|
||||
if (StringUtils.isBlank(entityTypeString)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return entityTypeService.findByEntityType(context, entityTypeString);
|
||||
}
|
||||
|
||||
private void removeOrcidSynchronizationStuff(Context context, Item item) throws SQLException, AuthorizeException {
|
||||
|
Reference in New Issue
Block a user