From 98b0ebafb034451d383f5965b5aa66526c834f6d Mon Sep 17 00:00:00 2001
From: Pavol Mederly <mederly@evolveum.com>
Date: Tue, 28 Apr 2020 10:32:44 +0200
Subject: [PATCH] Upgrade the distribution to 4.1

These changes were not tested yet.
---
 .../tasks/task-async-update-grouper.xml       |   8 +-
 .../tasks/task-import-sis-persons.xml         |   4 +-
 .../tasks/task-recomputation-users.xml        |  13 +-
 .../task-reconciliation-grouper-groups.xml    |   7 +-
 .../SystemConfiguration.xml                   | 278 ++++++++++++++++++
 .../tasks/995-task-group-scavenger.xml        |   5 +-
 download-midpoint.sh                          |  10 +-
 7 files changed, 305 insertions(+), 20 deletions(-)

diff --git a/demo/grouper/midpoint-objects-manual/tasks/task-async-update-grouper.xml b/demo/grouper/midpoint-objects-manual/tasks/task-async-update-grouper.xml
index e322f12..51c21a4 100644
--- a/demo/grouper/midpoint-objects-manual/tasks/task-async-update-grouper.xml
+++ b/demo/grouper/midpoint-objects-manual/tasks/task-async-update-grouper.xml
@@ -16,24 +16,22 @@
 
 <task xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
 	  xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
-	  xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
 	  xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
-	  xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
-	  xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
-	  xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
 	  oid="47fc57bd-8c34-4555-9b9f-7087ff179860">
 	<name>Grouper async updates</name>
 	<extension xmlns:mext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3"
 			   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ExtensionType">
 		<mext:workerThreads>1</mext:workerThreads>
 	</extension>
+	<assignment>
+		<targetRef oid="00000000-0000-0000-0000-000000000505" type="ArchetypeType" /> <!-- Asynchronous update task -->
+	</assignment>
 	<taskIdentifier>1552664339630-0-2</taskIdentifier>
 	<ownerRef oid="00000000-0000-0000-0000-000000000002" relation="org:default" type="c:UserType">
 		<!-- administrator -->
 	</ownerRef>
 	<executionStatus>runnable</executionStatus>
 	<category>AsynchronousUpdate</category>
-	<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/async-update/handler-3</handlerUri>
 	<objectRef oid="1eff65de-5bb6-483d-9edf-8cc2c2ee0233" relation="org:default" type="c:ResourceType">
 		<!-- Grouper Resource -->
 	</objectRef>
diff --git a/demo/grouper/midpoint-objects-manual/tasks/task-import-sis-persons.xml b/demo/grouper/midpoint-objects-manual/tasks/task-import-sis-persons.xml
index ebeb5df..5d98701 100644
--- a/demo/grouper/midpoint-objects-manual/tasks/task-import-sis-persons.xml
+++ b/demo/grouper/midpoint-objects-manual/tasks/task-import-sis-persons.xml
@@ -16,13 +16,15 @@
           <interval>500</interval>
       </mext:tracing>
    </extension>
+   <assignment>
+      <targetRef oid="00000000-0000-0000-0000-000000000503" type="ArchetypeType" /> <!--Import task-->
+   </assignment>
    <taskIdentifier>1535407239440-0-1</taskIdentifier>
    <ownerRef oid="00000000-0000-0000-0000-000000000002"
              relation="org:default"
              type="c:UserType"><!-- administrator --></ownerRef>
    <executionStatus>runnable</executionStatus>
    <category>ImportingAccounts</category>
-   <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/import/handler-3</handlerUri>
    <objectRef oid="4d70a0da-02dd-41cf-b0a1-00e75d3eaa15"
               relation="org:default"
               type="c:ResourceType"><!-- SQL SIS persons (sources) --></objectRef>
diff --git a/demo/grouper/midpoint-objects-manual/tasks/task-recomputation-users.xml b/demo/grouper/midpoint-objects-manual/tasks/task-recomputation-users.xml
index fc643ef..53657dd 100644
--- a/demo/grouper/midpoint-objects-manual/tasks/task-recomputation-users.xml
+++ b/demo/grouper/midpoint-objects-manual/tasks/task-recomputation-users.xml
@@ -1,9 +1,17 @@
-<task xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3" xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3" xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3" xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3" xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" oid="83a737ea-5eb7-4e78-b431-331cccf02354">
+<task xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
+      xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
+      xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
+      oid="83a737ea-5eb7-4e78-b431-331cccf02354">
     <name>User recomputation</name>
-    <extension xmlns:mext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xsi:type="c:ExtensionType">
+    <extension xmlns:mext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xsi:type="c:ExtensionType">
         <mext:objectType>c:UserType</mext:objectType>
         <mext:tracingInterval>200</mext:tracingInterval>
     </extension>
+    <assignment>
+        <targetRef oid="00000000-0000-0000-0000-000000000502" type="ArchetypeType"/> <!--Recomputation task -->
+    </assignment>
     <taskIdentifier>1571729899646-0-1</taskIdentifier>
     <ownerRef oid="00000000-0000-0000-0000-000000000002" relation="org:default" type="c:UserType">
         <!-- administrator -->
@@ -11,7 +19,6 @@
     <channel>http://midpoint.evolveum.com/xml/ns/public/provisioning/channels-3#recompute</channel>
     <executionStatus>runnable</executionStatus>
     <category>Recomputation</category>
-    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/recompute/handler-3</handlerUri>
     <workManagement>
         <taskKind>standalone</taskKind>
         <buckets>
diff --git a/demo/grouper/midpoint-objects-manual/tasks/task-reconciliation-grouper-groups.xml b/demo/grouper/midpoint-objects-manual/tasks/task-reconciliation-grouper-groups.xml
index c3ddcda..b6544ff 100644
--- a/demo/grouper/midpoint-objects-manual/tasks/task-reconciliation-grouper-groups.xml
+++ b/demo/grouper/midpoint-objects-manual/tasks/task-reconciliation-grouper-groups.xml
@@ -16,24 +16,23 @@
 
 <task xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
 	  xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
-	  xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
 	  xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
-	  xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
 	  xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
-	  xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
 	  oid="605a0127-a313-442a-9d5e-151eac8b0745">
 	<name>Grouper reconciliation (groups)</name>
 	<extension xmlns:mext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3"
 			   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ExtensionType">
 		<mext:objectclass>ri:Group</mext:objectclass>
 	</extension>
+	<assignment>
+		<targetRef oid="00000000-0000-0000-0000-000000000501" type="ArchetypeType" /> <!-- Reconciliation task -->
+	</assignment>
 	<taskIdentifier>605a0127-a313-442a-9d5e-151eac8b0745</taskIdentifier>
 	<ownerRef oid="00000000-0000-0000-0000-000000000002" relation="org:default" type="c:UserType">
 		<!-- administrator -->
 	</ownerRef>
 	<executionStatus>runnable</executionStatus>
 	<category>Reconciliation</category>
-	<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/reconciliation/handler-3</handlerUri>
 	<objectRef oid="1eff65de-5bb6-483d-9edf-8cc2c2ee0233" relation="org:default" type="c:ResourceType">
 		<!-- Grouper Resource -->
 	</objectRef>
diff --git a/demo/grouper/midpoint_server/container_files/mp-home/post-initial-objects/systemConfigurations/SystemConfiguration.xml b/demo/grouper/midpoint_server/container_files/mp-home/post-initial-objects/systemConfigurations/SystemConfiguration.xml
index ec86810..7355929 100644
--- a/demo/grouper/midpoint_server/container_files/mp-home/post-initial-objects/systemConfigurations/SystemConfiguration.xml
+++ b/demo/grouper/midpoint_server/container_files/mp-home/post-initial-objects/systemConfigurations/SystemConfiguration.xml
@@ -252,6 +252,284 @@
             <color>purple</color>
             <authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#resources</authorization>
         </userDashboardLink>
+        <objectCollectionViews>
+            <objectCollectionView>
+                <identifier>my-cases</identifier>
+                <display>
+                    <label>My cases</label>
+                    <!-- We need to explicitly specify plural label here. Otherwise it will be overwritten by a plural label from archetype. -->
+                    <pluralLabel>My cases</pluralLabel>
+                    <singularLabel>My case</singularLabel>
+                    <icon>
+                        <cssClass>fe fe-case-object</cssClass>
+                    </icon>
+                </display>
+                <displayOrder>1000</displayOrder>
+                <type>CaseType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000344" relation="org:default" type="c:ObjectCollectionType">
+                    </collectionRef>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>manual-case-view</identifier>
+                <display>
+                    <label>Manual cases</label> <!-- "Manual provisioning cases" is too long for the menu -->
+                    <!-- We need to explicitly specify plural label here. Otherwise it will be overwritten by a plural label from archetype. -->
+                    <pluralLabel>All manual cases</pluralLabel>
+                    <singularLabel>Manual case</singularLabel>
+                    <tooltip>Manual provisioning cases</tooltip>
+                </display>
+                <displayOrder>1010</displayOrder>
+                <type>CaseType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000340" relation="org:default" type="c:ArchetypeType">
+                    </collectionRef>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>operation-request-case-view</identifier>
+                <display>
+                    <label>Requests</label> <!-- "Operation requests" is too long for the menu -->
+                    <!-- We need to explicitly specify plural label here. Otherwise it will be overwritten by a plural label from archetype. -->
+                    <pluralLabel>All requests</pluralLabel>
+                    <singularLabel>Request</singularLabel>
+                    <tooltip>Operation requests</tooltip>
+                </display>
+                <displayOrder>1020</displayOrder>
+                <type>CaseType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000341" relation="org:default" type="c:ArchetypeType">
+                    </collectionRef>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>approval-case-view</identifier>
+                <display>
+                    <label>Approvals</label> <!-- "Approval cases" is too long for the menu -->
+                    <!-- We need to explicitly specify plural label here. Otherwise it will be overwritten by a plural label from archetype. -->
+                    <pluralLabel>All approvals</pluralLabel>
+                    <singularLabel>Approval</singularLabel>
+                    <tooltip>Approval cases</tooltip>
+                </display>
+                <displayOrder>1030</displayOrder>
+                <type>CaseType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000342" relation="org:default" type="c:ArchetypeType">
+                    </collectionRef>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>reconciliation-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000501" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>recomputation-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000502" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>import-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000503" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>live-sync-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000504" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>async-update-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000505" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>cleanup-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000506" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>report-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000507" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>single-bulk-action-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000508" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>iterative-bulk-action-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000509" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>certification-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000520" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>approval-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000521" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>utility-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000528" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+            <objectCollectionView>
+                <identifier>system-tasks-view</identifier>
+                <refreshInterval>30</refreshInterval>
+                <type>TaskType</type>
+                <collection>
+                    <collectionRef oid="00000000-0000-0000-0000-000000000529" relation="org:default" type="c:ArchetypeType"/>
+                </collection>
+            </objectCollectionView>
+        </objectCollectionViews>
+        <objectDetails>
+            <objectDetailsPage>
+                <type>c:TaskType</type>
+                <container>
+                    <displayOrder>150</displayOrder>
+                    <display>
+                        <label>Advanced options</label>
+                    </display>
+                    <item>
+                        <c:path>cleanupAfterCompletion</c:path>
+                    </item>
+                    <item>
+                        <c:path>threadStopAction</c:path>
+                    </item>
+                    <item>
+                        <c:path>binding</c:path>
+                    </item>
+                    <item>
+                        <c:path>dependent</c:path>
+                    </item>
+                </container>
+                <container>
+                    <displayOrder>900</displayOrder>
+                    <display>
+                        <label>Operational attributes (state)</label>
+                    </display>
+                    <item>
+                        <c:path>executionStatus</c:path>
+                    </item>
+                    <item>
+                        <c:path>node</c:path>
+                    </item>
+                    <item>
+                        <c:path>nodeAsObserved</c:path>
+                    </item>
+                    <item>
+                        <c:path>resultStatus</c:path>
+                    </item>
+                    <item>
+                        <c:path>result</c:path>
+                    </item>
+                    <item>
+                        <c:path>nextRunStartTimestamp</c:path>
+                    </item>
+                    <item>
+                        <c:path>nextRetryTimestamp</c:path>
+                    </item>
+                    <item>
+                        <c:path>unpauseAction</c:path>
+                    </item>
+                    <item>
+                        <c:path>taskIdentifier</c:path>
+                    </item>
+                    <item>
+                        <c:path>parent</c:path>
+                    </item>
+                    <item>
+                        <c:path>waitingReason</c:path>
+                    </item>
+                    <item>
+                        <c:path>stateBeforeSuspend</c:path>
+                    </item>
+                    <item>
+                        <c:path>category</c:path>
+                    </item>
+                    <item>
+                        <c:path>otherHandlersUriStack</c:path>
+                    </item>
+                    <item>
+                        <c:path>channel</c:path>
+                    </item>
+                    <item>
+                        <c:path>subtaskRef</c:path>
+                    </item>
+                    <item>
+                        <c:path>dependentTaskRef</c:path>
+                    </item>
+                    <item>
+                        <c:path>lastRunStartTimestamp</c:path>
+                    </item>
+                    <item>
+                        <c:path>lastRunFinishTimestamp</c:path>
+                    </item>
+                    <item>
+                        <c:path>completionTimestamp</c:path>
+                    </item>
+                </container>
+                <container>
+                    <displayOrder>910</displayOrder>
+                    <visibility>hidden</visibility>
+                    <display>
+                        <label>Operational attributes (progress)</label>
+                    </display>
+                    <item>
+                        <c:path>progress</c:path>
+                    </item>
+                    <item>
+                        <c:path>expectedTotal</c:path>
+                    </item>
+                    <item>
+                        <c:path>stalledSince</c:path>
+                    </item>
+                </container>
+
+            </objectDetailsPage>
+        </objectDetails>
         <enableExperimentalFeatures>true</enableExperimentalFeatures>
     </adminGuiConfiguration>
     <workflowConfiguration>
diff --git a/demo/grouper/midpoint_server/container_files/mp-home/post-initial-objects/tasks/995-task-group-scavenger.xml b/demo/grouper/midpoint_server/container_files/mp-home/post-initial-objects/tasks/995-task-group-scavenger.xml
index 60f9852..50c98af 100644
--- a/demo/grouper/midpoint_server/container_files/mp-home/post-initial-objects/tasks/995-task-group-scavenger.xml
+++ b/demo/grouper/midpoint_server/container_files/mp-home/post-initial-objects/tasks/995-task-group-scavenger.xml
@@ -16,7 +16,6 @@ Looks for groups with the lifecycleState of 'retired' and completes their deleti
 <task xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
 	  xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
 	  xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
-	  xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
 	  xmlns:s="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3"
 	  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	  xmlns:mext="http://midpoint.evolveum.com/xml/ns/public/model/extension-3"
@@ -74,10 +73,12 @@ Looks for groups with the lifecycleState of 'retired' and completes their deleti
 			</q:filter>
 		</mext:objectQuery>
 	</extension>
+	<assignment>
+		<targetRef oid="00000000-0000-0000-0000-000000000509" type="ArchetypeType" /> <!-- Iterative bulk action task -->
+	</assignment>
 	<ownerRef oid="00000000-0000-0000-0000-000000000002"/>
 	<executionStatus>runnable</executionStatus>
 	<category>BulkActions</category>
-	<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/iterative-scripting/handler-3</handlerUri>
 	<recurrence>recurring</recurrence>
 	<schedule>
 		<interval>60</interval>
diff --git a/download-midpoint.sh b/download-midpoint.sh
index ecc3f1e..c317e1b 100755
--- a/download-midpoint.sh
+++ b/download-midpoint.sh
@@ -6,11 +6,11 @@ if [[ -n "$1" ]]; then
   MP_VERSION=$1
 else
   if [[ $tag == "latest" ]]; then
-    # Was: 4.0.1
-    #
-    # But we need to incorporate latest changes to I2 distribution during
-    # the development of 4.1. Therefore we use a custom build here.
-    MP_VERSION="latest-stable"
+    # Normally we use last released midPoint version number here, e.g. "4.1".
+    # But if we need to incorporate interim changes to I2 distribution during
+    # midPoint development cycle, we can specify concrete file from "midpoint-tier"
+    # download directory by using its name (like "latest-stable").
+    MP_VERSION="4.1"
   else
     MP_VERSION=$tag
   fi