Project

General

Profile

1
#0. READ EVERYTHING BEFORE RUNNING ANY XUPDATE
2
#1. Take all transformation workflows and change the arc to select the currently non existing node "selectIncrementalTransformation"
3

    
4
for $x in collection('/db/DRIVER/WorkflowDSResources/WorkflowDSResourceType')
5
let $arc := $x[.//WORKFLOW_NAME='transform']/RESOURCE_PROFILE/BODY/CONFIGURATION/NODE[./@type='SetProviderInfo' and ./@isStart='true']/ARCS/ARC[./@to ='fetchOriginals']
6
return update value $arc/@to with 'selectIncrementalTransformation'
7

    
8
#2. Now we add the missing node just after the start node
9

    
10
for $x in collection('/db/DRIVER/WorkflowDSResources/WorkflowDSResourceType')
11
let $startnode := $x[.//WORKFLOW_NAME='transform']/RESOURCE_PROFILE/BODY/CONFIGURATION/NODE[./@type='SetProviderInfo' and ./@isStart='true']
12
return update insert
13
<NODE name="selectIncrementalTransformation" type="IncrementalTransformation">
14
	<DESCRIPTION>Decide REFRESH/INCREMENTAL transformation</DESCRIPTION>
15
	<PARAMETERS>
16
		<PARAM required="true" type="string" name="operationType" managedBy="user" function="validValues(['REFRESH','INCREMENTAL'])">INCREMENTAL</PARAM>
17
	</PARAMETERS>
18
	<ARCS>
19
		<ARC to="fetchOriginals"/>
20
	</ARCS>
21
</NODE>
22
following $startnode
23

    
24
In case there are nodes with the wrong parameter name (transformationType instead of operationType), do not worry.
25
It is a left over from previous migration and you can fix it running this xquery:
26

    
27
for $x in collection('/db/DRIVER/WorkflowDSResources/WorkflowDSResourceType')
28
let $transNode := $x[.//WORKFLOW_NAME='transform']/RESOURCE_PROFILE/BODY/CONFIGURATION/NODE[./@type='IncrementalTransformation']
29
let $param := $transNode/PARAMETERS/PARAM[@name='transformationType']
30
return update value $param/@name with 'operationType'
31

    
32
NOTE: if there are already incremental workflows, the xupdate in #2. will screw them up
33
creating a duplicate IncrementalTransformation node that must be deleted.
34
You can look for this workflows with the following xquery:
35

    
36
for $x in collection('/db/DRIVER/WorkflowDSResources/WorkflowDSResourceType')
37
where (count($x[.//NODE/@name='selectIncrementalTransformation']) > 1) return $x
(2-2/24)