Entity over reference in custom widget xml

4
I am building a custom widget that has tasks. a task can contain 1 or multiple activities and each activity is connected to 1 task. Thus the domain model looks like this Activity (n)---> (1) Task Now i would like to build a custom widget that allows me to select a task entity and activities that are connected to a task over a reference. However if i use the following example then i can only select entities referenced by the task entity. Instead i would like all entities that reference to the task entity. I could simply switch this around and make task a path and set the activity as an entity but that does not seem right to me, as the task is my starting point. How would i solve this? <property key="taskEntity" type="entity" > <caption>Task entity</caption> <category>Data source</category> <description>The entity that is shown in the scheduler view.</description> </property><property key="actEntity" entityProperty="taskEntity" type="entity" required="false" isPath="yes" pathType="reference"> <caption>Activity entity</caption> <category>Data source</category> <description>Each task can be made up out of 1 or more activities. </description> </property> Edit: Basically what i want is to be able to set 2 entities in my widget propperties a parent and a child. Where the child is not required. So say i have the following domain model: Then i would like to be able to select one entity as a parent entity and then select a child entity that refers to my parent object. Going back to the properties file i would expect to be able to set this by using an parent entity (Task) and then have a child entity (Activity) that refers to the parent entity. (Also see the above propperty xml) But does not work as the reference only works one way, namely from your parent object instead of towards your parent object. I could solve this by creating the following property xml: <property key="taskEntity" entityProperty="actEntity" type="entity" isPath="yes" pathType="reference"> <caption>Task entity</caption> <category>Data source</category> <description>The entity that is shown in the scheduler view.</description> </property> <property key="actEntity" type="entity"> <caption>Activity entity</caption> <category>Data source</category> <description>Each task can be made up out of 1 or more activities. </description> </property> But then i always need to set my child object where in some cases i do not have one. So what i would like to do is, set a reference the other way around, select a parent and then select a child entity. Just like you do it in a nested datagrid, you first select a dataview entity. Which is your parent and then you select a child entity over your reference.
asked
3 answers
1

Hi Pieter,

Your second configuration is the correct one. To avoid the need to select a path, you could set isPath="optional" (altough that migth give issues with entityProperty, not sure) or introduce an additional, not required property.

Your widget could check at runtime that if an path is set, a child object should be set as well, and vice versa. (The widget XML is not very flexible, so you cannot express all logical check that you need.)

answered
0

I still do not understand you completely. You show a piece of XML that defines the interface to the modeller. However in the modeller only metadata is selected unless you use xpath constraints.

If you want to be able to select tasks and activities in a widget you can do xpath retrieves via the widget so it is possible to choose a task and get all activities for that.

Maybe you are locked in the way you want to have it, but is there another way around. Can you tell me more about the goals you want to achieve?

answered
0

Maby someone @ Mendix could give a go at this? :]

answered