Hi Mansour, 

Also one more point to add, the PartyRelationship has a fromDate and thruDate 
in addition to status! These dates bound the relationship through time and 
hence if as in your question John is no longer a developer then he would still 
have the role of a Developer in PartyRole which expires in a certain thruDate 
in PartyRelationship without being deleted! 

So in fact you keep the history of entities through time which is also a very 
powerful design concept if you think about it. 

Taher Alkhateeb 

----- Original Message -----

From: "Taher Alkhateeb" <[email protected]> 
To: [email protected] 
Sent: Sunday, 12 October, 2014 6:35:54 AM 
Subject: Re: Party Relationship and Party Roles 


Hi Mansour, 

I have two points to make on your below question: 

First, please note the Data Model book is not followed 100% in OFBiz, although 
it adheres to it quite well. 

Second, the model is made stronger by having foreign keys to all the entities 
you mentioned! The PartyRelationship entity has foreign keys to Party, RoleType 
_AND_ PartyRole and I believe this _IS_ the correct way. You assign foreign 
keys to the original entity which holds the referenced key instead of a foreign 
key to a foreign key to a foreign key ... bad design in my opinion. 

HTH 
Taher Alkhateeb 

----- Original Message -----

From: "Mansour Al Akeel" <[email protected]> 
To: "user" <[email protected]> 
Sent: Sunday, 12 October, 2014 5:31:33 AM 
Subject: Re: Party Relationship and Party Roles 

Taher, 
Thank you for th detailed explainatin. I understand the purpose of 
party_role, and asking why do we link party_relatinship to party, rather 
than party_role. 

Party_role entity contains partyIDs and roles types, still we duplicate 
this infomation in party_relationship. 

I hope this clarifies the source of confusion. The explaination in the book 
was not clear to me either. 

Thank you for any help. 
On 2014-10-11 6:48 PM, "Taher Alkhateeb" <[email protected]> 
wrote: 

> Hi Mansour, 
> 
> Simply speaking the party_role entity assigns roles to parties which can be 
> applied to many entities among which one of them is party_relationship. For 
> example, WorkEffortPartyAssignment links a party to a workeffort through a 
> role. Thus the partyrole is an entity to be (depending on some factors) 
> used for validation of the existence of the role before assigning it to one 
> of the relationship entities. At least that's my interpretation of it. 
> 
> Taher Alkhateeb 
> On Oct 12, 2014 12:58 AM, "Mansour Al Akeel" <[email protected]> 
> wrote: 
> 
> > I consulted the Data Model Resource Book to refresh my memory about 
> > the modelling for the roles and relationship for Party. 
> > 
> > In ofbiz, we have PartyRelationship between two parties. So each party 
> > ID is used as a key, combined with the relationship type. The book 
> > mentions on page 42, that when customizing the model, it's recommended 
> > to draw the relationship between party roles. 
> > 
> > The part that I find confusing is, if we have the two party IDs in the 
> > party_role entity, why don't we create the relationship between two 
> > party roles, instead of duplicating the information in the 
> > party_relationship entity ? For example, currently we have, 
> > 
> > party_relationship: 
> > - from party id 
> > - to party id 
> > - from role type id 
> > - to role type id 
> > - start date 
> > - end date ..... 
> > 
> > Can't we just use, 
> > party_relationship: 
> > -from role 
> > - to role 
> > - party relationship type 
> > 
> > assuming John has the role of developer. IBM has the role of employer. 
> > We can use the directly in the party relationship. Using the current 
> > model, we need to add the role_type to the party_relationship. If John 
> > is no longer a developer, then we need to update in two entities, the 
> > party_relationship, and the roles. 
> > 
> > I am not sure I understand the description in the book, and the design in 
> > ofbiz. 
> > 
> > Can someone kindly clarify the picture for me ?? 
> > 
> > Thank you. 
> > 
> 


Reply via email to