<?xml version="1.0" encoding="utf-8"?>
<definition xmlns="http://www.xmlportletfactory.org/xml/xmlportletfactory" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xmlportletfactory.org/xml/xmlportletfactory xmlportletfactory.xsd">
<!-- 

	MultiDetailFiles.xml is an example on how to make a file detail depend on rows of other file and so own
	A real example would be something like this:
	
	We are a teacher and have to keep track of the students tasks, but there are so many that we have to
	group them by student. At the same time, we have so many students that we also need to group them by
	classroom.
	
	So finally we have a classroom file, with zero to many rows, and for each classroom row, we have 
	zero to many students related, and also, for each student row we have zero to many tasks.
	 
 -->
    <commonData>
        <client>Xmlpf</client>
        <projectName>MultiDetailFiles</projectName>
        <version>1</version>
    </commonData>
    <applications>
	<!--
    	Classrooms:
			
			Just the classroom definition. Id and name
	 -->
        <application>
			<classDef>
				<name>Classrooms</name>
				<title>Classrooms</title>
				<mode>
					<add>true</add>
					<delete>true</delete>
					<modify>true</modify>
					<browse>true</browse>
				</mode>
				<generatePortlet>true</generatePortlet>
				<restrictBy>
					<companyId>true</companyId>
					<groupId>false</groupId>
					<userId>false</userId>
				</restrictBy>
			</classDef>
			<fileDef>
				<name>Classrooms</name>
				<fields>
					<field>
						<name>classroomId</name>
						<title>Classroom Id</title>
						<type>
							<long>
								<length>5</length>
								<signed>false</signed>
								<nullable>false</nullable>
							</long>
						</type>
						<showFieldInView>false</showFieldInView>
					</field>
					<field>
						<name>classroomName</name>
						<title>Classroom Name</title>
						<type>
							<varchar>
								<length>50</length>
								<filter>true</filter>
								<order>true</order>
							</varchar>
						</type>
						<showFieldInView>true</showFieldInView>
						<required>true</required>
					</field>
				</fields>
			</fileDef>
<!-- 
	Here is where we define the conexion between classrooms and students. What is expressed just below
	means that with the classroomId field of classroom and students will be made the link, so when a
	classroom is edited  a interportlet communication message will be send with the classroomId, so
	portlets listening to it, will show only records with this field reference.
 -->			
			<detailFiles>
				<detailFile>
					<connectionFieldName>classroomId</connectionFieldName>
					<connectionTitle>Students by Classroom</connectionTitle>
					<detailFileClassName>Students</detailFileClassName>
				</detailFile>
			</detailFiles>
		</application>
	<!--
    	Students:
			
			Student definition. Id, name and the country it belongs
	 -->
        <application>
            <classDef>
                <name>Students</name>
                <title>Classroom Students</title>
                <mode>
                	<add>true</add>
                	<delete>true</delete>
                	<modify>true</modify>
                	<browse>true</browse>
                </mode>
                <generatePortlet>true</generatePortlet>
                <restrictBy>
                	<companyId>true</companyId>
                	<groupId>false</groupId>
                	<userId>false</userId>
                </restrictBy>
            </classDef>
            <fileDef>
                <name>Students</name>
                <fields>
                    <field>
                        <name>studentId</name>
                        <title>Student Id</title>
                        <type>
                            <long>
                                <length>5</length>
                                <signed>false</signed>
                                <nullable>false</nullable>
								<order>true</order> 
                            </long>
                        </type>
                        <showFieldInView>true</showFieldInView>
                    </field>
<!-- 
	classroomId is here, at the second position of this fileDef, because is	the	link 
	between Students and classrooms. See detailfiles on classrooms application. See above.
 -->                    
                    <field>
                        <name>classroomId</name>
                        <title>Classroom Id</title>
                        <type>
                            <long>
                                <length>5</length>
                                <signed>false</signed>
                                <nullable>false</nullable>
								<order>false</order> 
                            </long>
                        </type>
                        <showFieldInView>false</showFieldInView>
                    </field>
                    <field>
                        <name>studentName</name>
                        <title>Province Name</title>
                        <type>
                            <varchar>
                                <length>50</length>
                                <filter>true</filter>
                                <order>true</order>
                            </varchar>
                        </type>
                        <showFieldInView>true</showFieldInView>
                        <required>true</required>
                    </field>
                </fields>
            </fileDef>
<!-- 
	Here is where we define the connection between students and tasks.
 -->			
			<detailFiles>
				<detailFile>
					<connectionFieldName>studentId</connectionFieldName>
					<connectionTitle>Task by Students</connectionTitle>
					<detailFileClassName>Tasks</detailFileClassName>
				</detailFile>
			</detailFiles>
        </application>
	<!--
    	Tasks:
			
			Tasks definition. Id, name and the student it belongs to.
	 -->
        <application>
            <classDef>
                <name>Tasks</name>
                <title>Student Tasks</title>
                <mode>
                	<add>true</add>
                	<delete>true</delete>
                	<modify>true</modify>
                	<browse>true</browse>
                </mode>
                <generatePortlet>true</generatePortlet>
                <restrictBy>
                	<companyId>true</companyId>
                	<groupId>false</groupId>
                	<userId>false</userId>
                </restrictBy>
            </classDef>
            <fileDef>
                <name>Tasks</name>
                <fields>
                    <field>
                        <name>taskId</name>
                        <title>Task Id</title>
                        <type>
                            <long>
                                <length>5</length>
                                <signed>false</signed>
                                <nullable>false</nullable>
								<order>true</order> 
                            </long>
                        </type>
                        <showFieldInView>true</showFieldInView>
                    </field>
<!-- 
	Remember, the second field should be the link between master and detail file.
 -->                    
                    <field>
                        <name>studentId</name>
                        <title>Student Id</title>
                        <type>
                            <long>
                                <length>5</length>
                                <signed>false</signed>
                                <nullable>false</nullable>
								<order>true</order> 
                            </long>
                        </type>
                        <showFieldInView>false</showFieldInView>
                    </field>
                    <field>
                        <name>taskDescription</name>
                        <title>Task</title>
                        <type>
                        	<text></text>
                        </type>
                        <showFieldInView>true</showFieldInView>
                        <required>true</required>
                    </field>
                    <field>
                        <name>taskApproved</name>
                        <title>Approved</title>
                        <type>
                        	<boolean></boolean>
                        </type>
                        <showFieldInView>true</showFieldInView>
                    </field>
                </fields>
            </fileDef>
        </application>
    </applications>
</definition>
