/* - Ċ Ġ* Ġ============ LICENSE _ START ================================================ ======= Ċ Ġ* ĠV ID Ċ Ġ* Ġ================================================================= =============== Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 7 Ġ- Ġ 2 0 1 9 ĠAT & T ĠIntel lectual ĠProperty . ĠAll Ġrights Ġreserved . Ċ Ġ* Ġ================================================================= =============== Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ* Ġ============ LICENSE _ END ================================================ ========= Ċ Ġ*/ Ċ Ċ package Ġorg . on ap . vid . job . command Ċ Ċ import Ġorg . on ap . portal sdk . core . logging . logic . E ELF Logger Delegate Ċ import Ġorg . on ap . vid . job . Job Ċ import Ġorg . on ap . vid . job . Job Adapter Ċ import Ġorg . on ap . vid . job . Job Command Ċ import Ġorg . on ap . vid . job . Jobs Broker Service Ċ import Ġorg . on ap . vid . model . service Instantiation . Base Resource Ċ import Ġorg . on ap . vid . model . service Instantiation . Instance Group Ċ import Ġorg . on ap . vid . mso . Rest Mso Implementation Ċ import Ġorg . on ap . vid . services . Async Instantiation Business Logic Ċ import Ġorg . springframework . beans . factory . annotation . Autowired Ċ import Ġorg . springframework . beans . factory . config . Configurable BeanFactory Ċ import Ġorg . springframework . context . annotation . Scope Ċ import Ġorg . springframework . http . HttpMethod Ċ import Ġorg . springframework . stereotype . Component Ċ import Ġorg . to g gl z . core . manager . Feature Manager Ċ import Ġjava . util .* Ċ Ċ @ Component Ċ @ Scope ( Configurable BeanFactory . SCOPE _ PRO TOT YPE ) Ċ class ĠInstance Group Command Ġ@ Autowired Ġconstructor ( ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġasync Instantiation BL : ĠAsync Instantiation Business Logic , ĊĠĠĠĠĠĠĠ Ġrest Mso : ĠRest Mso Implementation , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġm so RequestBuilder : ĠM so RequestBuilder , ĊĠĠĠĠĠĠĠ Ġm so Result Handler Service : ĠM so Result Handler Service , ĊĠĠĠĠĠĠĠ Ġin Progress Status Service : InProgress Status Service , ĊĠĠĠĠĠĠĠ Ġwatch Children Jobs BL : ĠWatch Children Jobs BL , ĊĠĠĠĠĠĠĠ Ġjobs Broker Service : ĠJobs Broker Service , ĊĠĠĠĠĠĠĠ Ġjob Adapter : ĠJob Adapter , ĊĠĠĠĠĠĠĠ Ġfeature Manager : ĠFeature Manager Ċ ) Ġ: ĠResource Command ( rest Mso , Ġin Progress Status Service , Ġm so Result Handler Service , ĊĠĠĠĠĠĠĠ Ġwatch Children Jobs BL , Ġjobs Broker Service , Ġjob Adapter , Ġfeature Manager ), ĠJob Command Ġ{ ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġprivate Ġval ĠLOGGER Ġ= ĠE ELF Logger Delegate . getLogger ( Instance Group Command :: class . java ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġcreate Children (): ĠJob . JobStatus Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġdata For Child Ġ= Ġbuild Data For Child ( getRequest (), Ġaction Phase ) ĊĊĠĠĠĠĠĠĠ Ġchild Jobs Ġ= Ġpush Children Jobs To Broker ( getRequest (). v nf Group Members . values , Ġdata For Child ); ĊĊĠĠĠĠĠĠĠ Ġreturn ĠJob . JobStatus . COMPLETED _ WITH _ NO _ ACTION ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġadd My self To Children Data ( command Parent Data : ĠCommand Parent Data , Ġrequest : ĠBase Resource ) Ġ{ ĊĠĠĠĠĠĠĠ Ġcommand Parent Data . add InstanceId ( Command Parent Data . Command Data Key . V NF _ GROUP _ INSTANCE _ ID , Ġrequest . instanceId ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġplan Create My self Rest Call ( command Parent Data : ĠCommand Parent Data , Ġrequest : ĠJob Adapter . Async JobRequest , ĠuserId : ĠString , Ġtest Api : ĠString ?): ĠM so Rest Call Plan Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġservice InstanceId Ġ= Ġservice InstanceId From Request () ĊĊĠĠĠĠĠĠĠ Ġval Ġinstantiate Path Ġ= Ġasync Instantiation BL . getInstance Group Instantiation Path () ĊĊĠĠĠĠĠĠĠ Ġval Ġrequest Details Wrapper Ġ= Ġm so RequestBuilder . generate Instance Group Instantiation Request ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġrequest Ġas ĠInstance Group , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġservice Model Info From Request (), Ġservice InstanceId , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠuserId , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġtest Api ĊĠĠĠĠĠĠĠ Ġ) ĊĊĠĠĠĠĠĠĠ Ġval Ġaction Description Ġ= Ġ" create Ġinstance Ġgroup Ġin Ġ$ service InstanceId " ĊĊĠĠĠĠĠĠĠ Ġreturn ĠM so Rest Call Plan ( HttpMethod . POST , Ġinstantiate Path , ĠOptional . of ( request Details Wrapper ), ĠOptional . empty (), Ġaction Description ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġplan Delete My self Rest Call ( command Parent Data : ĠCommand Parent Data , Ġrequest : ĠJob Adapter . Async JobRequest , ĠuserId : ĠString ): ĠM so Rest Call Plan Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġpath Ġ= Ġasync Instantiation BL . getInstance Group Delete Path ( getRequest (). instanceId ) ĊĠĠĠĠĠĠĠ Ġreturn ĠM so Rest Call Plan ( HttpMethod . DELETE , Ġpath , ĠOptional . empty (), ĠOptional . of ( userId ), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" delete Ġinstance Ġgroup Ġwith Ġid Ġ${ getRequest (). instanceId }") ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġget Request (): ĠInstance Group Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġshared Data . request Ġas ĠInstance Group ĊĠĠĠ Ġ} Ċ }