Class ContactsRepositoryImpl

java.lang.Object
info.ejava.examples.db.validation.contacts.repo.ContactsRepositoryImpl
All Implemented Interfaces:
org.springframework.data.mapping.callback.EntityCallback<PersonPOC>, org.springframework.data.mongodb.core.mapping.event.BeforeConvertCallback<PersonPOC>

@Component public class ContactsRepositoryImpl extends Object implements org.springframework.data.mongodb.core.mapping.event.BeforeConvertCallback<PersonPOC>
  • Constructor Details

    • ContactsRepositoryImpl

      public ContactsRepositoryImpl()
  • Method Details

    • onBeforeConvert

      public PersonPOC onBeforeConvert(PersonPOC poc, String collection)
      MongoRepository only assigns a unique ID to the root Document. We must assign all nested child IDs. This callback is registered to handle change events when the root document with children are inserted or saved.
      Specified by:
      onBeforeConvert in interface org.springframework.data.mongodb.core.mapping.event.BeforeConvertCallback<PersonPOC>
      Parameters:
      poc -
      collection -
      Returns:
      poc with child IDs assigned
    • nameContactPoints

      private void nameContactPoints(Collection<ContactPoint> contactPoints)