package Ġcom . template . flows Ċ Ċ import Ġco . parallel universe . fib ers . Suspend able Ċ import Ġcom . template . contracts . Send Contract Ċ import Ġcom . template . states . State Contract Ċ import Ġnet . cord a . core . contracts . Command Ċ import Ġnet . cord a . core . contracts . require That Ċ import Ġnet . cord a . core . crypto . Secure Hash Ċ import Ġnet . cord a . core . flows .* Ċ import Ġnet . cord a . core . identity . C ord a X 5 0 0 Name Ċ import Ġnet . cord a . core . serialization . C ord a Serializable Ċ import Ġnet . cord a . core . transactions . Signed Transaction Ċ import Ġnet . cord a . core . transactions . Transaction Builder Ċ Ċ object ĠMark Flows Ċ { ĊĠĠĠ Ġ@ Initi ating Flow ĊĠĠĠ Ġ@ Start able By RPC ĊĠĠĠ Ġ@ C ord a Serializable ĊĠĠĠ Ġclass ĠMark Flow ( val Ġattachment Hash : ĠSecure Hash , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġname : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmark : ĠInt ) Ġ: ĠFlow Logic < Signed Transaction >() Ġ{ ĊĠĠĠĠĠĠĠ Ġ/** ĠThe Ġflow Ġlogic Ġis Ġencaps ulated Ġwithin Ġthe Ġcall () Ġmethod . Ġ*/ ĊĠĠĠĠĠĠĠ Ġ@ Suspend able ĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġcall (): ĠSigned Transaction Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠWe Ġretrieve Ġthe Ġnot ary Ġidentity Ġfrom Ġthe Ġnetwork Ġmap . ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġnot ary Ġ= Ġservice Hub . network Map Cache . not ary Id entities [ 0 ] ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval ĠnodeName Ġ= ĠC ord a X 5 0 0 Name (" Party E ", Ġ" New ĠYork ", Ġ" US ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġother Party Ġ= Ġservice Hub . network Map Cache . get Peer By Legal Name ( nodeName ) !! ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġinput State Ġ= Ġservice Hub . vault Service . query By ( State Contract . Send State :: class . java ). states ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. filter Ġ{ Ġit Ġ-> Ġit . state . data . hash Ġ== Ġattachment Hash Ġ} [ 0 ] ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// ĠGenerate Ġan Ġunsigned Ġtransaction . ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmark State Ġ= ĠState Contract . Mark State ( attachment Hash , Ġname , Ġmark , Ġour Identity , Ġother Party ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġtx Command Ġ= ĠCommand ( Send Contract . Create (), Ġmark State . participants . map Ġ{ Ġit . own ing Key Ġ}) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġtx Builder Ġ= ĠTransaction Builder ( not ary ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Attachment ( attachment Hash ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Input State ( input State ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Output State ( mark State , Ġ" com . template . contracts . Mark Contract ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Command ( tx Command ) ĊĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġtx Builder . verify ( service Hub ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġpart Signed Tx Ġ= Ġservice Hub . sign Initial Transaction ( tx Builder ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġother Party Flow Ġ= Ġinitiate Flow ( other Party ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfully Signed Tx Ġ= Ġsub Flow ( Collect Signatures Flow ( part Signed Tx , Ġset Of ( other Party Flow ))) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġsub Flow ( Final ity Flow ( fully Signed Tx )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Initi ated By ( Mark Flow :: class ) ĊĠĠĠ Ġclass ĠMark Flow Responder ( val Ġother Party Session : ĠFlow Session ) Ġ: ĠFlow Logic < Signed Transaction >() Ġ{ ĊĠĠĠĠĠĠĠ Ġ@ Suspend able ĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġcall () Ġ: ĠSigned Transaction Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġsign Transaction Flow Ġ= Ġobject Ġ: ĠSign Transaction Flow ( other Party Session ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġoverride Ġfun Ġcheck Transaction ( st x : ĠSigned Transaction ) Ġ= Ġrequire That Ġ{ ĊĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġsub Flow ( sign Transaction Flow ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }