Get persons in other companys with the same label

Domain model Entity Company (Associated to 1 Label) Entity Label (Enum Visibility(All;Label) Entity Person (Associated to Company, *..1) One person has one account Requirements Person can see all other persons in company When Label.Visiblity = Label, than Person can also see the other Persons in Company's with the same Label When Label.Visibility = All, then Person can see other Persons in the Company where Label.Visibility = All One grid shows the Person in the Company One grid shows the Persons in other Company using Requirement 2 & 3 Problem Requirement 2 & 3: Since there is no association between Person and all the other Person entity's, there is no XPath constraint to make. Requirement 2 & 3: I cannot make an association between Person and every Person when there is an XPath contraint. Also performance wise this is not want is useful. Requirement 5: No search fields can be made above the datagrid when I use a datasource microflow where my context is Company. The datasource microflow works, but now the app is more vulnarable to XPath injection. Requirement 5: When I use a datagrid where Context is Company/Label or Company I cannot meet Requirement 2 & 3 because in the XPath I cannot drill down after [Module.Person_Company/Module.Company/Module/Label_Company/Label != '[%CurrentObject%]'/Company_Label/Label] To me, there requirements sound easy but when building I found out that Requirement 2, 3 & 5 are hard the achieve. Does anyone has an advice for this?
1 answers

Label (1;) Company (1:) Person (using relations defined as labeled-company) and (working for)

Define after-commit MF on Person, retrieving and storing the label (enum) at Person lvl. req2: DB retrieve all person with the same label req3: ditto req5: having the Person-info now searchable solves this.

Remember that you can get Company info trough (working for).

Sometimes redundant storages of data helps a lot, just remember you need a mechanism to keep it synchronized (the after-commit MF)