<objectTemplate 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"
        xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
        oid="includes-domainGroups">
    <name>Includes - Domain Groups</name>
    <description>
        Assign additional domain groups.
    </description>
    <mapping>
        <name>Add Course Members</name>
        <source>
            <c:path xmlns:bshp="http://midpoint.bshp.edu/xml/ns/bshp">extension/bshp:academicStatus</c:path>
        </source>
        <source>
            <name>courseMembership</name>
            <c:path xmlns:bshp="http://midpoint.bshp.edu/xml/ns/bshp">extension/bshp:courseMembership</c:path>
        </source>
        <expression>
            <assignmentTargetSearch>
                <targetType>c:OrgType</targetType>
                <filter>
                    <q:text>name = `courseMembership`</q:text>
                </filter>
                <createOnDemand>true</createOnDemand>
                <populateObject>
                    <populateItem>
                        <expression>
                            <script>
                                <code>courseMembership</code>
                            </script>
                        </expression>
                        <target>
                            <c:path>name</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <script>
                                <code>courseMembership + '@bshp.edu'</code>
                            </script>
                        </expression>
                        <target>
                            <c:path>mailDomain</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <value>Course Group</value>
                        </expression>
                        <target>
                            <c:path>subtype</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <value>false</value>
                        </expression>
                        <target>
                            <c:path>requestable</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <value>false</value>
                        </expression>
                        <target>
                            <c:path>delegable</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <value>Moderate</value>
                        </expression>
                        <target>
                            <c:path>riskLevel</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <value>false</value>
                        </expression>
                        <target>
                            <c:path>tenant</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <assignmentTargetSearch>
                                <targetType>c:OrgType</targetType>
                                <oid>ldap-ouCoursesRoot</oid>
                            </assignmentTargetSearch>
                        </expression>
                        <target>
                            <c:path>assignment</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <assignmentTargetSearch>
                                <targetType>c:RoleType</targetType>
                                <oid>159cd4a7-28b1-4ae0-8194-d1606c340206</oid>
                            </assignmentTargetSearch>
                        </expression>
                        <target>
                            <c:path>assignment</c:path>
                        </target>
                    </populateItem>
                </populateObject>
            </assignmentTargetSearch>
        </expression>
        <target>
            <c:path>assignment</c:path>
        </target>
        <condition>
            <script>
                <code>academicStatus == 'Student' &amp;&amp; courseMembership != null</code>
            </script>
        </condition>
    </mapping>
    <mapping>
        <name>Add Course Managers</name>
        <source>
            <c:path xmlns:bshp="http://midpoint.bshp.edu/xml/ns/bshp">extension/bshp:academicStatus</c:path>
        </source>
        <source>
            <name>courseMembership</name>
            <c:path xmlns:bshp="http://midpoint.bshp.edu/xml/ns/bshp">extension/bshp:courseMembership</c:path>
        </source>
        <expression>
            <assignmentTargetSearch>
                <targetType>c:OrgType</targetType>
                <filter>
                    <q:text>name = `courseMembership`</q:text>
                </filter>
                <assignmentProperties>
                    <relation>org:manager</relation>
                </assignmentProperties>
                <createOnDemand>true</createOnDemand>
                <populateObject>
                    <populateItem>
                        <expression>
                            <script>
                                <code>courseMembership</code>
                            </script>
                        </expression>
                        <target>
                            <c:path>name</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <script>
                                <code>courseMembership + '@bshp.edu'</code>
                            </script>
                        </expression>
                        <target>
                            <c:path>mailDomain</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <value>Course Group</value>
                        </expression>
                        <target>
                            <c:path>subtype</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <value>false</value>
                        </expression>
                        <target>
                            <c:path>requestable</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <value>false</value>
                        </expression>
                        <target>
                            <c:path>delegable</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <value>Moderate</value>
                        </expression>
                        <target>
                            <c:path>riskLevel</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <value>false</value>
                        </expression>
                        <target>
                            <c:path>tenant</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <assignmentTargetSearch>
                                <targetType>c:OrgType</targetType>
                                <oid>ldap-ouCoursesRoot</oid>
                            </assignmentTargetSearch>
                        </expression>
                        <target>
                            <c:path>assignment</c:path>
                        </target>
                    </populateItem>
                    <populateItem>
                        <expression>
                            <assignmentTargetSearch>
                                <targetType>c:RoleType</targetType>
                                <oid>159cd4a7-28b1-4ae0-8194-d1606c340206</oid>
                            </assignmentTargetSearch>
                        </expression>
                        <target>
                            <c:path>assignment</c:path>
                        </target>
                    </populateItem>
                </populateObject>
            </assignmentTargetSearch>
        </expression>
        <target>
            <c:path>assignment</c:path>
        </target>
        <condition>
            <script>
                <code>academicStatus == 'Faculty' &amp;&amp; courseMembership != null</code>
            </script>
        </condition>
    </mapping>
</objectTemplate>
