package Ġcom . du op oints . controller Ċ Ċ import Ġcom . du op oints . Request Parameters Ċ import Ġcom . du op oints . Utils Ċ import Ġcom . du op oints . models . Full Relationship Data Ċ import Ġcom . du op oints . models . comp os ites . Composite Relationship Ċ import Ġcom . du op oints . models . comp os ites . Composite Relationship Break up Request Ċ import Ġcom . du op oints . models . comp os ites . Composite Relationship Request Ċ import Ġcom . du op oints . models . posts . New Relationship Break up Request Ċ import Ġcom . du op oints . models . posts . New Relationship Request Ċ import Ġcom . du op oints . service . Relationship Service Ċ import Ġcom . du op oints . service . fc m . F cm Service Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . http . MediaType Ċ import Ġorg . springframework . web . bind . annotation .* Ċ import Ġjava . util . UUID Ċ Ċ @ RestController Ċ @ RequestMapping ("/") Ċ class ĠRelationship Controller Ġ{ ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġlateinit Ġvar Ġrelationship Service : ĠRelationship Service ĊĊĠĠĠ Ġ@ Autowired ĊĠĠĠ Ġlateinit Ġvar Ġf cm Service : ĠF cm Service ĊĊĠĠĠ Ġ/ **************** ***** ĊĠĠĠĠ Ġ* ĠREL ATION SHIP ĊĠĠĠĠ Ġ***************** ****/ ĊĊĠĠĠ Ġ@ RequestMapping ( method Ġ= Ġ[ Request Method . GET ], Ġvalue Ġ= Ġ["/ get Composite Relationship "], Ġproduces Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġfun Ġget Composite Relationship (@ RequestParam Ġrel ID : ĠUUID ): ĠComposite Relationship Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠUtils . return Or Exception ( relationship Service . get Composite Relationship ( rel ID )) ĊĊĠĠĠ Ġ@ RequestMapping ( method Ġ= Ġ[ Request Method . GET ], Ġvalue Ġ= Ġ["/ getUser Active Composite Relationship "], Ġproduces Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġfun ĠgetUser Active Composite Relationship (@ RequestParam ĠuserID : ĠUUID ): ĠComposite Relationship Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠUtils . return Or Exception ( relationship Service . getActive User Composite Relationship ( userID )) ĊĊĠĠĠ Ġ@ RequestMapping ( method Ġ= Ġ[ Request Method . GET ], Ġvalue Ġ= Ġ["/ getFull Relationship Data "], Ġproduces Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġfun Ġget Full Relationship Data (@ RequestParam Ġrel ID : ĠUUID ): ĠFull Relationship Data Ġ= ĠUtils . return Or Exception ( relationship Service . getFull Relationship Data ( rel ID )) ĊĊĠĠĠ Ġ@ RequestMapping ( method Ġ= Ġ[ Request Method . GET ], Ġvalue Ġ= Ġ["/ getFull Relationship Data By G iving User "], Ġproduces Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġfun Ġget Full Relationship Data By G iving User (@ RequestParam Ġrel ID : ĠUUID , Ġ@ RequestParam Ġgiving UserID : ĠUUID ): ĠFull Relationship Data Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠUtils . return Or Exception ( relationship Service . getFull Relationship Data ( rel ID , Ġgiving UserID )) ĊĊĠĠĠĠĊĠĠĠ Ġ/ ************************ * ĊĠĠĠĠ Ġ* ĠREL ATION SHIP ĠREQUEST S ĊĠĠĠĠ Ġ************************* / ĊĊĠĠĠ Ġ@ RequestMapping ( method Ġ= Ġ[ Request Method . POST ], Ġvalue Ġ= Ġ["/ create Composite Relationship Request "], Ġproduces Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġfun Ġcreate Composite Relationship Request (@ RequestBody Ġnew Request : ĠNew Relationship Request ): ĠComposite Relationship Request Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġf cm Service . send Relationship Request Notification ( relationship Service . create Relationship Request ( new Request )) ĊĊĠĠĠ Ġ@ RequestMapping ( method Ġ= Ġ[ Request Method . GET ], Ġvalue Ġ= Ġ["/ getAll Active Composite Relationship Requests "], Ġproduces Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġfun ĠgetAll Active Composite Relationship Requests (@ RequestParam ĠuserID : ĠUUID ): ĠList < Composite Relationship Request > Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠUtils . return Or Exception ( relationship Service . getAll Active Composite Relationship Requests ( userID )) ĊĊĠĠĠ Ġ@ RequestMapping ( method Ġ= Ġ[ Request Method . PATCH ], Ġvalue Ġ= Ġ["/ set Final Composite Relationship Request Status "], Ġproduces Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġfun Ġset Final Composite Relationship Request Status (@ RequestParam Ġrequest ID : ĠUUID , Ġ@ RequestParam Ġfinal Status : ĠString ): ĠComposite Relationship Request Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcomposite Relationship Request Ġ= Ġrelationship Service . set Final Relationship Request Status ( request ID , Ġfinal Status ) ĊĊĠĠĠĠĠĠĠ Ġreturn Ġif Ġ( final Status Ġ== ĠRequest Parameters . REL ATION SHIP _ REQUEST _ rel _ request _ status _ accepted Ġ&& Ġcomposite Relationship Request . relationship Request Status Ġ== ĠRequest Parameters . REL ATION SHIP _ REQUEST _ rel _ request _ status _ accepted ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġf cm Service . send New Relationship Notification ( composite Relationship Request ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġf cm Service . send Relationship Request Negative Notification ( composite Relationship Request ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ/ ************************ * ĊĠĠĠĠ Ġ* ĠREL ATION SHIP ĠBRE AK UP ĊĠĠĠĠ Ġ************************* / ĊĊĠĠĠ Ġ@ RequestMapping ( method Ġ= Ġ[ Request Method . POST ], Ġvalue Ġ= Ġ["/ request Composite Relationship Break up "], Ġproduces Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġfun Ġrequest Composite Relationship Break up (@ RequestBody Ġnew Break up Request : ĠNew Relationship Break up Request ): ĠComposite Relationship Break up Request Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġf cm Service . send Relationship Break up Update ( relationship Service . request Composite Relationship Break up ( new Break up Request )) ĊĊĠĠĠ Ġ@ RequestMapping ( method Ġ= Ġ[ Request Method . GET ], Ġvalue Ġ= Ġ["/ getActive Composite Relationship Break up Request "], Ġproduces Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġfun Ġget Active Composite Relationship Break up Request (@ RequestParam Ġrel ID : ĠUUID ): ĠComposite Relationship Break up Request Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠUtils . return Or Exception ( relationship Service . getActive Composite Relationship Break up ( rel ID )) ĊĊĠĠĠ Ġ@ RequestMapping ( method Ġ= Ġ[ Request Method . PATCH ], Ġvalue Ġ= Ġ["/ set Final Composite Relationship Break up Request Status "], Ġproduces Ġ= Ġ[ MediaType . APPLICATION _ JSON _ VALUE ]) ĊĠĠĠ Ġfun Ġset Final Composite Relationship Break up Request Status (@ RequestParam Ġrequest ID : ĠUUID , Ġ@ RequestParam Ġfinal Status : ĠString ): ĠComposite Relationship Break up Request Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġf cm Service . send Relationship Break up Update ( relationship Service . set Final Relationship Break up Request Status ( request ID , Ġfinal Status )) Ċ }