DS-3743 metadata exposition key with dot separator; add @JsonAnyGetter annotation to remove serialization of metadata label

This commit is contained in:
Luigi Andrea Pascarelli
2017-11-08 09:30:09 +01:00
parent 7ac8722ce0
commit b54d0f09a9
2 changed files with 7 additions and 3 deletions

View File

@@ -13,10 +13,13 @@ import java.util.Map;
import org.dspace.app.rest.model.MetadataValueRest;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
public class DataDescribe implements SectionData {
private Map<String, List<MetadataValueRest>> metadata = new HashMap<>();
@JsonAnyGetter
public Map<String, List<MetadataValueRest>> getMetadata() {
return metadata;
}

View File

@@ -24,6 +24,7 @@ import org.dspace.app.util.SubmissionStepConfig;
import org.dspace.content.MetadataValue;
import org.dspace.content.WorkspaceItem;
import org.dspace.content.service.ItemService;
import org.dspace.core.Utils;
import org.springframework.beans.factory.annotation.Autowired;
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());
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 {
List<MetadataValueRest> listDto = new ArrayList<>();
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);
}
}
}