Guest User

Untitled

a guest
Jun 14th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. class ServiceFacadeImpl {
  2. public void createPortalAccount(Contact contact) {
  3. // here the contact is implicitly saved
  4. this.portalService.createPortalAccount(contact);
  5. }
  6. }
  7.  
  8. class ServiceFacadeImpl {
  9. public void createPortalAccount(Contact contact) {
  10. // here contact is implicitly modified
  11. this.portalService.createPortalAccount(contact);
  12. this.contactDAO.save(contact);
  13. }
  14. }
  15.  
  16. class ServiceFacadeImpl {
  17. public void CreatePortalAccountAndSaveContact(Contact contact) {
  18. try
  19. {
  20. contact.portalAccount = this.portalService.createPortalAccount(contact);
  21. this.contactDAO.save(contact);
  22. }
  23. catch(...)
  24. {
  25. // do cleanup, for example do you need to delete account from remote
  26. // portal if it couldn't be saved locally?
  27. // If yes, delete it from portal and set contact.portalAccount = null;
  28. }
  29. }
  30. }
Add Comment
Please, Sign In to add comment