private List<DescriptiveMetadata> getDescriptiveMetadata(AIP aip, String representationId) { List<DescriptiveMetadata> descriptiveMetadataList = Collections.emptyList(); if (representationId == null) { // AIP descriptive metadata descriptiveMetadataList = aip.getDescriptiveMetadata(); } else { // Representation descriptive metadata Optional<Representation> oRep = aip.getRepresentations().stream() .filter(rep -> rep.getId().equals(representationId)).findFirst(); if (oRep.isPresent()) { descriptiveMetadataList = oRep.get().getDescriptiveMetadata(); } } return descriptiveMetadataList; }
public static List<List<String>> getDescriptiveMetadataInformation(List<String> fields, AIP aip, ModelService model, StorageService storage) { List<List<String>> descriptiveMetadataInformation = new ArrayList<>(); for (DescriptiveMetadata dm : aip.getDescriptiveMetadata()) { descriptiveMetadataInformation.add(retrieveDescriptiveMetadataInfo(fields, aip, dm, storage)); } if (aip.getRepresentations() != null) { for (Representation r : aip.getRepresentations()) { for (DescriptiveMetadata dm : r.getDescriptiveMetadata()) { descriptiveMetadataInformation.add(retrieveDescriptiveMetadataInfo(fields, aip, dm, storage)); } } } return descriptiveMetadataInformation; }
public void setId(String id) { this.id = id; // As id is not serialized to JSON, set the AIP id in metadata and data if (descriptiveMetadata != null) { for (DescriptiveMetadata dm : descriptiveMetadata) { dm.setAipId(id); } } if (representations != null) { for (Representation representation : representations) { representation.setAipId(id); for (DescriptiveMetadata repDm : representation.getDescriptiveMetadata()) { repDm.setAipId(id); repDm.setRepresentationId(representation.getId()); } } } }
rep.getDescriptiveMetadata(), doc);