Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-953

Replace repetitive population of ContractMetric.contractUuid using MapStruct

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      MapStruct provides a feature  @AfterMapping  that we should use when converting dtos to entities and populating contract_uuid across the Set<ContractMetrics>.  I had this working successfully at one point, but then I introduced a lombok @Builder which broke it.  In the interest of time, it was faster to manually do contract.getContractMetrics.forEach() in a couple of places than figure out how to make MapStruct work again.

      There is a commented out reference to this in the ContractMapperTest class that should be revised/uncommented to check that this is fixed.

       

      Resources:

      https://www.baeldung.com/mapstruct 

      https://stackoverflow.com/questions/59028797/aftermapping-is-not-called-from-mapper-interface 

            lburnett0 Lindsey Burnett
            lburnett0 Lindsey Burnett
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: