/* Ċ Ġ* ĠCopyright Ġ( c ) Ġ 2 0 1 8 ĠJ uni per ĠNetworks , ĠInc . ĠAll Ġrights Ġreserved . Ċ Ġ*/ Ċ Ċ package Ġnet . j uni per . contr ail . v ro . model Ċ Ċ import Ġcom . vmware . o 1 1 n . sdk . model driven . Object Rel ater Ċ import Ġcom . vmware . o 1 1 n . sdk . model driven . Plugin Context Ċ import Ġcom . vmware . o 1 1 n . sdk . model driven . Sid Ċ import Ġnet . j uni per . contr ail . api . types . Ip am Subnet Type Ċ import Ġnet . j uni per . contr ail . api . types . Network Ip am Ċ import Ġnet . j uni per . contr ail . v ro . base . Connection Repository Ċ import Ġnet . j uni per . contr ail . v ro . config . Configuration Ċ import Ġnet . j uni per . contr ail . v ro . config . Global Draft Security Ċ import Ġnet . j uni per . contr ail . v ro . config . Global Security Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ Ċ class ĠRoot Has Connections Ġ@ Autowired Ċ constructor ( private Ġval Ġconnection Repository : ĠConnection Repository ) Ġ: ĠObject Rel ater < Connection > Ċ { ĊĠĠĠ Ġoverride Ġfun Ġfind Children ( ctx : ĠPlugin Context , Ġrelation : ĠString , Ġparent Type : ĠString , ĠparentId : ĠS id ?): ĠList < Connection > Ġ= ĊĠĠĠĠĠĠĠ Ġconnection Repository . connections Ċ } Ċ Ċ class ĠConnection Has Global Security Ġ: ĠObject Rel ater < Global Security > Ċ { ĊĠĠĠ Ġoverride Ġfun Ġfind Children ( ctx : ĠPlugin Context , Ġrelation : ĠString , Ġparent Type : ĠString , Ġid : ĠS id ) Ġ= ĊĠĠĠĠĠĠĠ ĠlistOf ( Global Security ) Ċ } Ċ Ċ class ĠConnection Has Global Draft Security Ġ: ĠObject Rel ater < Global Draft Security > Ċ { ĊĠĠĠ Ġoverride Ġfun Ġfind Children ( ctx : ĠPlugin Context , Ġrelation : ĠString , Ġparent Type : ĠString , Ġid : ĠS id ) Ġ= ĊĠĠĠĠĠĠĠ ĠlistOf ( Global Draft Security ) Ċ } Ċ Ċ class ĠConnection Has Configuration Ġ: ĠObject Rel ater < Configuration > Ċ { ĊĠĠĠ Ġoverride Ġfun Ġfind Children ( ctx : ĠPlugin Context , Ġrelation : ĠString , Ġparent Type : ĠString , Ġid : ĠS id ): ĠList < Configuration > Ġ= ĊĠĠĠĠĠĠĠ ĠlistOf ( Configuration ) Ċ } Ċ Ċ class ĠNetwork Ip am To Subnet Ġ@ Autowired Ċ constructor ( private Ġval Ġconnection Repository : ĠConnection Repository ) Ġ: ĠObject Rel ater < Ip am Subnet Type > Ċ { ĊĠĠĠ Ġoverride Ġfun Ġfind Children ( ctx : ĠPlugin Context , Ġrelation : ĠString , Ġparent Type : ĠString , Ġid : ĠS id ): ĠList < Ip am Subnet Type >? Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġvn Id Ġ= Ġid . getString (" Virtual Network ") Ġ?: Ġreturn Ġnull ĊĠĠĠĠĠĠĠ Ġval Ġconnection Ġ= Ġconnection Repository . getConnection ( id ) Ġ?: Ġreturn Ġnull ĊĠĠĠĠĠĠĠ Ġval Ġip am Ġ= Ġconnection . find < Network Ip am >( id ) Ġ?: Ġreturn Ġnull ĊĠĠĠĠĠĠĠ Ġif Ġ( ip am . ip am Subnet Method Ġ== Ġ" flat - subnet ") Ġreturn Ġnull ĊĠĠĠĠĠĠĠ Ġreturn Ġip am . virtual Network Back Refs . as Sequence (). filter Ġ{ Ġit . uuid Ġ== Ġvn Id Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. flatMap Ġ{ Ġit . attr . ip am Subnet s . as Sequence () Ġ}. toList () ĊĠĠĠ Ġ} Ċ }