mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 23:13:10 +00:00
[Task 57104] adding delete functionality for the csv import
This commit is contained in:
@@ -1291,21 +1291,33 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
*/
|
||||
@Override
|
||||
public List<MetadataValue> getMetadata(Item item, String schema, String element, String qualifier, String lang) {
|
||||
List<MetadataValue> dbMetadataValues = super.getMetadata(item, schema, element, qualifier, lang);
|
||||
if (StringUtils.equals(schema, "relation") && !StringUtils.equals(element, "type")) {
|
||||
|
||||
if (!(StringUtils.equals(schema, "*") && StringUtils.equals(element, "*") &&
|
||||
StringUtils.equals(qualifier, "*") && StringUtils.equals(lang, "*"))) {
|
||||
return dbMetadataValues;
|
||||
List<MetadataValue> relationMetadata = getRelationshipMetadata(item, false);
|
||||
List<MetadataValue> listToReturn = new LinkedList<>();
|
||||
for (MetadataValue metadataValue : relationMetadata) {
|
||||
if (StringUtils.equals(metadataValue.getMetadataField().getElement(), element)) {
|
||||
listToReturn.add(metadataValue);
|
||||
}
|
||||
}
|
||||
return listToReturn;
|
||||
|
||||
} else {
|
||||
List<MetadataValue> dbMetadataValues = super.getMetadata(item, schema, element, qualifier, lang);
|
||||
|
||||
if (!(StringUtils.equals(schema, "*") && StringUtils.equals(element, "*") &&
|
||||
StringUtils.equals(qualifier, "*") && StringUtils.equals(lang, "*"))) {
|
||||
return dbMetadataValues;
|
||||
}
|
||||
List<MetadataValue> fullMetadataValueList = getRelationshipMetadata(item, true);
|
||||
fullMetadataValueList.addAll(dbMetadataValues);
|
||||
|
||||
return fullMetadataValueList;
|
||||
}
|
||||
List<MetadataValue> fullMetadataValueList = getRelationshipMetadata(item);
|
||||
fullMetadataValueList.addAll(dbMetadataValues);
|
||||
|
||||
return fullMetadataValueList;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MetadataValue> getRelationshipMetadata(Item item) {
|
||||
public List<MetadataValue> getRelationshipMetadata(Item item, boolean extra) {
|
||||
Context context = new Context();
|
||||
List<MetadataValue> fullMetadataValueList = new LinkedList<>();
|
||||
try {
|
||||
@@ -1314,7 +1326,7 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
if (StringUtils.isNotBlank(entityType)) {
|
||||
List<Relationship> relationships = relationshipService.findByItem(context, item);
|
||||
for (Relationship relationship : relationships) {
|
||||
fullMetadataValueList.addAll(handleItemRelationship(item, entityType, relationship));
|
||||
fullMetadataValueList.addAll(handleItemRelationship(item, entityType, relationship, extra));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1325,7 +1337,7 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
}
|
||||
|
||||
private List<MetadataValue> handleItemRelationship(Item item, String entityType,
|
||||
Relationship relationship) {
|
||||
Relationship relationship, boolean extra) {
|
||||
List<MetadataValue> resultingMetadataValueList = new LinkedList<>();
|
||||
RelationshipType relationshipType = relationship.getRelationshipType();
|
||||
HashMap<String, List<String>> hashMaps = new HashMap<>();
|
||||
@@ -1343,7 +1355,7 @@ prevent the generation of resource policy entry values with null dspace_object a
|
||||
relationName = relationship.getRelationshipType().getRightLabel();
|
||||
}
|
||||
|
||||
if (hashMaps != null) {
|
||||
if (hashMaps != null && extra) {
|
||||
resultingMetadataValueList.addAll(handleRelationshipTypeMetadataMappping(item, hashMaps,
|
||||
otherItem, relationName));
|
||||
}
|
||||
|
Reference in New Issue
Block a user