Skip to content

Commit

Permalink
Merge pull request #8 from folio-org/MODTLR-5-1
Browse files Browse the repository at this point in the history
[MODTLR-5] Fix mapping from dto to entity
  • Loading branch information
roman-barannyk authored Jan 19, 2024
2 parents f45b1b8 + c345ef6 commit 42d6008
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/org/folio/domain/mapper/EcsTlrMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ public interface EcsTlrMapper {
@Mapping(target = "requestLevel", qualifiedByName = "StringToRequestLevel")
@Mapping(target = "fulfillmentPreference", qualifiedByName = "StringToFulfillmentPreference")
EcsTlr mapEntityToDto(EcsTlrEntity ecsTlrEntity);

@Mapping(target = "requestType", qualifiedByName = "RequestTypeToString")
@Mapping(target = "requestLevel", qualifiedByName = "RequestLevelToString")
@Mapping(target = "fulfillmentPreference", qualifiedByName = "FulfillmentPreferenceToString")
EcsTlrEntity mapDtoToEntity(EcsTlr ecsTlr);

@Named("StringToRequestType")
Expand All @@ -30,4 +34,19 @@ default EcsTlr.RequestLevelEnum mapRequestLevel(String requestLevel) {
default EcsTlr.FulfillmentPreferenceEnum mapFulfillmentPreference(String fulfillmentPreference) {
return fulfillmentPreference != null ? EcsTlr.FulfillmentPreferenceEnum.fromValue(fulfillmentPreference) : null;
}

@Named("RequestTypeToString")
default String mapRequestTypeToString(EcsTlr.RequestTypeEnum requestTypeEnum) {
return requestTypeEnum != null ? requestTypeEnum.getValue() : null;
}

@Named("RequestLevelToString")
default String mapRequestLevelToString(EcsTlr.RequestLevelEnum requestLevelEnum) {
return requestLevelEnum != null ? requestLevelEnum.getValue() : null;
}

@Named("FulfillmentPreferenceToString")
default String mapFulfillmentPreferenceToString(EcsTlr.FulfillmentPreferenceEnum fulfillmentPreferenceEnum) {
return fulfillmentPreferenceEnum != null ? fulfillmentPreferenceEnum.getValue() : null;
}
}

0 comments on commit 42d6008

Please sign in to comment.