package Ġcom . template . flows Ċ Ċ import Ġco . parallel universe . fib ers . Suspend able Ċ import Ġcom . template . contracts . Car Contract Ċ import Ġcom . template . states . Car State Ċ import Ġnet . cord a . core . contracts . Command Ċ import Ġnet . cord a . core . contracts . Requirements . using Ċ import Ġnet . cord a . core . contracts . Unique Identifier Ċ import Ġnet . cord a . core . contracts . require That Ċ import Ġnet . cord a . core . flows .* Ċ import Ġnet . cord a . core . identity . Abstract Party Ċ import Ġnet . cord a . core . identity . C ord a X 5 0 0 Name Ċ import Ġnet . cord a . core . identity . Party Ċ import Ġnet . cord a . core . node . services . query By Ċ import Ġnet . cord a . core . node . services . vault . Query Criteria Ċ import Ġnet . cord a . core . transactions . Signed Transaction Ċ import Ġnet . cord a . core . transactions . Transaction Builder Ċ import Ġnet . cord a . core . utilities . Progress Tracker ĊĊ Ċ @ Initi ating Flow Ċ @ Start able By RPC Ċ class ĠCar Issue Init iator ( val Ġow ning Bank : ĠParty , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġholding Dealer : ĠParty , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmanufacturer : ĠParty , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġvin : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġlicense Plate Number : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmake : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmodel : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġdeal ership Location : ĠString ) Ġ: ĠFlow Logic < Signed Transaction >() Ġ{ ĊĊĠĠĠ Ġ@ Suspend able ĊĠĠĠ Ġoverride Ġfun Ġcall (): ĠSigned Transaction Ġ{ ĊĊĠĠĠĠĠĠĠ Ġval Ġnot ary Ġ= Ġservice Hub . network Map Cache . not ary Id entities . single () ĊĠĠĠĠĠĠĠ Ġval Ġcommand Ġ= ĠCommand ( Car Contract . Commands . Issue (), ĠlistOf ( own ing Bank , Ġholding Dealer , Ġmanufacturer ). map Ġ{ Ġit . own ing Key Ġ}) ĊĠĠĠĠĠĠĠ Ġval Ġcar State Ġ= ĠCar State ( own ing Bank , Ġholding Dealer , Ġmanufacturer , Ġvin , Ġlicense Plate Number , Ġmake , Ġmodel , Ġdeal ership Location , ĠUnique Identifier ()) ĊĊĠĠĠĠĠĠĠ Ġval Ġtx Builder Ġ= ĠTransaction Builder ( not ary ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Output State ( car State , ĠCar Contract . ID ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Command ( command ) ĊĊĠĠĠĠĠĠĠ Ġtx Builder . verify ( service Hub ) ĊĠĠĠĠĠĠĠ Ġval Ġtx Ġ= Ġservice Hub . sign Initial Transaction ( tx Builder ) ĊĊĠĠĠĠĠĠĠ Ġval Ġsessions Ġ= Ġ( car State . participants Ġ- Ġour Identity ). map Ġ{ Ġinitiate Flow ( it Ġas ĠParty ) Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġst x Ġ= Ġsub Flow ( Collect Signatures Flow ( tx , Ġsessions )) ĊĠĠĠĠĠĠĠ Ġreturn Ġsub Flow ( Final ity Flow ( st x , Ġsessions )) ĊĊĠĠĠ Ġ} Ċ } Ċ Ċ @ Initi ated By ( Car Issue Init iator :: class ) Ċ class ĠCar Issue Responder ( val Ġcounter party Session : ĠFlow Session ) Ġ: ĠFlow Logic < Signed Transaction >() Ġ{ ĊĊĠĠĠ Ġ@ Suspend able ĊĠĠĠ Ġoverride Ġfun Ġcall (): ĠSigned Transaction Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġsigned Transaction Flow Ġ= Ġobject Ġ: ĠSign Transaction Flow ( counter party Session ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġcheck Transaction ( st x : ĠSigned Transaction ) Ġ= Ġrequire That Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġoutput Ġ= Ġst x . tx . outputs . single (). data ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" The Ġoutput Ġmust Ġbe Ġa ĠCar State " Ġusing Ġ( output Ġis ĠCar State ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġtx We Just Signed Id Ġ= Ġsub Flow ( signed Transaction Flow ) ĊĠĠĠĠĠĠĠ Ġreturn Ġsub Flow ( Receive Final ity Flow ( counter party Session , Ġtx We Just Signed Id . id )) ĊĠĠĠ Ġ} Ċ }