mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-08 02:24:18 +00:00
DS-3743 metadata exposition key with dot separator; add @JsonAnyGetter annotation to remove serialization of metadata label
This commit is contained in:
@@ -13,10 +13,13 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.dspace.app.rest.model.MetadataValueRest;
|
import org.dspace.app.rest.model.MetadataValueRest;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAnyGetter;
|
||||||
|
|
||||||
public class DataDescribe implements SectionData {
|
public class DataDescribe implements SectionData {
|
||||||
|
|
||||||
private Map<String, List<MetadataValueRest>> metadata = new HashMap<>();
|
private Map<String, List<MetadataValueRest>> metadata = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonAnyGetter
|
||||||
public Map<String, List<MetadataValueRest>> getMetadata() {
|
public Map<String, List<MetadataValueRest>> getMetadata() {
|
||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ import org.dspace.app.util.SubmissionStepConfig;
|
|||||||
import org.dspace.content.MetadataValue;
|
import org.dspace.content.MetadataValue;
|
||||||
import org.dspace.content.WorkspaceItem;
|
import org.dspace.content.WorkspaceItem;
|
||||||
import org.dspace.content.service.ItemService;
|
import org.dspace.content.service.ItemService;
|
||||||
|
import org.dspace.core.Utils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
public class DescribeStep extends org.dspace.submit.step.DescribeStep implements AbstractRestProcessingStep {
|
public class DescribeStep extends org.dspace.submit.step.DescribeStep implements AbstractRestProcessingStep {
|
||||||
@@ -52,12 +53,12 @@ public class DescribeStep extends org.dspace.submit.step.DescribeStep implements
|
|||||||
dto.setValue(md.getValue());
|
dto.setValue(md.getValue());
|
||||||
|
|
||||||
if(data.getMetadata().containsKey(md.getMetadataField().toString())) {
|
if(data.getMetadata().containsKey(md.getMetadataField().toString())) {
|
||||||
data.getMetadata().get(md.getMetadataField().toString()).add(dto);
|
data.getMetadata().get(Utils.standardize(md.getMetadataField().getMetadataSchema().getName(), md.getMetadataField().getElement(), md.getMetadataField().getQualifier(), ".")).add(dto);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
List<MetadataValueRest> listDto = new ArrayList<>();
|
List<MetadataValueRest> listDto = new ArrayList<>();
|
||||||
listDto.add(dto);
|
listDto.add(dto);
|
||||||
data.getMetadata().put(md.getMetadataField().toString(), listDto);
|
data.getMetadata().put(Utils.standardize(md.getMetadataField().getMetadataSchema().getName(), md.getMetadataField().getElement(), md.getMetadataField().getQualifier(), "."), listDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user