+
+ protected fun buildDataForChild(request: BaseResource, actionPhase: Action): Map<String, Any> {
+ addMyselfToChildrenData(commandParentData, request)
+ commandParentData.setActionPhase(actionPhase)
+ return commandParentData.parentData
+ }
+
+ protected open fun addMyselfToChildrenData(commandParentData: CommandParentData, request: BaseResource) {
+ // Nothing by default
+ }
+
+ protected open fun isDescendantHasAction(phase:Action):Boolean = isDescendantHasAction(getRequest(), phase, true )
+
+
+ @JvmOverloads
+ fun isDescendantHasAction(request: BaseResource, phase: Action, isFirstLevel:Boolean=true): Boolean {
+ if (!isFirstLevel && request.action == phase) {
+ return true;
+ }
+
+ return request.children.map {this.isDescendantHasAction(it, phase, false)}.any {it}
+ }
+
+ protected fun getActualInstanceId(request: BaseResource):String =
+ if (getActionType() == Action.Create) msoResourceIds.instanceId else request.instanceId
+
+
+ protected fun pushChildrenJobsToBroker(children:Collection<BaseResource>,
+ dataForChild: Map<String, Any>,
+ jobType: JobType?=null): List<String> {
+ var counter = 0;
+ return children
+ .map {Pair(it, counter++)}
+ .map { jobAdapter.createChildJob(jobType ?: it.first.jobType, it.first, sharedData, dataForChild, it.second) }
+ .map { jobsBrokerService.add(it) }
+ .map { it.toString() }
+ }
+