In view-entity(s), is it possible to have conditionals in <relation>?

For eg, an entity Group can have 3 types of members: "LEADER", "VICE" and 
"MEMBER".

I've included my thoughts in the crude example below (please ignore syntax 
errors).

<entity entity-name="Group">
  <field name="groupId"/>
</entity>

<entity entity-name="Member">
  <field name="memberId"/>
  <field name="groupId"/>
  <field name="roleId"/>
  <relation rel-entity-name="Group">
    <key-map field-name="groupId"/>
  </relation>
</entity>

<view-entity entity-name="GroupAndMember">
  <member-entity entity-alias="GP" entity-name="Group"/>
  <member-entity entity-alias="LD" entity-name="Member"/>
  <member-entity entity-alias="VC" entity-name="Member"/>
  <member-entity entity-alias="MB" entity-name="Member"/>
  <alias-all entity-alias="GP"/>
  <alias entity-alias="LD" name="leaderId" field-name="memberId"/>
  <alias entity-alias="VC" name="viceId" field-name="memberId"/>
  <alias entity-alias="MB" name="memberId" field-name="memberId"/>
  <view-link entity-alias="GP" rel-entity-alias="LD" rel-optional="true">
    <!-- Where LD.roleId is "LEADER" -->
  </view-link>
  <view-link entity-alias="GP" rel-entity-alias="VC" rel-optional="true">
    <!-- Where VC.roleId is "VICE" -->
  </view-link>
  <view-link entity-alias="GP" rel-entity-alias="MB" rel-optional="true">
    <!-- Where MB.roleId is "MEMBER" -->
  </view-link>
</entity>

I know that I can simply use different entities for leader, vice and member (eg Leader, Vice and Member). But that would be a little awkward, since all the 3 entities will have exactly the same fields (just different roleIds).

Is the above possible in OFBiz's Entity framework?

Jonathon

Reply via email to