@Test public void should_not_fill_title_if_title_has_no_default_lang() { DescriptiveMetadataContentType metadataContentType = new DescriptiveMetadataContentType(); TextType title = new TextType(); title.setLang("fr"); title.setValue("titre"); metadataContentType.getTitle().add(title); DescriptiveMetadataModel descriptiveMetadataModel = descriptiveMetadataMapper.map(metadataContentType); assertThat(descriptiveMetadataModel.getTitle()).isNull(); assertThat(descriptiveMetadataModel.getTitle_().getTextTypes()) .hasSize(1) .extracting("lang", "value") .contains(tuple("fr", "titre")); }
public DescriptiveMetadataModel map(DescriptiveMetadataContentType metadataContentType) { DescriptiveMetadataModel descriptiveMetadataModel = new DescriptiveMetadataModel(); descriptiveMetadataModel.setAcquiredDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getAcquiredDate())); descriptiveMetadataModel.getAddressee().addAll(metadataContentType.getAddressee()); descriptiveMetadataModel.setAny(elementMapper.toMap(metadataContentType.getAny())); descriptiveMetadataModel .setArchivalAgencyArchiveUnitIdentifier(metadataContentType.getArchivalAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setAuthorizedAgent(metadataContentType.getAuthorizedAgent()); descriptiveMetadataModel.setCoverage(metadataContentType.getCoverage()); descriptiveMetadataModel.setCreatedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getCreatedDate())); CustodialHistoryModel custodialHistoryModel = custodialHistoryMapper.map(metadataContentType.getCustodialHistory()); descriptiveMetadataModel.setCustodialHistory(custodialHistoryModel); descriptiveMetadataModel.setDescription(findDefaultTextType(metadataContentType.getDescription())); TextByLang description_ = new TextByLang(metadataContentType.getDescription()); if (description_.isNotEmpty()) { descriptiveMetadataModel.setDescription_(description_); } descriptiveMetadataModel.setDescriptionLanguage(metadataContentType.getDescriptionLanguage()); descriptiveMetadataModel.setDescriptionLevel(metadataContentType.getDescriptionLevel()); descriptiveMetadataModel.setDocumentType(metadataContentType.getDocumentType()); descriptiveMetadataModel.setEndDate(metadataContentType.getEndDate()); descriptiveMetadataModel.setEvent(mapEvents(metadataContentType.getEvent())); descriptiveMetadataModel.setFilePlanPosition(metadataContentType.getFilePlanPosition()); descriptiveMetadataModel.setGps(metadataContentType.getGps()); descriptiveMetadataModel.setKeyword(metadataContentType.getKeyword()); descriptiveMetadataModel.setLanguage(metadataContentType.getLanguage()); descriptiveMetadataModel.setOriginatingAgency(metadataContentType.getOriginatingAgency()); descriptiveMetadataModel .setOriginatingAgencyArchiveUnitIdentifier(metadataContentType.getOriginatingAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setOriginatingSystemId(metadataContentType.getOriginatingSystemId()); descriptiveMetadataModel.getRecipient().addAll(metadataContentType.getRecipient()); descriptiveMetadataModel.setRegisteredDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getRegisteredDate())); descriptiveMetadataModel.setRelatedObjectReference(metadataContentType.getRelatedObjectReference()); descriptiveMetadataModel.setReceivedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getReceivedDate())); descriptiveMetadataModel .setSentDate(LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getSentDate())); descriptiveMetadataModel.setSignature(mapSignatures(metadataContentType.getSignature())); descriptiveMetadataModel.setSource(metadataContentType.getSource()); descriptiveMetadataModel .setStartDate(LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getStartDate())); descriptiveMetadataModel.setStatus(metadataContentType.getStatus()); descriptiveMetadataModel.setSubmissionAgency(metadataContentType.getSubmissionAgency()); descriptiveMetadataModel.setSystemId(metadataContentType.getSystemId()); descriptiveMetadataModel.setTag(metadataContentType.getTag()); descriptiveMetadataModel.setTitle(findDefaultTextType(metadataContentType.getTitle())); TextByLang title_ = new TextByLang(metadataContentType.getTitle()); if (title_.isNotEmpty()) { descriptiveMetadataModel.setTitle_(title_); } descriptiveMetadataModel.setTransactedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getTransactedDate())); descriptiveMetadataModel.setTransferringAgencyArchiveUnitIdentifier( metadataContentType.getTransferringAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setType(metadataContentType.getType()); descriptiveMetadataModel.setVersion(metadataContentType.getVersion()); descriptiveMetadataModel.setWriter(metadataContentType.getWriter()); descriptiveMetadataModel.setTransmitter(metadataContentType.getTransmitter()); descriptiveMetadataModel.setSender(metadataContentType.getSender()); if (metadataContentType.getRelatedObjectReference() != null) { RelatedObjectReferenceType relatedObjectRef = metadataContentType.getRelatedObjectReference(); RelatedObjectReferenceType relatedObjectRefNew = new RelatedObjectReferenceType(); descriptiveMetadataModel.setRelatedObjectReference(relatedObjectRefNew); relatedObjectRefNew.getIsPartOf().addAll(relatedObjectRef.getIsPartOf()); relatedObjectRefNew.getIsVersionOf().addAll(relatedObjectRef.getIsVersionOf()); relatedObjectRefNew.getReplaces().addAll(relatedObjectRef.getReplaces()); relatedObjectRefNew.getRequires().addAll(relatedObjectRef.getRequires()); relatedObjectRefNew.getReferences().addAll(relatedObjectRef.getReferences()); } return descriptiveMetadataModel; }
DescriptiveMetadataMapper { public DescriptiveMetadataModel map(DescriptiveMetadataContentType metadataContentType) { DescriptiveMetadataModel descriptiveMetadataModel = new DescriptiveMetadataModel(); descriptiveMetadataModel.setAcquiredDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getAcquiredDate())); descriptiveMetadataModel.getAddressee().addAll(metadataContentType.getAddressee()); descriptiveMetadataModel.setAny(elementMapper.toMap(metadataContentType.getAny())); descriptiveMetadataModel .setArchivalAgencyArchiveUnitIdentifier(metadataContentType.getArchivalAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setAuthorizedAgent(metadataContentType.getAuthorizedAgent()); descriptiveMetadataModel.setCoverage(metadataContentType.getCoverage()); descriptiveMetadataModel.setCreatedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getCreatedDate())); CustodialHistoryModel custodialHistoryModel = custodialHistoryMapper.map(metadataContentType.getCustodialHistory()); descriptiveMetadataModel.setCustodialHistory(custodialHistoryModel); descriptiveMetadataModel.setDescription(findDefaultTextType(metadataContentType.getDescription())); TextByLang description_ = new TextByLang(metadataContentType.getDescription()); if (description_.isNotEmpty()) { descriptiveMetadataModel.setDescription_(description_); } descriptiveMetadataModel.setDescriptionLanguage(metadataContentType.getDescriptionLanguage()); descriptiveMetadataModel.setDescriptionLevel(metadataContentType.getDescriptionLevel()); descriptiveMetadataModel.setDocumentType(metadataContentType.getDocumentType()); descriptiveMetadataModel.setEndDate(metadataContentType.getEndDate()); descriptiveMetadataModel.setEvent(mapEvents(metadataContentType.getEvent())); descriptiveMetadataModel.setFilePlanPosition(metadataContentType.getFilePlanPosition()); descriptiveMetadataModel.setGps(metadataContentType.getGps()); descriptiveMetadataModel.setKeyword(metadataContentType.getKeyword()); descriptiveMetadataModel.setLanguage(metadataContentType.getLanguage()); descriptiveMetadataModel.setOriginatingAgency(metadataContentType.getOriginatingAgency()); descriptiveMetadataModel .setOriginatingAgencyArchiveUnitIdentifier(metadataContentType.getOriginatingAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setOriginatingSystemId(metadataContentType.getOriginatingSystemId()); descriptiveMetadataModel.getRecipient().addAll(metadataContentType.getRecipient()); descriptiveMetadataModel.setRegisteredDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getRegisteredDate())); descriptiveMetadataModel.setRelatedObjectReference(metadataContentType.getRelatedObjectReference()); descriptiveMetadataModel.setReceivedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getReceivedDate())); descriptiveMetadataModel .setSentDate(LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getSentDate())); descriptiveMetadataModel.setSignature(mapSignatures(metadataContentType.getSignature())); descriptiveMetadataModel.setSource(metadataContentType.getSource()); descriptiveMetadataModel .setStartDate(LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getStartDate())); descriptiveMetadataModel.setStatus(metadataContentType.getStatus()); descriptiveMetadataModel.setSubmissionAgency(metadataContentType.getSubmissionAgency()); descriptiveMetadataModel.setSystemId(metadataContentType.getSystemId()); descriptiveMetadataModel.setTag(metadataContentType.getTag()); descriptiveMetadataModel.setTitle(findDefaultTextType(metadataContentType.getTitle())); TextByLang title_ = new TextByLang(metadataContentType.getTitle()); if (title_.isNotEmpty()) { descriptiveMetadataModel.setTitle_(title_); } descriptiveMetadataModel.setTransactedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getTransactedDate())); descriptiveMetadataModel.setTransferringAgencyArchiveUnitIdentifier( metadataContentType.getTransferringAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setType(metadataContentType.getType()); descriptiveMetadataModel.setVersion(metadataContentType.getVersion()); descriptiveMetadataModel.setWriter(metadataContentType.getWriter()); descriptiveMetadataModel.setTransmitter(metadataContentType.getTransmitter()); descriptiveMetadataModel.setSender(metadataContentType.getSender()); if (metadataContentType.getRelatedObjectReference() != null) { RelatedObjectReferenceType relatedObjectRef = metadataContentType.getRelatedObjectReference(); RelatedObjectReferenceType relatedObjectRefNew = new RelatedObjectReferenceType(); descriptiveMetadataModel.setRelatedObjectReference(relatedObjectRefNew); relatedObjectRefNew.getIsPartOf().addAll(relatedObjectRef.getIsPartOf()); relatedObjectRefNew.getIsVersionOf().addAll(relatedObjectRef.getIsVersionOf()); relatedObjectRefNew.getReplaces().addAll(relatedObjectRef.getReplaces()); relatedObjectRefNew.getRequires().addAll(relatedObjectRef.getRequires()); relatedObjectRefNew.getReferences().addAll(relatedObjectRef.getReferences()); } return descriptiveMetadataModel; } }
DescriptiveMetadataMapper { public DescriptiveMetadataModel map(DescriptiveMetadataContentType metadataContentType) { DescriptiveMetadataModel descriptiveMetadataModel = new DescriptiveMetadataModel(); descriptiveMetadataModel.setAcquiredDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getAcquiredDate())); descriptiveMetadataModel.getAddressee().addAll(metadataContentType.getAddressee()); descriptiveMetadataModel.setAny(elementMapper.toMap(metadataContentType.getAny())); descriptiveMetadataModel .setArchivalAgencyArchiveUnitIdentifier(metadataContentType.getArchivalAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setAuthorizedAgent(metadataContentType.getAuthorizedAgent()); descriptiveMetadataModel.setCoverage(metadataContentType.getCoverage()); descriptiveMetadataModel.setCreatedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getCreatedDate())); CustodialHistoryModel custodialHistoryModel = custodialHistoryMapper.map(metadataContentType.getCustodialHistory()); descriptiveMetadataModel.setCustodialHistory(custodialHistoryModel); descriptiveMetadataModel.setDescription(findDefaultTextType(metadataContentType.getDescription())); TextByLang description_ = new TextByLang(metadataContentType.getDescription()); if (description_.isNotEmpty()) { descriptiveMetadataModel.setDescription_(description_); } descriptiveMetadataModel.setDescriptionLanguage(metadataContentType.getDescriptionLanguage()); descriptiveMetadataModel.setDescriptionLevel(metadataContentType.getDescriptionLevel()); descriptiveMetadataModel.setDocumentType(metadataContentType.getDocumentType()); descriptiveMetadataModel.setEndDate(metadataContentType.getEndDate()); descriptiveMetadataModel.setEvent(mapEvents(metadataContentType.getEvent())); descriptiveMetadataModel.setFilePlanPosition(metadataContentType.getFilePlanPosition()); descriptiveMetadataModel.setGps(metadataContentType.getGps()); descriptiveMetadataModel.setKeyword(metadataContentType.getKeyword()); descriptiveMetadataModel.setLanguage(metadataContentType.getLanguage()); descriptiveMetadataModel.setOriginatingAgency(metadataContentType.getOriginatingAgency()); descriptiveMetadataModel .setOriginatingAgencyArchiveUnitIdentifier(metadataContentType.getOriginatingAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setOriginatingSystemId(metadataContentType.getOriginatingSystemId()); descriptiveMetadataModel.getRecipient().addAll(metadataContentType.getRecipient()); descriptiveMetadataModel.setRegisteredDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getRegisteredDate())); descriptiveMetadataModel.setRelatedObjectReference(metadataContentType.getRelatedObjectReference()); descriptiveMetadataModel.setReceivedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getReceivedDate())); descriptiveMetadataModel .setSentDate(LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getSentDate())); descriptiveMetadataModel.setSignature(mapSignatures(metadataContentType.getSignature())); descriptiveMetadataModel.setSource(metadataContentType.getSource()); descriptiveMetadataModel .setStartDate(LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getStartDate())); descriptiveMetadataModel.setStatus(metadataContentType.getStatus()); descriptiveMetadataModel.setSubmissionAgency(metadataContentType.getSubmissionAgency()); descriptiveMetadataModel.setSystemId(metadataContentType.getSystemId()); descriptiveMetadataModel.setTag(metadataContentType.getTag()); descriptiveMetadataModel.setTitle(findDefaultTextType(metadataContentType.getTitle())); TextByLang title_ = new TextByLang(metadataContentType.getTitle()); if (title_.isNotEmpty()) { descriptiveMetadataModel.setTitle_(title_); } descriptiveMetadataModel.setTransactedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getTransactedDate())); descriptiveMetadataModel.setTransferringAgencyArchiveUnitIdentifier( metadataContentType.getTransferringAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setType(metadataContentType.getType()); descriptiveMetadataModel.setVersion(metadataContentType.getVersion()); descriptiveMetadataModel.setWriter(metadataContentType.getWriter()); descriptiveMetadataModel.setTransmitter(metadataContentType.getTransmitter()); descriptiveMetadataModel.setSender(metadataContentType.getSender()); if (metadataContentType.getRelatedObjectReference() != null) { RelatedObjectReferenceType relatedObjectRef = metadataContentType.getRelatedObjectReference(); RelatedObjectReferenceType relatedObjectRefNew = new RelatedObjectReferenceType(); descriptiveMetadataModel.setRelatedObjectReference(relatedObjectRefNew); relatedObjectRefNew.getIsPartOf().addAll(relatedObjectRef.getIsPartOf()); relatedObjectRefNew.getIsVersionOf().addAll(relatedObjectRef.getIsVersionOf()); relatedObjectRefNew.getReplaces().addAll(relatedObjectRef.getReplaces()); relatedObjectRefNew.getRequires().addAll(relatedObjectRef.getRequires()); relatedObjectRefNew.getReferences().addAll(relatedObjectRef.getReferences()); } return descriptiveMetadataModel; } DescriptiveMetadataMapper(); }
DescriptiveMetadataMapper { public DescriptiveMetadataModel map(DescriptiveMetadataContentType metadataContentType) { DescriptiveMetadataModel descriptiveMetadataModel = new DescriptiveMetadataModel(); descriptiveMetadataModel.setAcquiredDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getAcquiredDate())); descriptiveMetadataModel.getAddressee().addAll(metadataContentType.getAddressee()); descriptiveMetadataModel.setAny(elementMapper.toMap(metadataContentType.getAny())); descriptiveMetadataModel .setArchivalAgencyArchiveUnitIdentifier(metadataContentType.getArchivalAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setAuthorizedAgent(metadataContentType.getAuthorizedAgent()); descriptiveMetadataModel.setCoverage(metadataContentType.getCoverage()); descriptiveMetadataModel.setCreatedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getCreatedDate())); CustodialHistoryModel custodialHistoryModel = custodialHistoryMapper.map(metadataContentType.getCustodialHistory()); descriptiveMetadataModel.setCustodialHistory(custodialHistoryModel); descriptiveMetadataModel.setDescription(findDefaultTextType(metadataContentType.getDescription())); TextByLang description_ = new TextByLang(metadataContentType.getDescription()); if (description_.isNotEmpty()) { descriptiveMetadataModel.setDescription_(description_); } descriptiveMetadataModel.setDescriptionLanguage(metadataContentType.getDescriptionLanguage()); descriptiveMetadataModel.setDescriptionLevel(metadataContentType.getDescriptionLevel()); descriptiveMetadataModel.setDocumentType(metadataContentType.getDocumentType()); descriptiveMetadataModel.setEndDate(metadataContentType.getEndDate()); descriptiveMetadataModel.setEvent(mapEvents(metadataContentType.getEvent())); descriptiveMetadataModel.setFilePlanPosition(metadataContentType.getFilePlanPosition()); descriptiveMetadataModel.setGps(metadataContentType.getGps()); descriptiveMetadataModel.setKeyword(metadataContentType.getKeyword()); descriptiveMetadataModel.setLanguage(metadataContentType.getLanguage()); descriptiveMetadataModel.setOriginatingAgency(metadataContentType.getOriginatingAgency()); descriptiveMetadataModel .setOriginatingAgencyArchiveUnitIdentifier(metadataContentType.getOriginatingAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setOriginatingSystemId(metadataContentType.getOriginatingSystemId()); descriptiveMetadataModel.getRecipient().addAll(metadataContentType.getRecipient()); descriptiveMetadataModel.setRegisteredDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getRegisteredDate())); descriptiveMetadataModel.setRelatedObjectReference(metadataContentType.getRelatedObjectReference()); descriptiveMetadataModel.setReceivedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getReceivedDate())); descriptiveMetadataModel .setSentDate(LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getSentDate())); descriptiveMetadataModel.setSignature(mapSignatures(metadataContentType.getSignature())); descriptiveMetadataModel.setSource(metadataContentType.getSource()); descriptiveMetadataModel .setStartDate(LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getStartDate())); descriptiveMetadataModel.setStatus(metadataContentType.getStatus()); descriptiveMetadataModel.setSubmissionAgency(metadataContentType.getSubmissionAgency()); descriptiveMetadataModel.setSystemId(metadataContentType.getSystemId()); descriptiveMetadataModel.setTag(metadataContentType.getTag()); descriptiveMetadataModel.setTitle(findDefaultTextType(metadataContentType.getTitle())); TextByLang title_ = new TextByLang(metadataContentType.getTitle()); if (title_.isNotEmpty()) { descriptiveMetadataModel.setTitle_(title_); } descriptiveMetadataModel.setTransactedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getTransactedDate())); descriptiveMetadataModel.setTransferringAgencyArchiveUnitIdentifier( metadataContentType.getTransferringAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setType(metadataContentType.getType()); descriptiveMetadataModel.setVersion(metadataContentType.getVersion()); descriptiveMetadataModel.setWriter(metadataContentType.getWriter()); descriptiveMetadataModel.setTransmitter(metadataContentType.getTransmitter()); descriptiveMetadataModel.setSender(metadataContentType.getSender()); if (metadataContentType.getRelatedObjectReference() != null) { RelatedObjectReferenceType relatedObjectRef = metadataContentType.getRelatedObjectReference(); RelatedObjectReferenceType relatedObjectRefNew = new RelatedObjectReferenceType(); descriptiveMetadataModel.setRelatedObjectReference(relatedObjectRefNew); relatedObjectRefNew.getIsPartOf().addAll(relatedObjectRef.getIsPartOf()); relatedObjectRefNew.getIsVersionOf().addAll(relatedObjectRef.getIsVersionOf()); relatedObjectRefNew.getReplaces().addAll(relatedObjectRef.getReplaces()); relatedObjectRefNew.getRequires().addAll(relatedObjectRef.getRequires()); relatedObjectRefNew.getReferences().addAll(relatedObjectRef.getReferences()); } return descriptiveMetadataModel; } DescriptiveMetadataMapper(); DescriptiveMetadataModel map(DescriptiveMetadataContentType metadataContentType); String findDefaultTextType(List<TextType> textTypes); }
DescriptiveMetadataMapper { public DescriptiveMetadataModel map(DescriptiveMetadataContentType metadataContentType) { DescriptiveMetadataModel descriptiveMetadataModel = new DescriptiveMetadataModel(); descriptiveMetadataModel.setAcquiredDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getAcquiredDate())); descriptiveMetadataModel.getAddressee().addAll(metadataContentType.getAddressee()); descriptiveMetadataModel.setAny(elementMapper.toMap(metadataContentType.getAny())); descriptiveMetadataModel .setArchivalAgencyArchiveUnitIdentifier(metadataContentType.getArchivalAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setAuthorizedAgent(metadataContentType.getAuthorizedAgent()); descriptiveMetadataModel.setCoverage(metadataContentType.getCoverage()); descriptiveMetadataModel.setCreatedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getCreatedDate())); CustodialHistoryModel custodialHistoryModel = custodialHistoryMapper.map(metadataContentType.getCustodialHistory()); descriptiveMetadataModel.setCustodialHistory(custodialHistoryModel); descriptiveMetadataModel.setDescription(findDefaultTextType(metadataContentType.getDescription())); TextByLang description_ = new TextByLang(metadataContentType.getDescription()); if (description_.isNotEmpty()) { descriptiveMetadataModel.setDescription_(description_); } descriptiveMetadataModel.setDescriptionLanguage(metadataContentType.getDescriptionLanguage()); descriptiveMetadataModel.setDescriptionLevel(metadataContentType.getDescriptionLevel()); descriptiveMetadataModel.setDocumentType(metadataContentType.getDocumentType()); descriptiveMetadataModel.setEndDate(metadataContentType.getEndDate()); descriptiveMetadataModel.setEvent(mapEvents(metadataContentType.getEvent())); descriptiveMetadataModel.setFilePlanPosition(metadataContentType.getFilePlanPosition()); descriptiveMetadataModel.setGps(metadataContentType.getGps()); descriptiveMetadataModel.setKeyword(metadataContentType.getKeyword()); descriptiveMetadataModel.setLanguage(metadataContentType.getLanguage()); descriptiveMetadataModel.setOriginatingAgency(metadataContentType.getOriginatingAgency()); descriptiveMetadataModel .setOriginatingAgencyArchiveUnitIdentifier(metadataContentType.getOriginatingAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setOriginatingSystemId(metadataContentType.getOriginatingSystemId()); descriptiveMetadataModel.getRecipient().addAll(metadataContentType.getRecipient()); descriptiveMetadataModel.setRegisteredDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getRegisteredDate())); descriptiveMetadataModel.setRelatedObjectReference(metadataContentType.getRelatedObjectReference()); descriptiveMetadataModel.setReceivedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getReceivedDate())); descriptiveMetadataModel .setSentDate(LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getSentDate())); descriptiveMetadataModel.setSignature(mapSignatures(metadataContentType.getSignature())); descriptiveMetadataModel.setSource(metadataContentType.getSource()); descriptiveMetadataModel .setStartDate(LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getStartDate())); descriptiveMetadataModel.setStatus(metadataContentType.getStatus()); descriptiveMetadataModel.setSubmissionAgency(metadataContentType.getSubmissionAgency()); descriptiveMetadataModel.setSystemId(metadataContentType.getSystemId()); descriptiveMetadataModel.setTag(metadataContentType.getTag()); descriptiveMetadataModel.setTitle(findDefaultTextType(metadataContentType.getTitle())); TextByLang title_ = new TextByLang(metadataContentType.getTitle()); if (title_.isNotEmpty()) { descriptiveMetadataModel.setTitle_(title_); } descriptiveMetadataModel.setTransactedDate( LocalDateUtil.transformIsoOffsetDateToIsoOffsetDateTime(metadataContentType.getTransactedDate())); descriptiveMetadataModel.setTransferringAgencyArchiveUnitIdentifier( metadataContentType.getTransferringAgencyArchiveUnitIdentifier()); descriptiveMetadataModel.setType(metadataContentType.getType()); descriptiveMetadataModel.setVersion(metadataContentType.getVersion()); descriptiveMetadataModel.setWriter(metadataContentType.getWriter()); descriptiveMetadataModel.setTransmitter(metadataContentType.getTransmitter()); descriptiveMetadataModel.setSender(metadataContentType.getSender()); if (metadataContentType.getRelatedObjectReference() != null) { RelatedObjectReferenceType relatedObjectRef = metadataContentType.getRelatedObjectReference(); RelatedObjectReferenceType relatedObjectRefNew = new RelatedObjectReferenceType(); descriptiveMetadataModel.setRelatedObjectReference(relatedObjectRefNew); relatedObjectRefNew.getIsPartOf().addAll(relatedObjectRef.getIsPartOf()); relatedObjectRefNew.getIsVersionOf().addAll(relatedObjectRef.getIsVersionOf()); relatedObjectRefNew.getReplaces().addAll(relatedObjectRef.getReplaces()); relatedObjectRefNew.getRequires().addAll(relatedObjectRef.getRequires()); relatedObjectRefNew.getReferences().addAll(relatedObjectRef.getReferences()); } return descriptiveMetadataModel; } DescriptiveMetadataMapper(); DescriptiveMetadataModel map(DescriptiveMetadataContentType metadataContentType); String findDefaultTextType(List<TextType> textTypes);  }